Skip to content

Instantly share code, notes, and snippets.

@jaimegago
Last active June 21, 2023 18:36
Show Gist options
  • Save jaimegago/c0f33dcc297e7727091e to your computer and use it in GitHub Desktop.
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
#!/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