Votes: 0Posted On: Oct 12, 2017 04:13:42
Hi! We will guide you through the process of configuring Nagios for SNMP monitoring. We are assuming that you have Nagios Core and Plugins installed and configured on your server. Also, the host on which you want the SNMP monitoring should also be configured on the host server before configuring SNMP.
1. Operating System - CentOS 7
2. Nagios Core(Latest stable version) - Installed and configured. Please visit the following link to install Nagios Core and Nagios Plugins on CentOS 7.
3. Nagios Plugin should be installed
4. Host to be monitored - The remote host to be monitored should also be configured on the server.
1. Install SNMP on your CentOS operating system.
yum install net-
2. Once the SNMP is installed, the configuration files are stored in "/etc/snmp/snmpd.conf". To be safe, we can create a backup of the file.
3. Next, we have to add the IP address and name to the configuration file.
rocommunity public IP_address_of_your_server
where "public" is the community name followed by IP address of your server.
4. Now start the SNMP service.
5. Set the SNMP service such that it starts on boot.
Configuration of SNMP command block
Before proceeding further, please make sure that the Nagios plugins are installed. You can visit the following link to install plugins. Please check that "/usr/local/nagios/libexec/check_snmp" exists or the plugin is not installed correctly.
In this part of the setup, we will create a command line for SNMP monitoring. The SNMP commands are stored in "/usr/local/nagios/etc/objects/commands.cfg". Under this file, you will find the format of SNMP command. Here is a sample of the same.
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
CPU Load check of Remote Server
On the basis of this format, we define three commands that perform SNMP checks at an interval of 1 and 15 minutes respectively.
command_line $USER1$/check_snmp -o .184.108.40.206.4.1.2021.10.1.3.1 -H $HOSTADDRESS$ $ARG1$
command_line $USER1$/check_snmp -o .220.127.116.11.4.1.2021.10.1.3.3 -H $HOSTADDRESS$ $ARG1$
These commands create the SNMP checks with the appropriate OIDs.
(Note: OIds are Object IDs each designed to perform a specific task.)
Now, open the host configuration file that you must have created at the time of adding a host to the Nagios server. To the host configuration file, please add the following service checks.
service_description CPU load One Minute Interval
check_command snmp_load_1m!-C public
service_description CPU load Fifteen Minute Interval
check_command snmp_load_15m!-C public
Here is a description of all the fields in "define service block".
1. Use - The category of the service
2. host_name - The host on which the service is to be monitored.
3. service_description - The brief description of service
4. check_command - The check command used. (Note: THe -C is used for adding the community)
Similarly, you can perform SNMP check on other system maintenance tasks such as Disk Usage, RAM usage, System Uptime among others.