This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Rest Api Connection Failed

Hi Everyone,

I am trying to run the example code from GitHub to connect to Orion and fetch the VM list but seeing the following error during the connection though the IP and Solarwinds is active . What am I missing here.?

from swClassLib import *

sw = SolarWinds(ip='X.X.X.X', username="admin", password="admin")

vms = sw.getOrionVIMVirtualMachines()

print ("My VMs\n")

for vm in vms:

   print (vm.getName(), vm.getIPAddress())

Could not connect in call from [(<frame object at 0x023CA9F8>, 'C:\\Python27\\Lib\\swClassLib.py', 97, 'sendRequest', ['        caller = inspect.stack()\n'], 0), (<frame object at 0x0240D9E8>, 'C:\\Python27\\Lib\\swClassLib.py', 3226, 'getOrionVIMVirtualMachines', ['                status=200)\n'], 0), (<frame object at 0x005AD608>, 'C:/Users/admin/PycharmProjects/SSH/ORION.py', 4, '<module>', ['vms = sw.getOrionVIMVirtualMachines()\n'], 0)]. Unable to continue

My VMs

Thanks

Paul

  • I just noticed that this question has been sitting unanswered for a long time. Sorry about that.

    If you are still in need of assistance, could you point me to this code for "swClassLib"? I can't tell just from the exception trace what the underlying error is.

  • Hey tdanner,

    I've come across the same issue. The source code is around 7,500 lines long, so instead of posting code snippets out of context:

    https://github.com/Plexxi/SolarWindsOrionREST

    Here is a link to the repo.

    I believe the function of interest is in swClassLib at line 88, sendRequest().

    Send request is called in multiple functions, (such as getOrionContainer at line 572) in the form of:

      if selectQuery:

                currOrionContainer = self.sendRequest(

                    Type='GET',

                    URL='/SolarWinds/InformationService/v3/Json/Query?query=' +  selectQuery, #Select query is essentially a mySQL query

                    status=200)

    In my case I get the same error, which is dumped by the caller() function as a result of a failed Try/Except. I believe my issue could be my basic understanding of this code, for example I initialize my class as so:

         from swClassLib import *

         from swCommonLib import *

         SW = SolarWinds(ip = 'X.X.X.X', username = '<my_username>',password = 'passwordistaco')

    and then I try to access a table in the database.

         myTableofInterest = getOrionContainer()

         ^ this is the call that results in the same error as the OP's.

    My question is, Am I receiving an error because I don't understand the API and I'm not accessing the database correctly? Or is there another underlying issue...

  • The instructions at Troubleshooting · Plexxi/SolarWindsOrionREST Wiki · GitHub say that this error could result from an incorrect IP address. I suspect it could also be caused by a firewall blocking connections from wherever you are running the script to port 17778 on the Orion server.

    That wiki page also says, "you can modify a global variable in swClassLib.py, DEBUG = 0, 1, or 2, which has increasing levels of debug". Have you tried that to see if it results in a more informative error message?

  • I hadn't seen that bit about the debug levels, thank you very much! That gives me something to go on.

  • Did this ever get resolved?

    --

    Steven Klassen

    Developer Analyst @ Loop1 Systems, Inc.

    http://www.loop1systems.com/