Forum Discussion
Ed_Summers
Aug 20, 2017Nimbostratus
I let my second lab license lapse so I only have one currently and can't show a better example quickly. However if you're in an active/passive configuration (not running multiple traffic groups with multiple active devices) you can get a quick active/passive state from the CM device list. I had a short script that checked and created a session to the active device in order to pull stats.
Using the F5 Python SDK:
>>> from f5.bigip import ManagementRoot
>>>
>>> mgmt_ip = '10.1.0.1'
>>> username = 'admin'
>>> password = 'admin'
>>>
>>> mgmt = ManagementRoot(mgmt_ip, username, password)
>>> devices = mgmt.tm.cm.devices.get_collection()
>>> for device in devices:
... print(device.managementIp, device.failoverState)
...
(u'172.29.254.2', u'active')
>>>
If you have multiple devices, you'll be able to tell which management IP is the active device and act from there.
What were you trying to pull from the standby device that was failing?