F5 sdk snippets
Jump to navigation
Jump to search
import requests import os requests.packages.urllib3.disable_warnings() F5_HOST = os.getenv('AD_HOST') AD_USER = os.getenv('AD_USER') AD_PASS = os.environ.get('AD_PASS') url = f"https://{F5_HOST}/mgmt/tm/ltm/virtual" session = requests.Session() session.auth = (AD_USER, AD_PASS)
Virtuals
r = session.get(url, verify=False) r.json()['entries']['https://localhost/mgmt/tm/ltm/virtual/~QA~vs_api.qa.example.com_int_https/stats']['nestedStats']['entries']
Pools
url = f"https://{F5_HOST}/mgmt/tm/ltm/pool" url = "https://{F5_HOST}/mgmt/tm/ltm/pool/~QA~vs_api.qa.example.com_int_https/stats" r = session.get(url, verify=False) r.json()['entries']['https://localhost/mgmt/tm/ltm/pool/~QA~vs_api.qa.example.com_int_https/stats']['nestedStats']['entries']