You are on page 1of 22

NAGIOS INSTALLATION AND CONFIGURATION

PROJECT: ICOE INFRA TEAM

GE Partner Program

A-10, Sector 2 • Noida • UP • 201301 • Tel. +91.120.4014000 • Fax. +91.120.4014020 www.sdgc.com

Page 1 of 22

• info@sdgc.com

Classification: GE Confidential

GE Partner Program

A-10, Sector 2 • Noida • UP • 201301 • Tel. +91.120.4014000 • Fax. +91.120.4014020 www.sdgc.com

Page 2 of 22

• info@sdgc.com

Classification: GE Confidential

4014000 • Fax. +91. +91. Sector 2 • Noida • UP • 201301 • Tel.120.com Classification: GE Confidential .sdgc.1.com Page 3 of 22 • info@sdgc.1 PURPOSE This document states step by step procedures to install and configure nagios to monitor remote hosts. GE Partner Program A-10.120.4014020 www.

) Simple plugin design that allows users to easily develop their own service checks Contact notifications when service or host problems occur and get resolved. PING.sdgc. disk usage.120.120. Ability to define event handlers to be run during service or host events for proactive problem resolution. +91. etc.4014020 www. GE Partner Program A-10. HTTP.Nagios® is a system and network monitoring application. +91. Some of the many features of Nagios include: • • • • • Monitoring of network services (SMTP. WHAT IS NAGIOS? . etc.) Monitoring of host resources (processor load. alerting you when things go bad and when they get better.4014000 • Fax.com Classification: GE Confidential .com Page 4 of 22 • info@sdgc. POP3.1. It watches hosts and services that you specify. NNTP. Sector 2 • Noida • UP • 201301 • Tel.

gz A-10.INSTALLATION DETAILS Install necessary packages: yum install httpd gcc glibc glibc-common gd gd-devel php Create Nagios User account and group useradd -m nagios Create nagcmd group for allowing external commands to be submitted through the web interface.120.2.php As of this writing Nagios 3.org/download/download.com Page 5 of 22 • info@sdgc.120.nagios.sdgc.4014000 • Fax.tar.0.4014020 www.3.com Classification: GE Confidential .6 (Stable) and Nagios Plugins 1. +91. +91. Sector 2 • Noida • UP • 201301 • Tel. Add both the nagios user and the apache user groupadd nagcmd usermod -a -G nagcmd nagios GE Partner Program usermod -a -G nagcmd apache Create Directory to store Nagios installation files mkdir /opt/Nagios Download Nagios and Plugins Save file to directory /opt/Nagios http://www.13 (Stable) Extract Files: cd /opt/Nagios tar xvzf nagios-3.4.

com Classification: GE Confidential .sdgc. +91.120./configure --prefix=/opt/Nagios/ --with-command-group=nagcmd GE Partner Program A-10. Sector 2 • Noida • UP • 201301 • Tel.4014000 • Fax. +91.4014020 www.cd nagios-3.120.2.com Page 6 of 22 • info@sdgc.3 Compile and Configure Nagios .

sample config files: make install A-10.make all GE Partner Program Compile binaries.sdgc.4014000 • Fax.4014020 www.120.com Classification: GE Confidential . +91.com Page 7 of 22 • info@sdgc. +91. init script.120. Sector 2 • Noida • UP • 201301 • Tel.

120.120. +91.make install-init make install-config GE Partner Program make install-commandmode Nagios has now been installed to the directory /opt/nagios/ ** Do Not Start Nagios ** Install Nagios Web Interface: make install-webconf A-10. Sector 2 • Noida • UP • 201301 • Tel.com Classification: GE Confidential .sdgc. +91.4014020 www.com Page 8 of 22 • info@sdgc.4014000 • Fax.

120. +91.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.conf Now Create Web Interface Login User: GE Partner Program Restart Apache: service httpd restart Install Nagios Plugins Extract Files: cd /opt/Nagios tar xzf nagios-plugins-1.tar.15.120. +91.conf /opt/nagios/etc/ (Since we need apache for viewing the admin console.sdgc.gz cd nagios-plugins1. Sector 2 • Noida • UP • 201301 • Tel.4014020 www.4.com Page 9 of 22 • info@sdgc.com Classification: GE Confidential .4014000 • Fax.15 A-10. make an entry of nagios.conf in apache configuration file) Add the below lines Include /opt/Nagios/etc/nagios.d/nagios.4.

Sector 2 • Noida • UP • 201301 • Tel.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) A-10. +91.com Classification: GE Confidential .com Page 10 of 22 • info@sdgc.120.sdgc.120.4014020 www.Compile and Configure Nagios Plugins .4014000 • Fax. +91./configure --prefix=/opt/Nagios/ --with-nagios-user=nagios --with-nagios-group=nagios make make install Verify the sample Nagios configuration files /opt/Nagios/bin/nagios -v /opt/Nagios/etc/Nagios.

com Page 11 of 22 • info@sdgc.120.4014020 www.GE Partner Program A-10. +91.com Classification: GE Confidential . +91. Sector 2 • Noida • UP • 201301 • Tel.sdgc.4014000 • Fax.120.

GE Partner Program A-10. +91.4014020 www.sdgc.4014000 • Fax.com Classification: GE Confidential .120.com Page 12 of 22 • info@sdgc. +91. Sector 2 • Noida • UP • 201301 • Tel.120.

which resides on the local monitoring machine The NRPE daemon. Without these.4014020 www. 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.com Classification: GE Confidential . The main reason for doing this is to allow Nagios to monitor "local" resources (like CPU load. +91.WHAT IS NRPE? The NRPE add-on is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. an agent likes NRPE must be installed on the remote Linux/Unix machines. Sector 2 • Noida • UP • 201301 • Tel.) A-10.com Page 13 of 22 • info@sdgc. memory usage. Since these public resources are not usually exposed to external machines. which then returns the check results to the Nagios process. +91. etc.120.4014000 • Fax.120. the daemon wouldn't be able to monitor anything.sdgc.) on remote machines. GE Partner Program The NRPE add-on consists of two pieces: • • The check_nrpe plugin. (Note: The NRPE daemon requires that Nagios plugins be installed on the remote Linux/Unix host.

/usr/sbin/useradd nagios passwd nagios ii.120./configure --prefix=/opt/Nagios/ --with-nagios-user=nagios --with-nagios-group=nagios make make install chown nagios. tar xzf nagios-plugins-1.6 Compile and install the plugins .120. +91.4014020 www.sdgc.tar.gz cd nagios-plugins-1.4014000 • Fax. you'll need: – Root access on the remote Linux/Unix host – Access to the nagios user account on the monitoring host • i.nagios /opt/Nagios/ A-10.6. Install the Nagios Plugins Download the pluggins and nrpe file to /opt/nagios mkdir /opt/Nagios cd /opt/Nagios Extract the Nagios plugins source code tarball. Remote Host Setup Create Account Information GE Partner Program Create a new nagios user account and give it a password.4. +91. Sector 2 • Noida • UP • 201301 • Tel.4.com Page 14 of 22 • info@sdgc.Installation of NRPE • Prerequisites In order to complete this installation.com Classification: GE Confidential .

d/nrpe A-10. Sector 2 • Noida • UP • 201301 • Tel.120. +91.4014020 www.4014000 • Fax.com Page 15 of 22 • info@sdgc. +91.com Classification: GE Confidential . Install xinetd Install the NRPE daemon .120.iii./configure --prefix=/opt/Nagios/ --with-nagios-user=nagios --with-nagiosgroup=nagios make all make install-plugin make install-daemon make install-daemon-config make install-xinetd GE Partner Program vim /etc/xinetd.sdgc. iv.

4014000 • Fax. you'll need to do just a few things: – Install the check_nrpe plugin – Create a Nagios command definition for using the check_nrpe plugin – Create Nagios host and service definitions for monitoring the remote host Since we have already installed the plugin and nrpe.168.4014020 www.Remote host to be monitored A-10.168.0. +91.sdgc.0.120.1 (Monitoring Server side) 192. /opt/nagios/libexec/check_nrpe -H 192.com Classification: GE Confidential . nrpe 5666/tcp # NRPE Restart the xinetd service.120. Sector 2 • Noida • UP • 201301 • Tel. +91.Add the following entry for the NRPE daemon to the /etc/services file. next we have to check the connectivity of the remote host with the Monitoring server.com Page 16 of 22 • info@sdgc. service xinetd restart GE Partner Program Monitoring Host Setup On the monitoring host (the machine that runs Nagios).1 --.

+91. check_interval .cfg And add the following definition to the file: define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ } Define the host Firstly define the host in template.4014020 www.cfg. GE Partner Program Now create a file “ hostgroups. mkdir /opt/nagios/etc/hosts A-10.com Page 17 of 22 • info@sdgc.sdgc. vi /opt/nagios/etc/commands.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..120.cfg” and define the hostgroups.cfg Create a customized location which would contain configuration details for all the hosts. It contains parameters like check_period . vim /opt/Nagios/etc/objects/hostgroups.4014000 • Fax. +91.120. Sector 2 • Noida • UP • 201301 • Tel. Etc.

Create folders according to the hostgroups defined in hostgroups.x.cfg and define configuration files for all the hosts to be monitored.x. To define custom contact groups.com Page 18 of 22 • info@sdgc.x. follow the below mentioned instructions: vim /opt/Nagios/etc/objects/contacts. Sector 2 • Noida • UP • 201301 • Tel.cfg GE Partner Program In the above configuration we have defined custom contact groups.cfg A-10. +91. +91.com Classification: GE Confidential .120.sdgc.120.4014020 www.g. E. vim x.4014000 • Fax.

120.sdgc.4014000 • Fax.4014020 www.com Page 19 of 22 • info@sdgc.GE Partner Program Now we have to define the service groups for the services which are monitored vim /opt/Nagios/etc/objects/servicegroups. A-10. Sector 2 • Noida • UP • 201301 • Tel. +91. +91.cfg By defining the Service and host groups we can get an accumulated view of services and hosts monitored by Nagios Server.120.com Classification: GE Confidential .

+91. Sector 2 • Noida • UP • 201301 • Tel.com Classification: GE Confidential .GE Partner Program Setup Remote Host for Monitoring A-10.4014020 www.com Page 20 of 22 • info@sdgc.4014000 • Fax.120.120.sdgc. +91.

Sector 2 • Noida • UP • 201301 • Tel. /opt/Nagios//libexec/check_users --.com Page 21 of 22 • info@sdgc. vim /opt/Nagios/etc/nrpe.We need to to make some configurational changes at the remote host site to ensure that nagios server can fetch the desired data.4014020 www. +91.120.These entries define the threshold values. command[check_users]=/opt/Nagios//libexec/check_users -w 5 -c 10 GE Partner Program command[check_users] --------. -w 5 -c 10 ------. Now we need to define the services which will be monitored in the file nrpe. +91.Path of the script which will perform the check.120.This need to be same at the Nagios server end as well.com Classification: GE Confidential . W and C are for warning and critical respectively. These entries can be located under the configuration files for the remote host.cfg The above screenshot displays the configuration which we need to define at the remote host end. We have already installed the plugin and nrpe at the remote.cfg.4014000 • Fax.sdgc. Now run the below mentioned command to verify the configuration A-10.

cfg /etc/init/d/nagios restart GE Partner Program A-10.120. +91./opt/Nagios/bin/nagios -v /opt/Nagios/etc/Nagios.sdgc. +91.120.4014020 www.com Page 22 of 22 • info@sdgc.com Classification: GE Confidential . Sector 2 • Noida • UP • 201301 • Tel.4014000 • Fax.