Forum Discussion
stecino_87658
Nimbostratus
Jan 29, 2016Node to Pool to VIP referencing in IControl
Hello,
Want to know how I gather info where node will reference to pools it's in, and pools assignments to VIP(s)
NodeAddressV2.get_metadata supposed to give me this info, but I am getting empty...
Theo_12742
Cirrus
Jan 29, 2016Unless you're using metadata capable config (MCC) objects, you won't see that information. However, it's easy to build a reverse lookup using API.
Here's an example using python (bigsuds). For simplicity, I'm storing the list of pools and their members locally and using a known node name, but this can easily be iterated.
import bigsuds
Node to search for
node = '/Common/1.2.3.4'
print "Pools using Node "+node
Connect to BIG-IP
b = bigsuds.BIGIP(hostname, username, password)
Get list of pools and pool members
pools = b.LocalLB.Pool.get_list()
members = b.LocalLB.Pool.get_member_v2(pools)
Iterate through pool member list (has a list of members per pool referenced) looking for node
for i, pool in enumerate(pool_members):
for member in pool:
if member['address'] == node:
print "\t"+pools[i]
and here's the same for Pools to Virtual Servers:
import bigsuds
Pool to search for
pool = '/Common/my_pool'
print "Virtual Servers using Pool "+pool
Connect to BIG-IP
b = bigsuds.BIGIP(hostname, username, password)
Get list of pools and pool members
virtual_servers = b.LocalLB.VirtualServer.get_list()
vs_pools = b.LocalLB.VirtualServer.get_default_pool_name(virtual_servers)
Iterate through pool member list (has a list of members per pool referenced) looking for node
for i, vs_pool in enumerate(vs_pools):
if pool == vs_pool:
print "\t"+virtual_servers[i]
stecino_87658
Nimbostratus
Jan 29, 2016Thanks for the feedback, I was trying to avoid having to do that :)
This will be pretty expensive query every time i run it. I may have to cache for some short period of time vip and pool list to make this faster
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects