Thursday, 6 November 2014

Nagios installation in Centos/Redhat

In this post, I will be explaining the step by step installation procedure of nagios.

This procedure is tested in Redhat and Centos based systems.

Step1: Install packages
====
I am assuming here that, you server is installed fresh and you need need to install apache/PHP fresh.

So, download the packages and install them as below:
===
yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp
===

Step2: Start the service
====
service httpd start
====

Step3: Setup user accounts
====
useradd nagios
passwd nagios
===

Step 4: Create a new group "nagcmd" and as the user "nagios" to the new group.
====
 usermod -a -G nagcmd nagios
 usermod -a -G nagcmd apache
====

Step 5:Install core-services of nagios. Follow the steps below:
====
cd /opt/
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.7.tar.gz
tar xzf nagios-4.0.7.tar.gz
cd nagios-4.0.7
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
====

Step 6:Run the below command to setup apache configuration.
====
make install-webconf
====

Step 7: Configure authentication of nagios and restart apache.
=====
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
service apache restart
=====


Step 8: Install Nagios Plugins.
====
cd /opt
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
tar xzf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
=====

Step 9: Now,compile and install nagios.
====
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
====

Step 10: Verify and start nagios.
=====
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start
=====

Add the service to chkconfig:
===
chkconfig --add nagios
chkconfig nagios on
===

Step 11: Now, access the nagios interface via URL:
===
http://ipaddress/nagios
===

Now, you have configured nagios.

Regarding the plugins and nagios management, I will be writing a separate post.

Keep reading :)


No comments:

Post a comment

Note: only a member of this blog may post a comment.