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

Published on Author gryzliLeave a comment

Download nagios core source

In my case the latest stable nagios is nagios-4.0.8

Here’s the URL:

http://www.nagios.org/download/core/thanks/?t=1414494536

 

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 'http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz/download' -O nrpe-2.15.tar.gz

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

./configure
make all
make install-plugin





Finally install nagios plugins

cd /usr/src
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
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
make install

 

NEXT: Now you can proceed with installing nagios client:

Centos 6 – Install Nagios Client from source

References

http://sharadchhetri.com/2013/11/27/install-nagios-4-0-2-in-centos-6-using-tarball/

Leave a Reply

Your email address will not be published. Required fields are marked *