Forum Discussion
syncretism
Nimbostratus
Apr 13, 2017Is There a "Key" to Rewriting TMSH Commands as RESTful Calls? +Example
Hiya,
I'm running this command remotely to get a pool member's active connections, but it's a) awfully kludgy and b) I'd like get the results from the RESTful API:
ssh $ID@$F5_HOST "show /l...
Kevin_K_51432
Apr 13, 2017Historic F5 Account
Greetings, I've had good luck using most of the Rest API by simply appending "stats" to the end of a query. I'm by not means an expert here, but I do use Rest quite often due to its simplicity:
So I would grab the stats for a pool named "default_gw" using the following:
curl -sk -u admin:admin https://172.24.64.39/mgmt/tm/ltm/pool/~Common~default_gw/members/~Common~10.12.23.27:0/stats
The output would be similar to:
"generation":1
"selfLink":"https://localhost/mgmt/tm/ltm/pool/~Common~default_gw/members/~Common~10.12.23.27:0/stats?ver=12.0.0"
"entries":{"https://localhost/mgmt/tm/ltm/pool/~Common~default_gw/members/~Common~10.12.23.27:0/~Common~10.12.23.27:0/stats":{"nestedStats":{"kind":"tm:ltm:pool:members:membersstats"
"selfLink":"https://localhost/mgmt/tm/ltm/pool/~Common~default_gw/members/~Common~10.12.23.27:0/~Common~10.12.23.27:0/stats?ver=12.0.0"
"entries":{"addr":{"description":"10.12.23.27"}
"connq.ageEdm":{"value":0}
"connq.ageEma":{"value":0}
"connq.ageHead":{"value":0}
"connq.ageMax":{"value":0}
"connq.depth":{"value":0}
"connq.serviced":{"value":0}
"curSessions":{"value":0}
"monitorRule":{"description":"/Common/gateway_icmp (pool monitor)"}
"monitorStatus":{"description":"up"}
"nodeName":{"description":"/Common/10.12.23.27"}
"poolName":{"description":"/Common/default_gw"}
"port":{"value":0}
"serverside.bitsIn":{"value":175344}
"serverside.bitsOut":{"value":215808}
"serverside.curConns":{"value":0}
"serverside.maxConns":{"value":10}
"serverside.pktsIn":{"value":334}
"serverside.pktsOut":{"value":240}
"serverside.totConns":{"value":94}
"sessionStatus":{"description":"enabled"}
"status.availabilityState":{"description":"available"}
"status.enabledState":{"description":"enabled"}
"status.statusReason":{"description":"Pool member is available"}
"totRequests":{"value":0}}}}}}
syncretism
Nimbostratus
Apr 13, 2017Stats! I knew I had that somewhere in my notes. This is great - I'm passing the JSON object to jq and watching the number of connections in my script. Just what I needed. Thanks so much!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects