Forum Discussion

Nik's avatar
Nik
Icon for Cirrus rankCirrus
Jul 18, 2011

automate command-line statistics

i'm looking to create a script that will run daily and print a list of virtual servers and nodes that have zero activity since the last reset followed by a reset. this will be sent out via email. the best tool i've found so far is bigtop, this is what i've come up with:

 

 

bigtop -once -vname|grep '[0]\ \+[0]\ \+[0]\ \+[0]\ \+[0]\ \+'

 

long.name.of.virtual. 0 0 0 0 0 0 0

 

long.name.of.node.com 0 0 0 0 0 0 DOWN

 

 

i have a few concerns though:

 

 

 

 

1) bigtop cuts off the virtual/node name after 21 characters. any idea how to get the whole thing? this is pretty important to me since we have lots of long hostnames.

 

 

 

2) what's the lowest level of access i can run a global statistic reset with? this is to be automatically run remotely so i'd like the user to have as little access as possible.

 

 

 

3) is there a better way to do this other than cutting up the output of bigtop?

 

 

 

thanks!

 

  • Mike_Kahler_488's avatar
    Mike_Kahler_488
    Historic F5 Account
    1. I don't know of any way to make bigtop print more than 1st 21 chars.

     

    3. I looked at this through snmp:

     

     

    snmpwalk -v 2c -c public localhost ltmVirtualServStatClientTotConns | awk -F \" '{print $2, $3}' | grep 'Counter64: 0'

     

     

    test_more_than_21_chars_nowisthetimeforallgoodmemtocometotheaidoftheirparty = Counter64: 0

     

     

    You can reset virtual server stats through snmpset if you have a read/write agent configured:

     

     

    snmpset -c private -v1 localhost F5-BIGIP-LOCAL-MIB::ltmVirtualServStatResetStats.0 i 1

     

     

    You can do the same for "Nodes"

     

     

    F5-BIGIP-LOCAL-MIB::ltmNodeAddrStatServerMaxConns

     

    F5-BIGIP-LOCAL-MIB::ltmNodeAddrStatResetStats

     

     

  • Here are a couple of commands that I will throw our there

     

     

     

    F5 Connection Count Summarization

     

    b conn | grep 3.3.126.53 | awk '{print $1 }' | cut -d : -f 1 | uniq -c | sort

     

     

    F5 Virtual List via BIGIP.conf for v9.x

     

    awk 'BEGIN {RS="}";FS=RS} // {print $1"}";} ' /config/bigip.conf

     

     

    show all VIP addresses with MAX Conns greater than 200

     

    snmpwalk -c l0cal 127.0.0.1 F5-BIGIP-LOCAL-MIB::ltmVirtualAddrStatClientMaxConns|awk -F: '{if($4 > 200) print }'

     

     

    show all VIP addresses with Curr Conns greater than 200

     

    snmpwalk -c l0cal 127.0.0.1 F5-BIGIP-LOCAL-MIB::ltmVirtualAddrStatClientCurConns|awk -F: '{if($4 > 200) print }'

     

     

    Leave out the awk -F: '{if($4 > 200) print }' to see all VIP addresses

     

     

    NOTE: Make sure you allow SNMP from local loop address 127.0.0.1 from the GUI

     

     

    I hope this helps

     

    Bhattman