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/snmpd.conf.org
Enter the following:
Start the service:
chkconfig snmpd on
3. Test with SNMPwalk
snmpwalk -v 1 -c somepassword -O e 127.0.0.1
-A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 161 –source 188.8.131.52/16 -j ACCEPT
Test it from another machine:
snmpwalk -Os -c sidewinder -v 1 targetmachine.domain.com sysContact.0
Test it using the Nagios plugin:
/usr/lib64/nagios/plugins/check_snmp -H 184.108.40.206 -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: .220.127.116.11.4.1.2021.10.1.3.1
5 minute Load: .18.104.22.168.4.1.2021.10.1.3.2
15 minute Load: .22.214.171.124.4.1.2021.10.1.3.3
percentage of user CPU time: .126.96.36.199.4.1.2021.11.9.0
raw user cpu time: .188.8.131.52.4.1.2021.11.50.0
percentages of system CPU time: .184.108.40.206.4.1.2021.11.10.0
raw system cpu time: .220.127.116.11.4.1.2021.11.52.0
percentages of idle CPU time: .18.104.22.168.4.1.2021.11.11.0
raw idle cpu time: .22.214.171.124.4.1.2021.11.53.0
raw nice cpu time: .126.96.36.199.4.1.2021.11.51.0
Total Swap Size: .188.8.131.52.4.1.2021.4.3.0
Available Swap Space: .184.108.40.206.4.1.2021.4.4.0
Total RAM in machine: .220.127.116.11.4.1.2021.4.5.0
Total RAM used: .18.104.22.168.4.1.2021.4.6.0
Total RAM Free: .22.214.171.124.4.1.2021.4.11.0
Total RAM Shared: .126.96.36.199.4.1.2021.4.13.0
Total RAM Buffered: .188.8.131.52.4.1.2021.4.14.0
Total Cached Memory: .184.108.40.206.4.1.2021.4.15.0
/usr/lib64/nagios/plugins/check_snmp -H targetserver.com -C sidewinder -o .220.127.116.11.4.1.2021.4.4.0
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 .18.104.22.168.4.1.2021.11.11.0
and can be tested on the Nagios system with:
/usr/lib64/nagios/plugins/check_snmp -H targetserver.com -C somepassword -o .22.214.171.124.4.1.2021.11.11.0
As a service definition in /etc/nagios/objects/services.cfg it would be:
Where /etc/nagios/objects/commands.cfg includes:
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.