Professional Documents
Culture Documents
GE Partner Program
Page 1 of 22
info@sdgc.com
Classification: GE Confidential
GE Partner Program
Page 2 of 22
info@sdgc.com
Classification: GE Confidential
1.1 PURPOSE
This document states step by step procedures to install and configure nagios to monitor remote hosts.
GE Partner Program
Page 3 of 22
info@sdgc.com
Classification: GE Confidential
1. WHAT IS NAGIOS?
.Nagios is a system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better. Some of the many features of Nagios include: Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.) Monitoring of host resources (processor load, disk usage, etc.) Simple plugin design that allows users to easily develop their own service checks Contact notifications when service or host problems occur and get resolved. Ability to define event handlers to be run during service or host events for proactive problem resolution.
GE Partner Program
Page 4 of 22
info@sdgc.com
Classification: GE Confidential
INSTALLATION DETAILS
Install necessary packages:
yum install httpd gcc glibc glibc-common gd gd-devel php
groupadd nagcmd
GE Partner Program
Page 5 of 22
info@sdgc.com
Classification: GE Confidential
cd nagios-3.2.3
GE Partner Program
Page 6 of 22
info@sdgc.com
Classification: GE Confidential
make all
GE Partner Program
make install
Page 7 of 22
info@sdgc.com
Classification: GE Confidential
GE Partner Program
make install-commandmode
Nagios has now been installed to the directory /opt/nagios/ ** Do Not Start Nagios **
make install-webconf
Page 8 of 22
info@sdgc.com
Classification: GE Confidential
Now move this file to /opt/nagios/etc (To keep all the files of associated with nagios at a single location) cp /etc/httpd/conf.d/nagios.conf /opt/nagios/etc/ (Since we need apache for viewing the admin console, make an entry of nagios.conf in apache configuration file) Add the below lines Include /opt/Nagios/etc/nagios.conf Now Create Web Interface Login User:
GE Partner Program
Restart Apache:
Page 9 of 22
info@sdgc.com
Classification: GE Confidential
Verify the sample Nagios configuration files /opt/Nagios/bin/nagios -v /opt/Nagios/etc/Nagios.cfg /etc/init/d/nagios start
GE Partner Program
Access the Admin Console: Open the web browser Open the URL: http://localhost:80/nagios
(Local host: Host where Nagios is installed)
Page 10 of 22
info@sdgc.com
Classification: GE Confidential
GE Partner Program
Page 11 of 22
info@sdgc.com
Classification: GE Confidential
GE Partner Program
Page 12 of 22
info@sdgc.com
Classification: GE Confidential
WHAT IS NRPE?
The NRPE add-on is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. The main reason for doing this is to allow Nagios to monitor "local" resources (like CPU load, memory usage, etc.) on remote machines. Since these public resources are not usually exposed to external machines, an agent likes NRPE must be installed on the remote Linux/Unix machines.
GE Partner Program
The NRPE add-on consists of two pieces: The check_nrpe plugin, which resides on the local monitoring machine The NRPE daemon, which runs on the remote Linux/Unix machine When Nagios needs to monitor a resource of service from a remote Linux/Unix machine. Nagios will execute the check_nrpe plugin and tell it what service needs to be checked The check_nrpe plugin contacts the NRPE daemon on the remote host over an (optionally) SSL-protected connection The NRPE daemon runs the appropriate Nagios plugin to check the service or resource The results from the service check are passed from the NRPE daemon back to the check_nrpe plugin, which then returns the check results to the Nagios process.
(Note: The NRPE daemon requires that Nagios plugins be installed on the remote Linux/Unix host. Without these, the daemon wouldn't be able to monitor anything.)
A-10, Sector 2 Noida UP 201301 Tel. +91.120.4014000 Fax. +91.120.4014020 www.sdgc.com Page 13 of 22
info@sdgc.com
Classification: GE Confidential
Installation of NRPE
Prerequisites
In order to complete this installation, you'll need: Root access on the remote Linux/Unix host Access to the nagios user account on the monitoring host
i.
GE Partner Program
ii.
Install the Nagios Plugins Download the pluggins and nrpe file to /opt/nagios
mkdir /opt/Nagios cd /opt/Nagios
Compile and install the plugins ./configure --prefix=/opt/Nagios/ --with-nagios-user=nagios --with-nagios-group=nagios make make install chown nagios.nagios /opt/Nagios/
Page 14 of 22
info@sdgc.com
Classification: GE Confidential
iii. iv.
make all make install-plugin make install-daemon make install-daemon-config make install-xinetd
GE Partner Program
vim /etc/xinetd.d/nrpe
A-10, Sector 2 Noida UP 201301 Tel. +91.120.4014000 Fax. +91.120.4014020 www.sdgc.com Page 15 of 22
info@sdgc.com
Classification: GE Confidential
Add the following entry for the NRPE daemon to the /etc/services file. nrpe 5666/tcp # NRPE Restart the xinetd service. service xinetd restart
GE Partner Program
Page 16 of 22
info@sdgc.com
Classification: GE Confidential
Create a command definition You'll need to create a command definition in one of your Nagios object configuration files in order to use the check_nrpe plugin.
vi /opt/nagios/etc/commands.cfg
Firstly define the host in template.cfg. It contains parameters like check_period , check_interval .. Etc.
GE Partner Program
Now create a file hostgroups.cfg and define the hostgroups. vim /opt/Nagios/etc/objects/hostgroups.cfg
Create a customized location which would contain configuration details for all the hosts. mkdir /opt/nagios/etc/hosts
Page 17 of 22
info@sdgc.com
Classification: GE Confidential
Create folders according to the hostgroups defined in hostgroups.cfg and define configuration files for all the hosts to be monitored. E.g. vim x.x.x.x.cfg
GE Partner Program
In the above configuration we have defined custom contact groups. To define custom contact groups, follow the below mentioned instructions: vim /opt/Nagios/etc/objects/contacts.cfg
Page 18 of 22
info@sdgc.com
Classification: GE Confidential
GE Partner Program
Now we have to define the service groups for the services which are monitored vim /opt/Nagios/etc/objects/servicegroups.cfg
By defining the Service and host groups we can get an accumulated view of services and hosts monitored by Nagios Server.
Page 19 of 22
info@sdgc.com
Classification: GE Confidential
GE Partner Program
info@sdgc.com
Classification: GE Confidential
We need to to make some configurational changes at the remote host site to ensure that nagios server can fetch the desired data. We have already installed the plugin and nrpe at the remote. Now we need to define the services which will be monitored in the file nrpe.cfg. vim /opt/Nagios/etc/nrpe.cfg
The above screenshot displays the configuration which we need to define at the remote host end. command[check_users]=/opt/Nagios//libexec/check_users -w 5 -c 10
GE Partner Program
command[check_users] --------- This need to be same at the Nagios server end as well. These entries can be located under the configuration files for the remote host. /opt/Nagios//libexec/check_users --- Path of the script which will perform the check. -w 5 -c 10 ------- These entries define the threshold values. W and C are for warning and critical respectively.
info@sdgc.com
Classification: GE Confidential
GE Partner Program
Page 22 of 22
info@sdgc.com
Classification: GE Confidential