Forum Discussion
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
- andrew_C1
Nimbostratus
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.
- esch_tz_201996
Nimbostratus
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
Nimbostratus
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.
- Bart_18836
Nimbostratus
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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