Forum Discussion
Thanushka_Wije1
Nimbostratus
Jun 19, 2019Automated F5 LTM pre and post checks
Hi I'm trying to automate F5 check using F5sdk, unfortunately I think that sdk retrieve virtual server details via .conf file. Reason I'm telling that is from sdk I'm unable to retrieve F5 Avai...
Thanushka_Wije1
Nimbostratus
Jun 19, 2019Hi Dario
Thanks for the responses, but this will return device HA status not the virtual server (Availability). status..
Dario_Garrido
Noctilucent
Jun 20, 2019The availability of a virtual server resides in the stats
from f5.bigip import ManagementRoot
from f5.utils.responses.handlers import Stats
# ----------------------------------------------------------
session = ManagementRoot("F5_mgmt_IP","username","password",token=True)
virtual = session.tm.ltm.virtuals.virtual.load(name='testVS')
#https://<F5_mgmt_IP>/mgmt/tm/ltm/virtual/testVS
virtualstats = Stats(virtual.stats.load())
#https://<F5_mgmt_IP>/mgmt/tm/ltm/virtual/testVS/stats
for key, value in virtualstats.stat.items():
if value.get('description') != None:
print("{}: {}".format(key, value.get('description')))
elif value.get('value') != None:
print("{}: {}".format(key, value.get('value')))
# ----------------------------------------------------------
KR,
Dario.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects