Hi,
Could someone explain why i get empty result when using object (IPAM.Subnet ) in Python? I'm unable to figure it out, some object's works properly but not this one.
There is no problem with this query once using SWQL Studio:
Try using the Orion SDK for your SWIS client. See GitHub - solarwinds/orionsdk-python: Python client for interacting with the SolarWinds Orion API for details (use pip install orionsdk). The following script works for me:
pip install orionsdk
from __future__ import print_functionimport requestsfrom orionsdk import SwisClientdef main(): npm_server = 'localhost' username = 'admin' password = '' swis = SwisClient(npm_server, username, password) results = swis.query('SELECT TOP 5 Address, CIDR FROM IPAM.Subnet') print(results)requests.packages.urllib3.disable_warnings()if __name__ == '__main__': main()
It didn't helped, i guess it's some kind of problem on server site
I tried your script and it seems to work on my end, so I'm not entirely sure unless something is missing from what you've shared.
Make sure you saved and re-ran the script. Make sure you're looking at the same Orion instance. It seems like you are connecting, just not getting any results back.
For reference the NULL values should still return something like this:
Query Test:
{'results': [{'Address': None, 'CIDR': None}, {'Address': '0.0.0.0', 'CIDR': 0}, <snip>
What version of IPAM are you running?
You might want to check with SWIS logs to see if there are any warnings or error messages. For a default installation, they are located at C:\ProgramData\SolarWinds\InformationService\v3.0\Orion.InformationService.log. Execute your script and then look at the most recent entries in the log file to see if it identifies any problems.
Hello,In my case on the nmp server there was AD Authentication, and after I used 'username = "DOMAIN\\username"' everything worked. If use just 'username = "username"' result will empty.
I was having the same issue and the above solution also fixed it. It was odd because everything else was working. Thank you for the solution!