Forum Discussion

ILIAS_g_183177's avatar
ILIAS_g_183177
Icon for Nimbostratus rankNimbostratus
Feb 22, 2016

Retrieve snmp info for specific VS

Hello

 

I would like to find out how can I retrieve information about the traffic of a specific virtual server name. I have found the OIDs (ltmVirtualServStatClientBytesIn, ltmVirtualServStatClientBytesOut) that show the traffic in Bytes, but if I try this via snmpwalk I get all virtual servers. Is it feasible to retrieve only for only one?

 

thank you.

 

1 Reply

  • It is possible to do this. You need to specify the virtual server name, in (escaped, so the shell doesn't eat them) quotes. You can get the full list of possible values using the following command:

     snmpwalk -v2c -c public -OE localhost ltmVirtualServStatName
    F5-BIGIP-LOCAL-MIB::ltmVirtualServStatName.\"/Common/test-vs\" = STRING: /Common/test-vs
    F5-BIGIP-LOCAL-MIB::ltmVirtualServStatName.\"/Common/hud-http\" = STRING: /Common/hud-http
    F5-BIGIP-LOCAL-MIB::ltmVirtualServStatName.\"/Common/test_exch.app/test_exch_combined_http\" = STRING: /Common/test_exch.app/test_exch_combined_http
    F5-BIGIP-LOCAL-MIB::ltmVirtualServStatName.\"/Common/test_exch.app/test_exch_combined_https\" = STRING: /Common/test_exch.app/test_exch_combined_https
    

    This is from my lab system with four virtual servers. You can copy and paste, or you can do the same thing manually with any defined virtual server (you must use the full name of the virtual server including its path):

     snmpget -v2c -c public localhost ltmVirtualServStatClientPktsIn.\"/Common/test_exch.app/test_exch_combined_http\"
    F5-BIGIP-LOCAL-MIB::ltmVirtualServStatClientPktsIn."/Common/test_exch.app/test_exch_combined_http" = Counter64: 0
    

    The

    -OE
    option tells
    snmpwalk
    to escape the quotes around the table indices so you can copy and paste directly to the command line - if they're not escaped, the shell eats the quotes and the SNMP tools will not handle this correctly:

     snmpget -v2c -c public localhost ltmVirtualServStatClientPktsIn."/Common/test_exch.app/test_exch_combined_http"
    ltmVirtualServStatClientPktsIn./Common/test_exch.app/test_exch_combined_http: Unknown Object Identifier (Index out of range: /Common/test_exch (ltmVirtualServStatName))
    

    This is because the actual OID is a representation of the string, not the literal string, which can be shown with the

    -Ob
    option to snmp tools:

     snmpget -v2c -c public -Ob localhost ltmVirtualServStatName.\"/Common/test-vs\"
    F5-BIGIP-LOCAL-MIB::ltmVirtualServStatName.15.47.67.111.109.109.111.110.47.116.101.115.116.45.118.115 = STRING: /Common/test-vs
    

    For obvious reasons, I recommend sticking with the quoted string version.