Forum Discussion

Sam_Hall's avatar
Sam_Hall
Icon for Nimbostratus rankNimbostratus
Nov 29, 2013

Looking for a way to pull offline virtual server statistics from F5 LTM

Using a one liner from the terminal or otherwise perhaps there's a way to do this with iControl, I'm looking to get the number of offline virtual servers.

 

I'm trying to come up with a way of monitoring the F5 to detect when any site(s) go down. The offline column listed in the GUI: "Statistics >> Module Statistics : Local Traffic" looks good. How do I tap into those stats?

 

2 Replies

  • Hi,

    I didn't find any "directs" commands to do it.

    But what I can suggest you is :
    tmsh show ltm virtual | grep offline | wc -l
    

    You have to run this command from bash.

  • Hi,

    the following one-liner gives you a list of all virtual servers and their current availability states:

    tmsh -q -c 'cd /;show ltm virtual recursive' | grep -iE '(ltm::virtual|availability)' | sed ':a;N;s/\n/ /' | sed -r 's/ltm::virtual server *:? *//I; s/ *availability *:? */ /I'

    Now you can filter on the specific availability state you are looking for and count the lines:

    tmsh -q -c 'cd /;show ltm virtual recursive' | grep -iE '(ltm::virtual|availability)' | sed ':a;N;s/\n/ /' | sed -r 's/ltm::virtual server *:? *//I; s/ *availability *:? */ /I' | grep -i offline | wc -l