Forum Discussion

Wally_Steadman_'s avatar
Wally_Steadman_
Icon for Nimbostratus rankNimbostratus
Apr 30, 2018

Finding Standalone and also finding which LTM is active

Greetings folks, So I am working on a script to get a consolidated list of all VIPs on all of our LTMs in production. I am using python and the f5-sdk and I have worked out the script to get the VIP information, but now I need to work out how to identify if the device is part of an ha cluster or it is stand alone, and then if it is part of an ha cluster, is is the active or the standby.

My thought was to run a for loop on a file with the FQDN's of all of our LTMs and when it logs in gets the information from the device,

the first pieces it gets are to find out if it is an HA cluster.  
If Yes:
    Find out if it is the Active Member of the Cluster
        If Yes:
            Get the VIP information
        If No:  
            Do Nothing
If No:  
get VIP information

I have searched can't find the f5-sdk solution for getting this information and would appreciate someone pointing me in the correct direction.

We have over 200 Devices and this script would be run on a weekly basis and the output sent to a file that will be dealt with using other methods after the output file is created.

  • I used the next function for getting information about devices and active/standby state in the cluster.

    from prettytable import PrettyTable
    
    def get_cluster(mgmt):
    
        tcluster = PrettyTable(["Device name","IP","State"])
        devices = mgmt.tm.cm.devices.get_collection()
        for device in devices:
            tcluster.add_row([device.name, device.managementIp, device.failoverState])
        return tcluster
    

    Hope it helps.