Last active
June 21, 2023 18:36
-
-
Save jaimegago/c0f33dcc297e7727091e to your computer and use it in GitHub Desktop.
Python script targeting Citrix Netscaler Nitro REST API to find which Netscaler config objects have stats associated with them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -tt | |
import requests | |
user = 'nsroot' | |
password = 'nsroot' | |
netscaler = 'my_netscaler_fqdn_or_ip' | |
url = 'http://%s/nitro/v1/config/' % netscaler | |
response = requests.get(url, auth=(user, password)) | |
data = response.json() | |
for config_object in data['configobjects']: | |
stat_url_test = 'http://%s/nitro/v1/stat/%s' % (netscaler, config_object) | |
response = requests.get(stat_url_test, auth=(user, password)) | |
if response.status_code == 200: | |
print config_object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment