Monitoring a Juniper Switch Interface With Nagios and SNMP

Here’s how to do monitoring things if you’ve got a Juniper switch and Nagios.

Finding the interface SNMP index, in the Juniper CLI:

yaleman@switch> show interfaces ge-0/0/26 | find SNMP
  Interface index: 156, SNMP ifIndex: 546

Finding the OIDs we want to monitor - in this case, the speed, to ensure it’s negotiating properly.

$ snmpwalk -c lolno switch.example.com | grep 546
IF-MIB::ifIndex.546 = INTEGER: 546
IF-MIB::ifDescr.546 = STRING: ge-0/0/26
IF-MIB::ifType.546 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifMtu.546 = INTEGER: 1514
IF-MIB::ifSpeed.546 = Gauge32: 1000000000
IF-MIB::ifPhysAddress.546 = STRING: lolno
IF-MIB::ifAdminStatus.546 = INTEGER: up(1)

Monitoring the interface with Nagios:

$ /usr/local/nagios/libexec/check_snmp \
    -H switch.example.com \
    -o IF-MIB::ifSpeed.546 \
    -C lolno \
    -s 1000000000
SNMP OK - 1000000000 | IF-MIB::ifSpeed.546=1000000000

Winning!



#snmp #nagios #monitoring