Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

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

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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']  
0
Comments on this Answer
Comment made 1 month ago by AllanM1 1

Thanks, expandSubcollections=true helped a lot. That brings it down to 3 requests per datacenter.

/mgmt/tm/gtm/pool/a?expandSubcollections=true

/mgmt/tm/ltm/virtual

/mgmt/tm/ltm/pool/?expandSubcollections=true

By interleaving these 3 json sets, then combining that with DNS lookups and asset management db queries, I was able to build an overall view of gtm pools, Virtual Server members, and VS member nodes with VS member up/down statuses.

1
Comment made 1 month ago by Pete White

Great to hear it. Keep up the good work.

0