Skip to content

Instantly share code, notes, and snippets.

@c-success
Last active July 12, 2018 09:18
Show Gist options
  • Save c-success/6ccffdf932a7224221ad3819bbb6bd7b to your computer and use it in GitHub Desktop.
Save c-success/6ccffdf932a7224221ad3819bbb6bd7b to your computer and use it in GitHub Desktop.
# Prepare Headers
headers = {
"provider": "yourprovidername",
"tenant": "yourtenantname",
"Content-Type": "application/json",
"Authorization":"session " + session_token
}
# API URLs to collect the logs
api_url = a10_api_server + "/analytics/ladc/app-server-health"
req_data = {
"query": {
"fields": ["healthIndex","applicationId","serverId","serviceId","timestamp"],
"rangeby": {
"start": 1531264180000,
"end": 1531269290000,
"field": "timestamp"
},
"filterby": {
"and": {
"applicationId": ""
}
}
}
}
# Making POST call to fetch appservers health index and server IP
resp = requests.post(api_url, headers=headers,data=json.dumps(req_data)).json()["query"]
for key, value in resp.items():
for key in value:
print("{0} = {1} \n".format(key, value[key]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment