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

Filter by:
  • Solution
  • Technology
Answers

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?

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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?

1
Comments on this Answer
Comment made 31-Aug-2016 by Strahinjas 11

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.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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.

0
Comments on this Answer
Comment made 31-Aug-2016 by Bart 207

"The $filter query parameter differs from the OData query parameter in that it only supports filtering by partition names in iControl® REST."

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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.

0