Forum Discussion

PatrickCox's avatar
PatrickCox
Icon for Altocumulus rankAltocumulus
Oct 19, 2020

iControl REST - Finding a pool with a specific member

Hi,

 

Would anyone know of a shortcut to finding a pool (or pools) with a specific member?

 

In the WebGUI (v13.1.3) when viewing the properties of a node there is a Pool Membership tab. It will show what pools the node is a member of.

 

I would like to use an iControl REST call to determine the same thing.

 

I have the code to get the list of pools with their basic properties. One of the pool's properties is the memberReference link. I can use this link to get a list of pool members with properties including memberName (nodeName:port), IPaddress, etc. Potentially I could query every pool (500+) and build a list of pool members with the properties like: PoolName, memberName, IPaddress.... Then I could scan this list for either the node or the node's IP address.

 

It's a bit of a pig. Just thought there might be a quicker way.

 

...Patrick

 

 

 

  • As Dario mentioned, use ?expandSubcollections=true to include the actual information (instead of just links) on the pool members. To extract the pool names that contain a certain pool member, I would use jq.

    Example: Extracting the pool name(s) that contain the member "CentOS-internal20:443"

    $ curl -sku $PASS https://$HOST/mgmt/tm/ltm/pool?expandSubcollections=true | jq '.items[] | select(.membersReference.items[].name == "CentOS-internal20:443") | .name'
    "Pool-CentOS443"

    Be careful, though. Since your BIG-IP has 500+ pools, the response body is expected to be fairly large. Due to its size, the call may pressure the Control Plane and mcpd (configuration management daemon), and subsequently the call may time out. Test it while the system is not busy.

    For more information on the iControl REST options, refer to iControl R EST User Guide (PDF) in iControl REST Home.

  • Hello Patrick.

    There no way to get this info directly from iControlREST.

    The most similar is to capture al the pool members of each pool a filter it after. With this specific query you could catch only the pool and poolmember names.

    curl -sku admin:<PASSWORD> https://<BIGIP>/mgmt/tm/ltm/pool?\&expandSubcollections=true\&\$select=name,membersReference/items/name | json-format

    Despite this, with iControlREST you can also request one specific TMSH command, so another idea could be to show all your pools but filtering them by POOLMEMBER+PORT. An example below:

    curl -sku admin:<PASSWORD> -X POST -H "Content-Type: application/json" https://<BIGIP>/mgmt/tm/util/bash -d "{\"command\":\"run\", \"utilCmdArgs\": \"-c 'tmsh list ltm pool members \{ MY-POOL-MEMBER:443 \}'\"}" | sed 's/\\n/\n/g'

    Regards,

    Dario.