**    Install Nagios on Centos**

Download the latest version of nagios core and plugins from : http://www.nagios.org/download

Install Pre-requisites:

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

Add user and group :

useradd -m nagios

groupadd nagcmd

usermod -a -G nagcmd nagios

usermod -a -G nagcmd apache

untar nagios source and cd into it

./configure –with-command-group=nagcmd

make all

make install

make install-init

make install-config

make install-commandmode

make install-webconf

Create Web User :

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

service httpd restart

Now untar the plugins cd into it and

./configure –with-nagios-user=nagios  –with-nagios-group=nagios

make

make install

Configure nagiosadmin email for alerts :

vi /usr/local/nagios/etc/objects/contacts.cfg

change the email ..

Verify the sample nagios config. file

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Start Nagios :

chkconfig –add nagios

chkconfig nagios on

chkconfig httpd on

service nagios start

browse : http://ip/nagios

** Common Issues :**

“Error: could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update! The  permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions.

Solution:

a. Go to the source directory and run install command-mode or

b.Apply permissions manually :

chmod 755 /usr/local/nagios/var/rw

chmod g+s /usr/local/nagios/var/rw

Now Restart both apache and nagios.