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?