Forum Discussion

syncretism's avatar
syncretism
Icon for Nimbostratus rankNimbostratus
Jun 22, 2017

What's the Best Way to Derive a Device-Group Name Over REST?

In order to create some scaleable BigIP automation, I need to be able to sync my active and standby balancers. To do this, I need to know the name of the device group. I've been using JQ to filter the output from https://active-balancer.mydomain.com/mgmt/tm/cm/syncStatus/

 

I have to upload an image, because devcentral's flagging my post as spam:

 

 

This isn't ideal, but I guess if I can always rely on the description for to contain the device group, I can parse it out with JQ. Is there a better way to get the desired string, which, in this case, is FOO-BAR-LB (see highlight in image)? Indeed, if there's a better approach to syncing an active:failover pair when you don't know the name of the device group, I'm all ears! Thanks.

 

3 Replies

  • P_K's avatar
    P_K
    Icon for Altostratus rankAltostratus

    Are you trying to pull just the Traffic group out of the output?

     

  • I use the Python SDK so I may not be able to get you exactly there, but hopefully can help a bit.

     

    There is a device_groups sub-collection under /mgmt/tm/cm. I just checked a cluster that is running a single traffic-group, and it has three device-groups: gtm, the device_trust_group, and the sync-failover group containing the traffic group.

     

    There may be a better way to pull the desired device-group from that list. In my case the desired group is the only one of type sync-failover (the others are sync-only).

     

  • I suppose I am. As it stands, I have to pull sync status to get the name of the device group, which I then use to sync the group with another rest call:

     

    POST -d '{"command":"run","utilCmdArgs":"config-sync to-group FOO-BAR-LB"}'

     

    Then I check sync status again to confirm that the sync took place. I haven't found another way to get this group name programmatically, but I'm not an f5 admin.