We have already discussed Naigos Version 3.3.1 server installation on Linux. This post describes to Install version 4.0.8 on CentOS 7 or RHEL 7. Its an open source server monitoring system. We will be installed  NRPE (Nagios Remote Plugin Executor) on remote hosts to monitoring their resource.

Nagios is the very helpful tool for all remote hosts monitoring on a centralized System. There are three basic ways, Running, Warning, and Critical. 

Before starting the installation, we need to install some necessary packages on your system like, LAMP stack and few development libraries.

#  yum install gcc glibc glibc-common gd gd-devel make net-snmp OpenSSL-devel PHP

We need to create a group name nagcmd and user name Nagios for run the Nagios process,
# groupadd nagcmd

# usermod -a -G nagcmd Nagios

# usermod -a -G nagcmd apache

Download latest package Nagios-4.0.8  and extract it.
# cd /root/

# wget : http://liquidtelecom.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.1.1/nagios-4.1.1.tar.gz


# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz

# tar xzf nagios-4.0.8.tar.gz

# cd nagios-4.0.8

Now configure and install.
# ./configure --with-command-group=nagcmd

# make all

# make install

# make install-init

# make install-config

# make install-command mode

 The below command is to setup apache configuration for Nagios,
# make install-webconf

We need to setup htpasswd for nagiosadmin authentication and use the same user name for release from some errors and changes.
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

New password:
Re-type new password:
Adding password for user nagiosadmin

Restart Apache to make the new settings take effect.
# systemctl restart httpd

Then, download nagios-plugin-2.0.3 package for install and configuring Nagios core service, using following commands,
# wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz


# 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

Once you have installed packages check with your installation steps and configuration is correct?
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0
Things look okay -
No serious problems were detected during the pre-flight check

Set Alerts Email 
#  vi /usr/local/nagios/etc/objects/contacts.cfg

define contact{
        contact_name         nagiosadmin             ; Short name of user
        use                        generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                      Nagios Admin            ; Full name of user
        email                     nagiosalerts@domain.com        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

Now, start your nagios service,
# service nagios start
Starting nagios (via systemctl):       [  OK  ]

Open your browser and enter the URL:

Also, view  your localhost (Nagios server)

We will add our client system for monitored by Nagios, To Install and configure NRPE  and Nagios-plugin. We have already discussed Nagios client system.

Once you have completed installation and configuration on a remote system, again add or configure monitoring services on Nagios Server.