How to install Nagios in Centos, Red Hat & Fedora..

Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.

First launched in 1999, Nagios has grown to include thousands of projects developed by the worldwide Nagios community. Nagios is officially sponsored by Nagios Enterprises, which supports the community in a number of different ways through sales of its commercial products and services.

Installation of Nagios core 4.1.0rc1

nagios-core

Step 1: Install Required Packages and Dependencies..

# yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp

Step 2: Setup Users Accounts

Now add nagios user account and set password for this account

# useradd nagios
# passwd nagios

Now add a group for nagios ‘nagcmd’ and add nagios & apache’ users in this group

# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd apache

Step 4: Download and Install Nagios Core 4.1.0rc1

After completing all the prerequisites installing dependencies and adding user group download latest Nagios..

# cd /opt
# wget http://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.1.0/nagios-4.1.0rc1.tar.gz/download?use_mirror=softlayer-sng

Now extract the downloaded package

# tar -xvf nagios-4.1.0rc1.tar.gz
# cd nagios-4.1.0rc1
# ./configure --with-command-group=nagcmd
# make all
# make install
# make install-init

Now Install & Configure Web Interface for Nagios

# make install-webconf

Step 5: Now Configure Apache Authentication
In this step we will setup password for user ‘nagiosadmin’.
Provide password for nagiosadmin.

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

Now restart the apache service for new settings take effects..

For Red Hat,Centos 6..

# service httpd restart

For Red Hat,Centos 7..

# systemctl restart httpd

Step 6: Install Nagios Plugins.

# 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
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install

Step 7: Verify Nagios Configuration Files and Start Nagios

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# service nagios start (RHEL,Centos 6)
# systemctl restart start (RHEL,Centos 7)

Also configure nagios service to start on system start

 
# chkconfig --add nagios
# chkconfig nagios on (RHEL,Centos 6)
# systemctl enable nagios (RHEL,Centos 7)

Step 8: Login into Nagios Web Interface
Now your Nagios is ready run it in your browser with
“http://localhost/nagios” and provide the username ‘nagiosadmin’ and password.

(change localhost with your FQDN)

nagios login 2

nagios page1

Yay! Now you have successfully installed nagios core and its plugin in your system now just start monitoring..

Read Also:

Leave a Reply

Your email address will not be published.


*