Quantcast
Channel: THWACK: Popular Discussions - Orion SDK
Viewing all articles
Browse latest Browse all 3719

Orion SDK sample script error

$
0
0

Hello,

 

I'm attempting to run a couple sample Python scripts from the Orion SDK.  I have a script I wrote myself and the 2 sample scripts from the SDK that error out with the following:

 

Traceback (most recent call last):

  File "sw-test2.py", line 18, in <module>

    results = swis.query("SELECT TOP 3 NodeID, DisplayName FROM Orion.Nodes")

  File "/usr/local/lib/python2.7/dist-packages/orionsdk/swisclient.py", line 24, in query

    {'query': query, 'parameters': params}).json()

  File "/usr/local/lib/python2.7/dist-packages/orionsdk/swisclient.py", line 50, in _req

    headers={'Content-Type': 'application/json'})

  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 50, in request

    response = session.request(method=method, url=url, **kwargs)

  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request

    resp = self.send(prep, **send_kwargs)

  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send

    r = adapter.send(request, **kwargs)

  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 415, in send

    raise ConnectionError(err, request=request)

requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

 

I can telnet to TCP 17778.

 

Here is one of the sample scripts:

 

import requests

from orionsdk import SwisClient

 

 

npm_server = 'X.X.X.X'

username = 'Xuser'

password = 'Xpassword'

 

 

verify = False

if not verify:

    from requests.packages.urllib3.exceptions import InsecureRequestWarning

    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

 

 

 

 

swis = SwisClient(npm_server, username, password)

 

 

print("Query Test:")

results = swis.query("SELECT TOP 3 NodeID, DisplayName FROM Orion.Nodes")

#results = swis.query("SELECT SysName, FROM Orion.Nodes, WHERE SysName LIKE '%ASRT%'")

 

 

for row in results['results']:

    #print("{NodeID:<5}: {DisplayName}".format(**row))

    print row

 

 

If I use curl:

 

# curl -k -v -u Xuser:Xpassword https://X.x.x.x:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+TOP+5+Caption+FROM+Orion.Nodes

*   Trying X.x.x.x...

* Connected to X.x.x.x (X.x.x.x) port 17778 (#0)

* found 173 certificates in /etc/ssl/certs/ca-certificates.crt

* found 697 certificates in /etc/ssl/certs

* ALPN, offering http/1.1

* gnutls_handshake() failed: Error in the pull function.

* Closing connection 0

curl: (35) gnutls_handshake() failed: Error in the pull function.

 

Can anyone suggest things that I should look at?

 

Thanks,

 

Mike


Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>