Forum Discussion

Wally_Steadman_'s avatar
Wally_Steadman_
Icon for Nimbostratus rankNimbostratus
Sep 17, 2018

Getting LTM Config Sync Status from F5 SDK

Folks, I am using the Python f5 SDK and I have a script that goes out to all of my LTM's and once it finds that they are the primary LTM I want to find out the Config Sync status of that pair of devices but not sure the command structure to get the Config Sync Status results.

 

I am using the below code to get Pool and Members so I know the login is working on the Active LB but want to tweak it to get the Config Sync Status

 

from gitscript import parse_yaml
from f5.bigip import *
import time
import re
import socket

start_time = time.time()
active_devices = []
standby_devices = []
issues = open('issues.txt', 'w')

def device_state(host):
    try:
        management = ManagementRoot(host, "admin", "PASSWORD")
    except Exception as e:
        print(host + " Login Issues")
        issues.write(host + '\n')
        return
    pools = management.tm.ltm.pools.get_collection()
    
    for pool in pools:
    print("POOL" + pool.name)
    for member in pool.members_s.get_collection():
    print("MEMBERS " + member.name)

lb = parse_yaml('bigip1.cfg')   uses the gitscripts module to get list of GIT devices - Parse YAML Files
print("LB PARSE TIME ELAPSED: {:.2f}s".format(time.time() - start_time))
Loop Separates Active and Standby Load Balancers
for line in lb:
    hostname = line.strip()
    if not (re.search("gtm-intra", hostname) or re.search('gtm-extra', hostname)):   excludes the gtms
         print(hostname)
        device_state(hostname)

Any assistance is appreciated. Thanks Wally

 

No RepliesBe the first to reply