GetScheduledListResourcesStatus always returns "unknown" status

I have been trying to discovery the resources for both new and existing nodes using the "GetScheduledListResourcesStatus" API command.  I keep getting a status "unknown" when using this feature on new or existing nodes.  I've tested this with multiple versions of code and on many different types of nodes with no success.  We are currently running 2020.2.6.  Looking for some guidance on how to solve this issue or what I might be missing in the code...

I used the powershell example posted online as the base for our script: Reference Page: https://support.solarwinds.com/SuccessCenter/s/article/Update-resources-on-an-agent-node-using-SWQL?language=en_US

The example code below and debug output is from our proprietary automation platform we use at our company.  However, it is based on Python, so the code is very similar to python examples posted online:.  

********************** List Resources Python Script Example **********************


# Description: List all Resources for a specific NodeID
# Reference Page: support.solarwinds.com/.../Update-resources-on-an-agent-node-using-SWQL

# nodeid="31838" # Router
nodeid="33775" # UPS
# nodeid="9095" # switch

# Invoke ScheduleListResources for a NodeID, wait for response, which is the resulting JobID...
log.error("Kicking off Resource List Request for NodeID = {}".format(nodeid))
jobid = plugin.solarwinds.invoke(entity="Orion.Nodes", verb="ScheduleListResources", args=nodeid, cred='solarwinds_admin')

# Use the resulting JobID from above to retrieve the status of the listresources request above...it may take time to complete
log.error("Waiting until job #{} status = 'ReadyForImport'...".format(jobid))
lr_status = plugin.solarwinds.invoke(entity="Orion.Nodes", verb="GetScheduledListResourcesStatus", args=[jobid, nodeid], cred='solarwinds_admin')
log.error("Wait 285sec for first first status check, then check status every 30sec")
plugin.tools.wait(seconds=285)
while lr_status == 'Unknown':
# Checking for status to change from 'unknown' to 'ReadyForImport'
plugin.tools.wait(seconds=30)
lr_status = plugin.solarwinds.invoke(entity="Orion.Nodes", verb="GetScheduledListResourcesStatus", args=[jobid, nodeid], cred='solarwinds_admin')
log.error("Resource Request Status = {}".format(lr_status))

# Wait for the job status to be "ReadyForImport", then ImportListResourcesResult
log.error("Importing Resource List Results...")
list_resources = plugin.solarwinds.invoke(entity="Orion.Nodes", verb="ImportListResourcesResult", args=[jobid, nodeid], cred='solarwinds_admin')


# Format result (make them look pretty!)
sw_results = plugin.tools.prettify(data=list_resources, indent=1)

# display results
return sw_results

********************************** Debug Output from running the script **********************************
25 workers, 24 are idle, 1 are busy and 0 are suspended.
task running
Kicking off Resource List Request for NodeID = 33775
Waiting until job #6a99b335-387d-4483-8a02-aa9b0edda0e4 status = 'ReadyForImport'...
Wait 285sec for first first status check, then check status every 30sec
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown
Resource Request Status = Unknown

The "unknown" continues on for several hours and never changes...eventually the script times out.   Don't understand why the status never changes?  what am I missing here?

  • If you test out the Support article link using PowerShell, does it work? I typically get my API examples from SolarWinds Github site as I've seen those get updated while the support articles tend the lag behind.

    This is the direct link.

    OrionSDK/ImportListResources.ps1 at master · solarwinds/OrionSDK · GitHub

    That would at least tell us if there is a general issue with the application/API vs a coding issue. Also, is it possible to edit your original post and format your python script using the <code> snippet? I know python is very specific about spacing.

  • Hi Chad,

    thanks for the suggestions.  I have not tested with the original powershell script.  I don't really have a good way to do that give our current setup (i.e. only our automation system has access to the solarwinds API).  I was hoping there was some kind of debug I could enable to look for why the we are getting the "unknown" response constantly. 

    BTW:  Our automation system framework takes care of interpreting the code for us, so spacing is not an issue with the python code (unless you were asking so you could read it easier...wasn't sure if you thought the code wasn't working because of formatting issues).  :)  

    I'll keep checking to see if there is a way I can test a powershell script.  In the meantime, any other thoughts on troubleshooting this issue?  thanks again for the help!

    Regards,

    Eric

  • There's also a separate Python GitHub for Orion API samples.  As far as pasting in the code, it's much easier to use the Insert/Code feature - especially when dealing with certain things - like I have no idea (at initial glance) where your while loop ends.  Also, I'm not an expert in Python, but I can generally fake my way by reading code.

  • , the formatting would allow me to test it on my end. Smiley