Monday, May 24, 2010

Nagios server installation guide

Nagios is network monitoring tool used to monitor servers ,routers , switches and other devices.

Server Installation

Prerequisites : Apache, PHP, GCC compiler, GD development libraries

yum install httpd php gcc glibc glibc-common gd gd-devel

1. add nagios user and set a password.

2. create nagcmd group and add nagios and apache to it.
(used to issue commands directly from web interface)

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache


3. download nagios core and nagios plugin from nagios website.

4. extract the nagios core into a directory and configure with the group option.

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
tar xfv
nagios-3.2.1.tar.gz
cd nagios-3.2.1
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

5. start apache

6. Next install nagios plugin with nagios user and nagios group

cd /home/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
tar xfv
nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install


7. service nagios start

8. to view the webinterface

http://ipaddress/nagios/

To monitor remote server, you need to install nrpe plugin

1. download and install nrpe plugin (nrpe uses 5666)

./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd

2. nrpe configuration

vim /etc/xinetd.d/nrpe

only_from = 127.0.0.1
(change to nagios server ip address)

3. add nrpe port to services file

vim /etc/services

nrpe 5666/tcp # NRPE

4. service xinetd restart

5. testing nrpe

netstat -at | grep nrpe

output : tcp 0 0 *:nrpe *.* LISTEN


0 comments:

Post a Comment