NAGIOS is the most used open source monitoring tool which helps us to monitor the services and application’s running on Windows, Linux, Routers and other Network Devices.

We can monitor all the services using the Nagios Web Interface.

This tutorial describes you how to monitor services and system resources on Linux servers.


Before installing Nagios, We need to install some system requirements for making Nagios work.We have to install HTTP, PHP and Compilers and Development Libraries.

You can install all the packages in the single command.

#yum install httpd php gcc glibc glibc-common wget perl gd gd-devel unzip zip -y

Once the package installation is completed.

We need to create a user and group for nagios for allowing the nagios to handle using Nagios Web interface.

Create a “nagios” user

#useradd nagios

Create a “nagcmd” group

#groupadd nagcmd

We have to add “nagios” and “apache” users to “nagcmd” Group.

#usermod -a -G nagcmd nagios

#usermod -a -G nagcmd apache

Download Nagios Core

Now We have to download, Compile and install the Nagios core from the source.

#cd /tmp

We can download the source using the below command:


Extract the file:

#tar -xvzf nagios-4.3.2.tar.gz

#cd nagios-4.3.2

Compile & Install Nagios

Run the below command:

#./configure –with-nagios-group=nagios –with-command-group=nagcmd

#make all

#make install

#make install-init

#make install-config

#make install-commandmode

Install & Configure Nagios Web Interface

Install Nagios Web configuration using the command:

#make install-webconf

We have to install a Exfoliation theme to nagios:

#make install-exfoliation

Create User for Logging into Nagios Web Interface

Run this command:

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

Once you have Enter after typing the above command, It will ask you to type and confirm a new password for nagiosadmin user.

Restart Web service:

#systemctl restart httpd.service

#systemctl enable httpd.service

Configuring Nagios

The sample configuration files are now installed under /usr/local/nagios/etc directory.These files should work fine to start nagios.

We just need to make a change before proceeding.

Edit /usr/local/nagios/etc/objects/contacts.cfg config file to change the email address,If you like to receive alerts from nagios.

#vi /usr/local/nagios/etc/objects/contacts.cfg

As shown below





Download & Install Nagios Plugin

To download the Nagios plugin:


Now extract the download file.

#tar -xvzf nagios-plugins-2.2.1.tar.gz

#cd nagios-plugins-2.2.1

Compile & Install Nagios Plugin

#./configure –with-nagios-user=nagios –with-nagios-group=nagios


#make install

Start the Nagios Server

Verify the sample configuration files of nagios using the command:

#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

It everything goes fine and You see no errors.

We can now start the nagios service

#service nagios start

Start nagios on system startup

#chkconfig nagios on

Disable SELinux

We can check the status of selinux using below command:


Modify SELinux in Permissive mode or disable it.

#setenforce 0 [We set the selinux to Permissive mode temporarily]

To make permanent changes to SELinux

#vi /etc/sysconfig/selinux

Change the file as shown below


We need to all Web server access to firewall:

Make sure you have installed firewalld and it is running:

#yum install firewalld -y

#systemctl start firewalld

#firewall-cmd –permanent –zone=public –add-service=http

Reload the firewall to make changes:

#firewall-cmd –reload

Access Web Interface

You can access the Nagios Web Interface using the URL:

http://localhost/nagios/ [or]


You will see the following screen.It will ask you for the username [nagiosadmin] and password you have set.

After entering the username and password, Click Login.You will see the following Screen.

If you want to know the lists of hosts/server monitored by Nagios, Click Hosts in the left pane.

You will see only localhost, Since We have not added any hosts to monitoring.

To get the status of service running the server which is monitored by Nagios, Click Services in the left pane.

That’s All.Hope You have successfully installed Nagios Monitoring tool on your server.