Forum Discussion

JoshBarrow's avatar
Mar 22, 2021

iControl REST Get Pool Member

I'm currently trying to write a script in powershell that gets the pool members of a specific pool. The problem i'm having right now is that I have it sitting in a different partition than Common and it's throwing " The requested Pool (/Common/pool_name) was not found." which makes sense.

I'm wondering how can I reference the different partition in my powershell script?

 

$F5 = LTMName

$input = input

$F5PoolURI = "https://$LTMName/mgmt/tm/ltm/pool/$input/members"

$credentials = Get-Credential

$Query = Invoke-RestMethod $LTMPoolURI -Credential $credentials -method GET

 

1 Reply

  • I'll give you a trick. Get ie. https://bigip-01.domain.se/mgmt/tm/ltm/pool and check the JSON response.

     

    {
       "items" : [
          {
             "allowNat" : "yes",
             "allowSnat" : "yes",
             "fullPath" : "/rancher/Shared/istio_system_istio_ingressgateway_443",
             "generation" : 1905,
             "ignorePersistedWeight" : "disabled",
             "ipTosToClient" : "pass-through",
             "ipTosToServer" : "pass-through",
             "kind" : "tm:ltm:pool:poolstate",
             "linkQosToClient" : "pass-through",
             "linkQosToServer" : "pass-through",
             "loadBalancingMode" : "round-robin",
             "membersReference" : {
                "isSubcollection" : true,
                "link" : "https://localhost/mgmt/tm/ltm/pool/~rancher~Shared~istio_system_istio_ingressgateway_443/members?ver=16.0.1.1"
             },
             "minActiveMembers" : 1,
             "minUpMembers" : 0,
             "minUpMembersAction" : "failover",
             "minUpMembersChecking" : "disabled",
             "name" : "istio_system_istio_ingressgateway_443",
             "partition" : "rancher",
             "queueDepthLimit" : 0,
             "queueOnConnectionLimit" : "disabled",
             "queueTimeLimit" : 0,
             "reselectTries" : 0,
             "selfLink" : "https://localhost/mgmt/tm/ltm/pool/~rancher~Shared~istio_system_istio_ingressgateway_443?ver=16.0.1.1",
             "serviceDownAction" : "none",
             "slowRampTime" : 10,
             "subPath" : "Shared"
          }
       ],
       "kind" : "tm:ltm:pool:poolcollectionstate",
       "selfLink" : "https://localhost/mgmt/tm/ltm/pool?ver=16.0.1.1"
    }

     

    If you look at the self links you can see the correct path there.

    TLDR;

    Replace "/" in the path with ~. So if you want to see the members in /rancher/istio_system_istio_ingressgateway_443 you can just use the URI /mgmt/tm/ltm/pool/~rancher~Shared~istio_system_istio_ingressgateway_443/members

    Make sense?

    I wrote a guide for the REST API and there's some Powershell examples in it. Maybe it'll help too?

    https://loadbalancing.se/f5-rest-api-getting-started/

    Kind regards,

    Patrik