Forum Discussion
Can a Health Monitor tell a server's 'ping' page about the F5's status?
Is it possible for the F5 to pass connection information to my ping.jsp page (the one that is currently configured for use by the F5's health monitor).
My ping page is currently able to tell the F5 "I'm up" or "I've been quiesced", please direct/drain traffic away from me to other members of the pool.
When I need to take down a pool instance for upgrade, I put it into quiesce mode (which the F5 picks up during health monitoring) and then it is necessary to check the F5 console for connection numbers to see whether the instance has been queisced and its connection count gone down to 0, so that it can safely be brought down.
Trouble is: I don't actually have access to the relevant F5 console and have to rely on some other 'gods' around the enterprise to do it for me...this can be troublesome/time consuming/paperwork intensive...
My thought/hope is: if the F5 could tell me the current stats when it polls me, then I could just check my instance and see “the F5 is telling me that no-one is using me now, so it is OK for me to ‘go away’”
No need for access to the F5…profit!
I have been reading dev/central and clouddocs...
External monitors: https://support.f5.com/csp/article/K71282813
LocalLB::Pool::get_member_statistics: https://clouddocs.f5.com/api/icontrol-soap/LocalLB__Pool__get_member_statistics.html
I THINK that I can develop an external monitor to do this.
I BELIEVE that something like LocalLB::Pool::get_member_statistics should help me get what I need from the F5.
This is available to Perl scripts? Even better, can I use python?
I think I can pull the return structure apart to get the up/down status and connection count for each pool member and then pass what I need as reqest parameters to a curl call that hits my ping page.
Is this correct?
Judging from other code snippets, this looks like a lot of fiddly work! Better to "Stand on the shoulders of Giants", if I can!
Has anyone tried to do this before?
Is there any code out there that could save me some effort?
Is there an equivalent (easier!?) REST api?
Pointers/thoughts gratefully received.
BOB
About 10mins after I posted my question, I discovered iControlREST: https://clouddocs.f5.com/api/icontrol-rest/!
If allows:
[root@bigip:Active:Standalone] x # curl --silent --insecure --user admin:xxx https://localhost:8443/mgmt/tm/ltm/ pool/"~Common~mypool"/members/stats | jq -c '[( .entries[].nestedStats.entries | { address:.addr.description, port:.port.v alue, curSessions:."serverside.curConns".value, state:.monitorStatus.description })]' [{"address":"192.168.1.3","port":8443,"curSessions":0,"state":"down"},{"address":"192.168.1.3","port":8543,"curSessions":0,"state":"user-down"},{"address":"192.168.1.3","port":8643,"curSessions":0,"state":"user-down"},{"address":"192.168.1.3","port":8743,"curSessions":0,"state":"user-down"},{"address":"192.168.1.100","port":8080,"curSessions":0,"state":"down"}]
Having curl and jq work together is simple and powerful.
This appears to be just what I need...easy to wrap into a bash script that I can set as an external monitor.
I now have a pretty small bash script that takes the JSON above and passes it in the body of a POST to my app's ping endpoint.
I hope it is performant enough for The Small Gods of the F5 to accept it for PROD use. Should be. We will see...
I accumulated some useful references...happy to share:
useful refs:
https://clouddocs.f5.com/api/icontrol-rest/APIRef_tm_ltm.htmlhttps://support.f5.com/csp/article/K17283308
https://support.f5.com/csp/article/K71282813
https://community.f5.com/t5/tag/series-icontrol-rest-jq-cookbook/tg-p
https://community.f5.com/t5/tag/series-demystifying-icontrol-rest/tg-p/board-id/TechnicalArticles
https://programminghistorian.org/en/lessons/json-and-jq
https://cdn.f5.com/websites/devcentral.f5.com/downloads/icontrol-rest-api-user-guide-15-1-0.pdf
There's some really Good Stuff there...very helpful.
Cheers!
- ThirtyDayTrialNimbostratus
About 10mins after I posted my question, I discovered iControlREST: https://clouddocs.f5.com/api/icontrol-rest/!
If allows:
[root@bigip:Active:Standalone] x # curl --silent --insecure --user admin:xxx https://localhost:8443/mgmt/tm/ltm/ pool/"~Common~mypool"/members/stats | jq -c '[( .entries[].nestedStats.entries | { address:.addr.description, port:.port.v alue, curSessions:."serverside.curConns".value, state:.monitorStatus.description })]' [{"address":"192.168.1.3","port":8443,"curSessions":0,"state":"down"},{"address":"192.168.1.3","port":8543,"curSessions":0,"state":"user-down"},{"address":"192.168.1.3","port":8643,"curSessions":0,"state":"user-down"},{"address":"192.168.1.3","port":8743,"curSessions":0,"state":"user-down"},{"address":"192.168.1.100","port":8080,"curSessions":0,"state":"down"}]
Having curl and jq work together is simple and powerful.
This appears to be just what I need...easy to wrap into a bash script that I can set as an external monitor.
I now have a pretty small bash script that takes the JSON above and passes it in the body of a POST to my app's ping endpoint.
I hope it is performant enough for The Small Gods of the F5 to accept it for PROD use. Should be. We will see...
I accumulated some useful references...happy to share:
useful refs:
https://clouddocs.f5.com/api/icontrol-rest/APIRef_tm_ltm.htmlhttps://support.f5.com/csp/article/K17283308
https://support.f5.com/csp/article/K71282813
https://community.f5.com/t5/tag/series-icontrol-rest-jq-cookbook/tg-p
https://community.f5.com/t5/tag/series-demystifying-icontrol-rest/tg-p/board-id/TechnicalArticles
https://programminghistorian.org/en/lessons/json-and-jq
https://cdn.f5.com/websites/devcentral.f5.com/downloads/icontrol-rest-api-user-guide-15-1-0.pdf
There's some really Good Stuff there...very helpful.
Cheers!
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