Monday, 8 February 2016

Setup and configure a host for SNMP with NAGIOS

With the check_snmp plugin for NAGIOS you are able to easily monitor network devices such as switches and routers that support SNMP.

By default the check_snmp is included within the plugins package provide by NAGIOS (https://www.nagios.org/downloads/nagios-plugins/) so as longs as this is installed we can proceed...

It *should* be present in the /usr/local/nagios/libexec - although in my case it was not present - even with the plugin package installed...

It actually turns out that upon compiling the nagios plugins if you do not have the following packages installed (net-snmp AND net-snmp-utils), nagios will not install the check_smnp plugin!

So to resolve the problem I ran:

yum install net-snmp net-snmp-utils

and then re-compile the plugins again:

cd /tmp/nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

and then check the plugin has been installed:

ls /usr/local/nagios/libexec | grep check_snmp

Now there are a few pre-requisites we need to do:

Ensure the device you wish to poll has SMTP enabled, that you have the community string and it's setup accordingly and the relevent OID's are known.

We should proceed by enabling the switch definitions within the nagios.cfg configuration file:

vi /usr/local/nagios/etc/nagios.cfg

and uncomment the following line:

cfg_file=/usr/local/nagios/etc/objects/switch.cfg

We should then edit the definitions:

vi /usr/local/nagios/etc/objects/switch.cfg

And then fill in / modify the revelent values - defiening the switchm, host group and it's checks.

For more information on available checks please see here: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/monitoring-routers.html

Finally verify the configuration:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

and restart nagios:

service nagios restart

0 comments:

Post a Comment