Forum Discussion
TMSH equivalent command for virtual count
Version 11-13.
Guys,
I am looking for a command similar to "tmsh list one-line | wc -l" thank I can run IN the tmsh shell.
or any command that will clearly give me a count of victuals configured on the Big-IP.
Thanks!
David
Hi
Have you tried grep -c from tmsh to count the number of matches. So something like
list ltm virtual | grep -c "ltm virtual"
- iaineNacreous
Hi
Have you tried grep -c from tmsh to count the number of matches. So something like
list ltm virtual | grep -c "ltm virtual"
- David__PaschAltostratus
This was perfect thank you.
Would this help your need, put the below ones in the a simple bash script and execute them. Would look clean output 🙂
~ # echo -n "Total Virtual Servers : " ; tmsh show ltm virtual | grep -c Availability ~ # echo -n "Virtual Servers Available : " ; tmsh show ltm virtual | grep -c "Availability : available" ~ # echo -n "Virtual Servers Unavailable : " ; tmsh show ltm virtual | grep -c "Availability : unavailable" ~ # echo -n "Virtual Servers Offline : " ; tmsh show ltm virtual | grep -c "Availability : offline" ~ # echo -n "Virtual Servers Unknown : " ; tmsh show ltm virtual | grep -c "Availability : unknown"
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