Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from requests.auth import HTTPBasicAuth
- BASE_URL = "https://localhost/mgmt/tm"
- username = "admin"
- password = "admin"
- def makeRequest(username, password, url):
- response_data = requests.get(url, auth = HTTPBasicAuth(username, password), verify = False)
- return response_data.json()
- pool_data = makeRequest(username, password, BASE_URL + "/ltm/pool")
- for pools in pool_data['items']:
- print pools['name']
- tildPath = pools['fullPath'].replace('/','~')
- #GET the Pool stats
- pool_stats = makeRequest(username, password, BASE_URL + "/ltm/pool/" + tildPath + "/stats")
- print pool_stats['entries']['status.availabilityState']['description']
- #GET the Pool Members
- pool_members = makeRequest(username, password, BASE_URL + "/ltm/pool/" + tildPath + "/members")
- for members in pool_members['items']:
- print members['name'] +" " + members['address'] + " " + members['state']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement