Installing Nagios Server (4.0.0) on CentOS/RHEL 6.3

Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.
Nagios monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers.
This tutorial shows how to install Nagios 4.0.0-beta on CentOS/RHEL 6.3.

1) Prerequisites

After installing your CentOS/RHEL server, you have to install dependent packages to make nagios work.

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

2) Create nagios user and group by which we will be installing nagios

   useradd -m nagios
   passwd nagios
   groupadd nagcmd
   usermod -a -G nagcmd nagios
   usermod -a -G nagcmd apache

3) Installation

a) Create a directory where you would download nagios software:
   mkdir /opt/nagios
   cd /opt/nagios
b) Download nagios-core package/Untar/Compile and Install all necessary files for Nagios:
   tar -xzvf nagios-4.0.0-beta1.tar.gz
   cd nagios
   ./configure --with-command-group=nagcmd --with-httpd-conf=/etc/httpd/conf.d --with-init-dir=/etc/init.d/
   make all
   make install
   make install-init
   make install-commandmode
   make install-config
   make install-webconf
   make install-exfoliation
Note: By default nagios install itself in /usr/local/nagios
c) Create a password to log into the web interface:
   htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
d) Restart the httpd server:
   service httpd restart
e) Now we have to make nagios service to start automatically on boot using chkconfig:
   chkconfig --add nagios
   chkconfig nagios on
f) Verify if you have a good config of nagios with the command:
   /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
g) Check if there are no errors displayed; then start nagios with command:

   service nagios start
h) Now, we have to Download/Untar/Compile and Install all necessary files for Nagios-Plugin:
   cd /opt/nagios
   cd nagios-plugins-1.4.16
   ./configure --with-nagios-user=nagios --with-nagios-group=nagios
   make install
i) You try to open Web Interface page of Nagios.

Note: If page does not opens then in most cases there must be two reasons:

a) IPtables is blocking it so either disable iptables or modify rule to allow 80 port.

   service iptables stop

b) SELinux is not allowing to open the page, so use following command:

   chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
   chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

Related Posts:

Setup and configure Nagios Client (NRPE) on CentOS/RHEL 6.3
NagiosGraph – Graphs in Nagios on CentOS/RHEL 6.3


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.