Nagios Core + Nagios plugins basic install from source on Centos 6.x

Published on Author gryzli

Download nagios core source

In my case the latest stable nagios is nagios-4.0.8

Here’s the URL:


Install some dependecy packages

yum install   httpd php  gd gd-devel gcc glibc glibc-common openssl perl perl-devel make mailx


Create nagios user/groups

useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios


Untar the source and install

# Untar and go to source dir
tar xvzf nagios-4.0.8.tar.gz && cd nagios-4.0.8

# Configure
./configure --with-command-group=nagcmd

# Make + make installs
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
# The last one creates apache configuration here: /etc/httpd/conf.d/nagios.conf


Copy event handlers

cp -rvf contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers


Syntax check nagios.cfg configuration file

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


Create htpasswd containing access credentials

The credentials created in this step will be used to login with admin privileges in the nagios web ui.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
# user is nagiosadmin
# password is the provided one


Start Nagios / Apache and configure them to start at startup

/etc/init.d/nagios start
/etc/init.d/httpd start

chkconfig nagios on 
chkconfig httpd on


Fix nagios.cmd permissions

This step must be executed AFTER the nagios is STARTED

chmod 666 /usr/local/nagios/var/rw/nagios.cmd
chown nagios.nagcmd /usr/local/nagios/var/rw 
chmod u+rwx /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw  
chmod g+s /usr/local/nagios/var/rw 


Install Nagios NRPE

Current version of NRPE is 2.15.

cd /usr/src

wget '' -O nrpe-2.15.tar.gz

tar xvzf nrpe-2.15.tar.gz && cd nrpe-2.15

make all
make install-plugin

Finally install nagios plugins

cd /usr/src
tar -xvzf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make install


NEXT: Now you can proceed with installing nagios client:

Centos 6 – Install Nagios Client from source