Forum Discussion
F5 - Command Line VIP/Pool/Node/Last UP Status Summary
Fellow F5 Admins...
I have been trying to find the ideal Command Line to use on the F5 to ideally get the VIP/Pool/Node/Last UP Status Summary all in 1 line to be imported to a *.csv?
Thank you in advance for your Command Line Script.
To do so, you need Bash engineering 🙂
start with:
tmsh show ltm pool members | grep -e "Ltm::" -e "Activity" -e "State"
If you need more help, tell me and I will back to rescue.
If you don't like Bash, you can do it with python as well (using F5 SDK).
KR, Dario.
- balance5Nimbostratus
Hi
I am trying to get LTM VIP status using a python script.
I can successfully pull all details of the VIP however not able to find a field in there that describes the state of the VIP (i.e. up or down).
Here is an example of the JSON output for a TEST VIP:
{
"addressStatus": "yes",
"autoLasthop": "default",
"cmpEnabled": "yes",
"connectionLimit": 0,
"creationTime": "2022-09-29T11:20:15Z",
"destination": "/Common/192.168.1.1:80",
"enabled": true,
"fullPath": "/Common/TEST_VS",
"generation": 1,
"gtmScore": 0,
"ipProtocol": "tcp",
"kind": "tm:ltm:virtual:virtualstate",
"lastModifiedTime": "2022-09-29T11:20:15Z",
"mask": "255.255.255.255",
"mirror": "disabled",
"mobileAppTunnel": "disabled",
"name": "TEST_VS",
"nat64": "disabled",
"partition": "Common",
"policiesReference": {
"isSubcollection": true,
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~TEST_VS/policies?ver=14.1.4.3"
},
"pool": "/Common/TEST_POOL",
"poolReference": {
"link": "https://localhost/mgmt/tm/ltm/pool/~Common~TEST_POOL?ver=14.1.4.3"
},
"profilesReference": {
"isSubcollection": true,
"items": [
{
"context": "all",
"fullPath": "/Common/TEST_HTTPPROFILE",
"generation": 1,
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "TEST_HTTPPROFILE",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/http/~Common~TEST_HTTPPROFILE?ver=14.1.4.3"
},
"partition": "Common",
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~TEST_VS/profiles/~Common~TEST_HTTPPROFILE?ver=14.1.4.3"
},
{
"context": "all",
"fullPath": "/Common/tcp-lan-optimized",
"generation": 1,
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "tcp-lan-optimized",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp-lan-optimized?ver=14.1.4.3"
},
"partition": "Common",
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~TEST_VS/profiles/~Common~tcp-lan-optimized?ver=14.1.4.3"
}
],
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~TEST_VS/profiles?ver=14.1.4.3"
},
"rateLimit": "disabled",
"rateLimitDstMask": 0,
"rateLimitMode": "object",
"rateLimitSrcMask": 0,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~TEST_VS?ver=14.1.4.3",
"serviceDownImmediateAction": "none",
"source": "0.0.0.0/0",
"sourceAddressTranslation": {
"pool": "/Common/TEST_SNATPOOL",
"poolReference": {
"link": "https://localhost/mgmt/tm/ltm/snatpool/~Common~TEST_SNATPOOL?ver=14.1.4.3"
},
"type": "snat"
},
"sourcePort": "preserve",
"synCookieStatus": "not-activated",
"translateAddress": "enabled",
"translatePort": "enabled",
"vlansDisabled": true,
"vsIndex": 776
}- balance5Nimbostratus
To obtain this via API call - using python or similar, you will need to get the "stats" details of each VIP using a similar URL to the following:
stats_url = "https://localhost/mgmt/tm/ltm/virtual/~Common/TEST_VIP/stats"
This would typically be a dict. In the dict, you're looking for
['status.availabilityState']['description']
This would be either "offline" or "available"
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