Forum Discussion

David__Pasch's avatar
David__Pasch
Icon for Altostratus rankAltostratus
Jun 26, 2019

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"

  • Hi

     

    Have you tried grep -c from tmsh to count the number of matches. So something like

     

    list ltm virtual | grep -c "ltm virtual"

  • 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"