Forum Discussion

AllanM1's avatar
AllanM1
Icon for Nimbostratus rankNimbostratus
Jan 29, 2019

iControl show all detail

Regarding gtm and ltm pools and members, how does one request "all" from iControl rest api, rather than having to request each pool/member/virtual? With tmsh, this is possible - tmsh show gtm wideip A all detail. I'm trying to build a view of wideip pools, listing each virtual server, and then listing each virtual server's members, with statuses at each level. With iControl, it seems one must iterate through wideips -> pools -> members -> virtual servers -> pools -> members.

 

With tmsh text output, I built a script in a couple of hours to show this report. With iControl, it's a significant programming project to re-assemble the data, and it will never be useful because you can't pull the data fast enough. It took about 30 minutes to execute the hundreds of requests needed just to drill down to the vips. It's not feasible to use this method. How does one request 'all' from iControl, while using a limited user with only GET request permissions (no util/bash)?

 

1 Reply

  • First off, use the iCR python module and secondly, retrieve pools with expandSubCollections set which will retrieve the pool member data. See below an example script to copy pools from one device to another.:

    !/usr/bin/env python
    from iCR import iCR
    s = iCR("172.24.9.132","admin","admin")
    t = iCR("10.128.1.245","admin","admin")
    
    pools = s.get("ltm/pool?expandSubcollections=true")['items']
    for pool in pools:
         Remove stat and session from membersReference => items
        for member in pool['membersReference']['items']:
            del member['state']
            del member['session']
         POST to the target device
        if t.create("ltm/pool",pool):
            print "Created " + pool['name']
        else:
            print "Error creating " + pool['name']