Forum Discussion

jps31_323267's avatar
jps31_323267
Icon for Nimbostratus rankNimbostratus
Aug 18, 2017

REST API - Check F5 availability when active/passive configuration

Hello, We are using REST API (/mgmt/tm/ltm/pool) in order to test F5 availability. Testing active F5, we are getting succesfull answers. Issuing the same request on passive F5, we are getting errors. I'm wondering if we are doing it well. I've two IP, one is passive, one is active. I don't know which one. I've to monitor and list all vserver from active F5 and check that the other one is on passive state. How to check that I'm in this state. One active and the other passive ? I've yet developed the REST program to list all items inside the active F5. Could you help me ?

 

1 Reply

  • 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?