Forum Discussion

esch_tz_201996's avatar
esch_tz_201996
Icon for Nimbostratus rankNimbostratus
Feb 12, 2016

iControl REST API: How to get the pool from a VIP+PORT

My goal is to get the pool's member status given a VIP and I would to do that by using the iControl REST API

As far as I know I have to:

  • find the VirtualServer by using the VIP
  • find the Pool by using the VirtualServer
  • get the members status by using the Pool

The most difficult step seems to be the first one. I am not sure if it is possible to find the right VirtualServer by using the $filter query parameter:

 


https://ip.ip.ip.ip/mgmt/tm/ltm/virtual?$filter=destination+eq+/Common/VIP.VIP.VIP.VIP:443

 

The example above doesn't work as I am still getting the full VirtualServers list

Is there a way to query the iControl REST API to get only the required VirtualServer by using the VIP?

4 Replies

  • i would like to know this as well, as Icontorl objects always seem to be based on its name while in irules somethings return the ip address not the name.

     

  • It looks like this is not possible due to an API limitation:

     

    $ curl -sk -u user:pass "https://my.ltm.com/mgmt/tm/ltm/virtual?\$filter=destination%20eq%20test"
    {"code":400,"message":"Query parameter $filter has invalid value destination eq test.","errorStack":[]}%

     

    Is there any other doable approach?

    This seems to be a BigLimitation for the LTM/F5 REST and SOAP APIs

    Also the option of download the whole VirtualServer blob and parse it later, doesn't seems to be a real option, as on devices with thousands of entries it will takes too much time and will use too many cpu resources.

    Any suggestion?

    • Strahinjas_2827's avatar
      Strahinjas_2827
      Icon for Nimbostratus rankNimbostratus

      I was going to ask exactly the same, as we've just finished one DC part with the Netscaler, but not having the filtering in similar manner for the other part with F5, would be a big surprise, and that seems to be the case.

       

  • Assuming you have access to linux server with curl and python you can get a list of virtual servers containing "VIP" word with this:

     

    curl -s -u user:password -k --insecure https://ipaddress/mgmt/tm/ltm/virtual/?\$select=fullPath | python -m json.tool | grep VIP | awk -F : '{print $2}' | tr -d "\" "

     

    You can redirect output to temporary file. From there you will either have to write a script/program which uses each line as a parameter for another quesry which would get details for each virtual server.

     

    Personally I am using python to get that kind of data and present it in a nice form.