Monitoring Linux Using SNMP

HOME

Monitoring Linux Using SNMP

1.0  Purpose
This document describes how to monitor Linux machines with Nagios XI using SNMP. SNMP is an “agentless” method of monitoring network devices and servers, and is often preferable to installing dedicated agents on target machines.

2.0  Configuring SNMP on the remote Linux machine

Before you can monitor a Linux machine using SNMP, you'll need to install and configure the necessary SNMP package on the system.

First, you'll need to install the net-snmp package on the Linux machine. Login to the Linux machine as the root user to complete the next steps.

On Red Hat based systems, you can install the net-snmp package with the following command:

yum install net-snmp

On Debian / Ubuntu based systems, use the following command:

sudo apt-get install snmpd

Next, you need to create your own snmpd configuration file (snmpd.conf):
 
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
            > /etc/snmp/snmpd.conf
vi snmpd.conf

Edit the configuration file and specify a community string that can be used to issue queries. An example configuration file entry is shown below:
 

rocommunity solarwinds 192.168.1.1

1.0  Staring the SNMP Daemon

Save the configuration file and restart snmpd using the following command:
/etc/init.d/snmpd restart
OR
service snmpd restart
             chkconfig snmpd on



Next, you'll need to edit your firewall settings (if applicable). You will need to open up UDP port 161 to allow SNMP queries to the Linux machine. If you're using iptables, you can add an appropriate rule by using the following commands:

iptables -I INPUT -p udp –d 161 -j ACCEPT
/etc/init.d/iptables save

Note: On some systems you may need to add the address of your Nagios server to the allowed hosts file (/etc/hosts.allow).

1.0  Testing SNMP Communication

Before you continue, you'll need to make sure that the Nagios XI server can communicate with the remote Linux server using SNMP.

     To do this, login to your Nagios XI server and execute the following commands to run a test query (change the IP address and the SNMP community string to match your setup):

snmpwalk –v 2c –H <HOSTADDRESS> -c solarwinds

This check should return information from the remote Linux server.

Important: If the command doesn't return data, it likely means that SNMP is not configured properly, or that a firewall issue exists on the remote server.

2.0  Adding Linux machine in monitoring

    Login into the Nagiosxi Server and click on configure (you should have Admin rights to add server) àMonitoirng Wizard àLinux SNMP

 
Enter IP Address of the HOST and SNMP String
Click Next

Select the metrics what you want to monitor Click Next
Add notification Members and notification interval Click Next
Add to appropriate Host group Click Next
Click on Apply.

Successfully added Linux server in Monitoring


 

No comments:

Post a Comment