Monitoring by SNMP

Objective

Describe how to monitor machines using SNMP

Target audience

It is intended for OpMon administrators and IT teams that need to monitor by SNMP.

1) Introduction

Before proceeding, it is required to have the IP address, community and version that the equipment in theory responds by SNMP.

A simple test can be used: Example:

[[email protected] ~]$ snmpwalk -v 2c -c public 192.168.10.2 sysdescr

Where the equipment’s description can be seen.

2) Adding MIB’s on OpMon

To add MIB’s on OpMon, just copy them to the directory  /usr/share/snmp/mibs

Example:

[[email protected] ~]$ sudo mv Downloads/*.mib /usr/share/snmp/mibs/

3) Consulting an specific MIB

The MIB name may not be the same as the file name at all times “.mib”, example:

[[email protected] ~]$ grep DEFINITIONS /usr/share/snmp/mibs/ms.mib
COMETMS-MIB DEFINITIONS ::= BEGIN

The file name is ms.mib, but the mib name is COMETMS-MIB Now that you know the MIB name, your query can be conducted: Example:

[[email protected] ~]$ snmpwalk -v 2c -c public 192.168.10.2 -m COMETMS-MIB enterprise

The enterprises item will show the entire MIB proprietary tree. It will show something like this: (The example is from a nobreak)

[[email protected] ~]$ snmpwalk -v 2c -c public 192.168.10.2 -m PowerNet-MIB
PowerNet-MIB::upsBasicIdentModel.0 = STRING: "MGE Galaxy 3500 20 kVA"
PowerNet-MIB::upsBasicIdentName.0 = STRING: "APC_T3"
PowerNet-MIB::upsAdvIdentFirmwareRevision.0 = STRING: "956.0608.D"
PowerNet-MIB::upsAdvIdentDateOfManufacture.0 = STRING: "03/04/11"
PowerNet-MIB::upsAdvIdentSerialNumber.0 = STRING: "PS1110143205"
PowerNet-MIB::upsAdvIdentFirmwareRevision2.0 = ""
PowerNet-MIB::upsBasicBatteryStatus.0 = INTEGER: batteryNormal(2)
PowerNet-MIB::upsBasicBatteryTimeOnBattery.0 = Timeticks: (0) 0:00:00.00
PowerNet-MIB::upsBasicBatteryLastReplaceDate.0 = STRING: "04/01/01"
PowerNet-MIB::upsAdvBatteryCapacity.0 = Gauge32: 100
PowerNet-MIB::upsAdvBatteryTemperature.0 = Gauge32: 23
PowerNet-MIB::upsAdvBatteryRunTimeRemaining.0 = Timeticks: (198000) 0:33:00.00
PowerNet-MIB::upsAdvBatteryReplaceIndicator.0 = INTEGER: noBatteryNeedsReplacing(1)
PowerNet-MIB::upsAdvBatteryNumOfBattPacks.0 = INTEGER: 8
PowerNet-MIB::upsAdvBatteryNumOfBadBattPacks.0 = INTEGER: 0
PowerNet-MIB::upsAdvBatteryNominalVoltage.0 = INTEGER: 192
PowerNet-MIB::upsAdvBatteryActualVoltage.0 = INTEGER: 218

4) Consulting in all the MIB’s

Just remove the MIB name from the command on the parameter -m ALL and place the string ALL. Check the example:

[[email protected] ~]$ snmpwalk -v 2c -c public 192.168.10.2 -m ALL

If the equipment is proprietary on the previous command, it may not return its results of the mib(s). So, use the following command:

[[email protected] ~]$ snmpwalk -v 2c -c public 192.168.10.2 -m ALL enterprises

5) Using the check_snmp

Now that you already found what you need, you can create verification for the MIB element. Follow the next example: Let’s say that the service to be created is that of the query performed before: PowerNet-MIB::upsAdvBatteryTemperature.0 = Gauge32: 23

To know how the check_snmp works, just query its help, by OpMon or on Shell (SSH)

/usr/local/opmon/libexec/check_snmp --help

Example of verification:

/usr/local/opmon/libexec/check_snmp -H 192.168.10.2 -P 2c -p 161 -o upsAdvBatteryTemperature.0 -l "Temperatura da bateria" -u Celsius -m ALL
Temperatura da bateria OK - 23 Celsius | PowerNet-MIB::upsAdvBatteryTemperature.0=23
Updated on December 23, 2016

Was this article helpful?