SNMP with Nagios

I thought I would jot down a few notes about today’s adventures with SNMP. Specifically using SNMP with Nagios mostly on Red Hat/CentOS. I have an appliance from a third-party from which I would like to monitor and graph performance. So view this as a beginner howto for future reference.
There is good info here for beginning SNMP.
1. Install SNMP daemon and Utilities

yum install net-snmp-utils net-snmp

2. Configure the SNMP service

mv /etc/snmp/snmpd.conf /etc/snmp/
vi /etc/snmp/snmpd.conf

Enter the following:

rocommunity somepassword
syslocation “DataCenter”

Start the service:

/etc/init.d/snmpd start
chkconfig snmpd on

3. Test with SNMPwalk

snmpwalk -v 1 -c somepassword -O e

4. Firewall

vi /etc/sysconfig/iptables


-A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 161  –source -j ACCEPT


/etc/init.d/iptables restart

5. Test
Test it from another machine:

snmpwalk -Os -c sidewinder -v 1 sysContact.0

Test it using the Nagios plugin:

/usr/lib64/nagios/plugins/check_snmp -H -C somepassword -o sysContact.0

6. IOD Numbers
OK so I got a bit stuck at this point wondering which OIDs I could use to retrieve info from the target machine. I found this list:
1 minute Load: .
5 minute Load: .
15 minute Load: .
percentage of user CPU time:  .
raw user cpu time: .
percentages of system CPU time: .
raw system cpu time: .
percentages of idle CPU time: .
raw idle cpu time: .
raw nice cpu time: .

Total Swap Size:  .
Available Swap Space: .
Total RAM in machine: .
Total RAM used: .
Total RAM Free: .
Total RAM Shared: .
Total RAM Buffered: .
Total Cached Memory: .


/usr/lib64/nagios/plugins/check_snmp -H -C sidewinder -o .

But I wanted to know more. So I installed across-platform Mib Browser from iReasoning. Now to make good use of this you need the Mib definitions file available at /usr/share/snmp/mibs/UCD-SNMP-MIB.txt in case you are using another Mib/SNMP browser (but UCD-SNMP-MIB.txt is included with the iReasoning browser). This MIB file contains information about the OIDs used in Red Hat/CentOS. So right-click on ‘MIB Tree’ and ‘Load MIB’ choose the UCD-SNMP-MIB.txt file. You should now be able to expand this part of the tree to get explanations of the various OIDs and their numbers which you can then use in your SNMP commands or in Nagios.
So ssCpuIdle is OID number .
and can be tested on the Nagios system with:
/usr/lib64/nagios/plugins/check_snmp -H -C somepassword -o .
As a service definition in /etc/nagios/objects/services.cfg it would be:

define service{
use                 generic-service
host_name           bloxx2
service_description SNMP_CPUIDLE
check_command       check_snmp!.
contact_groups      webadmins

Where /etc/nagios/objects/commands.cfg includes:

define command{
command_name    check_snmp
command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C sidewinder -o $ARG1$ -w $ARG2$ -c $ARG3$

You can then also add -w -c warning and critical values too and graph the results with something like NagiosGrapher.

I also found this list with IODs for the Google Search Appliance.

That should be enough to get started.

One Response to “SNMP with Nagios”

  1. ravi

    plz provide the document of custom MIB file import in nagios.(like sonicwall,cyberoam or the devices)>

    Thanks for this docs,……..


Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>