Forum Discussion
Satoshi_Toyosa1
Feb 07, 2018Employee
The python equivalent of the above as below. In addition, it checks the status of two hosts in HA (assuming both hosts have the same userid/passwd).
from f5.bigip import ManagementRoot
for ip in ['192.168.226.41', '192.168.226.131']:
mgmt = ManagementRoot(ip, 'admin', 'admin')
fail = mgmt.tm.sys.failover.load()
failOverStat = fail.apiRawValues['apiAnonymous'].rstrip()
print "%s: Ver %s, %s" % (ip, mgmt.tmos_version, failOverStat)
Sample output:
192.168.226.41: Ver 13.0.0, Failover standby for 0d 04:35:49
192.168.226.131: Ver 13.0.0, Failover active for 0d 04:35:52
See also F5 Python SDK API Docs.