SNMP Monitoring using Nagios

Nagios is very good and commonly used monitoring tool for systems and network equipments. It can monitor and report availability statistics as well as provide alerts in case of host or service incidents. I am going to discuss on how to use the SNMP capabilities of Nagios and GNU/Linux to enable monitoring without special agents installed on the hosts.

Usually, Nagios will need you to install NRPE addons to report disk space and so many other updates about the system that need to be monitored. This needs you to install additional software on the target machines which is not always possible/recommended practice. Instead, we are going to use the SNMP software that comes as part of the GNU/Linux OS to provide information for Nagios. I am not going to brief about how to install Nagios and Plugins. You could read that in a beautiful how-to here : http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html

There are two steps in enabling SNMP Monitoring.

Configure SNMP in the host to be monitored.

  • Edit /etc/snmp/snmpd.conf and add one line. ( rocommunity public )
  • Restart snmpd service ( sudo /etc/init.d/snmpd restart )

Configure Nagios to check free RAM in the host via SNMP .
First, add a host entry like this to your .cfg file.

define host {
use linux-server
host_name linuxserver01
alias MyLinuxServer
address 192.168.1.24
}

Now we will add a service to check free RAM

define service{
use generic-service
host_name linuxserver01
service_description Free RAM
check_command snmp_freeram_linux
}

Next, we will define the snmp_freeram_linux command to use snmp_check plugin that comes as part of Nagios Plugins installation.

define command{
command_name  snmp_freeram_linux
command_line /usr/local/nagios/libexec/check_snmp -H $HOSTNAME$ -C public -o .1.3.6.1.4.1.2021.4.11.0
}

After this, restart Nagios. ( sudo /etc/init.d/nagios restart )

You should be now able to see a new service added to host and SNMP getting the data. With some efforts, you would be able to configure SNMP for other operating systems and network equipments too. If you have queries, please let me know. 🙂

3 thoughts on “SNMP Monitoring using Nagios

  1. Azmi

    Hi Rajesh,
    I manage to get result when I check_snmp on the system up time
    I got this
    SNMP OK – Timeticks: (57335812) 6 days, 15:15:58.12

    However, I’m having trouble configuring my nagios to monitor a remote server RAM usage via check_snmp.

    When I used
    check_snmp -H 10.1.6.167 -C public -o .1.3.6.1.4.1.2021.4.11.0
    I got this error :
    External command error: Error in packet
    Reason: (noSuchName) There is no such variable name in this MIB.
    Failed object: iso.3.6.1.4.1.2021.4.11.0

    Can you please advice where might I configure wrongly?

    Thanks a million in advance

    Azmi
    Malaysia

    Reply
  2. undan Post author

    Apologies.. This blog was kind of ignored by me for a long time.

    Your issue seems interesting.. Could you please provide me more details ? Is it still blocking you? Which OS/Version are you using as server and client? I would like to try and reproduce this.

    Regards,
    Rajesh

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.