Val:~$ whoami

I am Val Glinskiy, network engineer specializing in data center networks. TIME magazine selected me as Person of the Year in 2006.

Search This Blog

Monday, June 21, 2010

Monitoring trunk status via SNMP

If you have not guessed yet, SNMP and monitoring are my favorites.

So, you have configured many trunks on your switch and now need to make sure all of them are actually in trunking mode. Here is 2 SNMP OID that can help you:

vlanTrunkPortDynamicState ( - reports administrative state. From Cisco SNMP object navigator:
1 : on
2 : off
3 : desirable
4 : auto
5 : onNoNegotiate

vlanTrunkPortDynamicStatus ( - reports operational state.
1 : trunking
2 : notTrunking

To get data for specific interface you need to add ifIndex to the end of the OID. For example, for interface ifIndex=10147
snmpwalk -v2c -Ov -Oq -c public myswitch
To get ifIndex, you can either run  "show snmp mib ifmib ifIndex" command in exec mode or query ifName OID with snmpwalk. Here is the quick script:
  for int in ifIndex1 ifIndex2 ifIndexN
        trunkoperstatus=`snmpwalk -v2c -Ov -Oq -c public myswitch \$int`
                if [ $trunkoperstatus -eq 2 ]
                        trunkadminstatus=`snmpwalk -v2c -Ov -Oq -c public myswitch \$int`
                        if [ $trunkadminstatus -eq 1 ]
                                echo myswitch $int NotTrunking

No comments:

Post a Comment