Difference between revisions of "F5 sdk snippets"
Jump to navigation
Jump to search
Line 29: | Line 29: | ||
## Members (Pool) | ## Members (Pool) | ||
+ | ``` | ||
+ | url = "https://{F5_HOST}/mgmt/tm/ltm/pool/~QA~vs_api.qa.example.com_int_https/members" | ||
+ | ``` | ||
## Nodes | ## Nodes | ||
+ | ``` | ||
+ | url = "https://{F5_HOST}/mgmt/tm/ltm/node/~QA~foo-backend~/stats" | ||
+ | url = https://{F5_HOST}/mgmt/tm/ltm/node | ||
+ | ``` |
Revision as of 18:20, 10 September 2023
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']
Members (Pool)
url = "https://{F5_HOST}/mgmt/tm/ltm/pool/~QA~vs_api.qa.example.com_int_https/members"
Nodes
url = "https://{F5_HOST}/mgmt/tm/ltm/node/~QA~foo-backend~/stats" url = https://{F5_HOST}/mgmt/tm/ltm/node