Nagios Core Open Source IT monitoring system that enables organisations to identify and resolve IT infrastructure problems before they affect critical business processes. in this post we will see Nagios installation and configurations on Ubuntu

It use to monitor critical IT infrastructure components, including system metrics, network protocols, applications, services, servers, and network infrastructure. It can send us alert in case of any critical issues and recovery through mails, SMS. It can generate reports which get saved in its database for further use as well.

So today we will try to Install Nagios on Ubuntu Server   10.04.4

Installation of Nagios

For installing nagios on Ubuntu Servers, we need to use apt-get command.

apt-get update
apt-get install nagios*

You can run this command with sudo as well, if you have sudo rights to run this command .In this we are going install all packages which start with nagios. Let me list you packages installed in my machine.

#dpkg --get-selections | grep nagios | awk '{print $1}'


During Installation it will automatically prompt you for nagiosadmin password, which will use while accessing Nagios page. After installing it check nagios service with command.

/etc/init.d/nagios3 status


In case it is stop, please start this service with same above command just replace stop with start
Now try accessing nagios from web page. http://<server-IP>/nagios3. It will prompt you for username and password. Use same password which use assign during its installations

Addition of Host in Nagios for monitoring

One of my previous post, I had tried to install nagios on Ubuntu server and as we know nagios is already configured to monitor for local services, now we are going to add some client host for monitoring. Before going to proceed for same, we should have some knowledge about the nagios configuration directories and files structures.

During nagios installation, nagios packages put various files and directories for nagios normal functioning inside the OS. Some files are critical and more important for configuration point of view and we need to changes them frequently during the configuration and on the other hand some are very less important that we need not to changes frequently. Here I am going to describe some important files and directories which play important roles in nagios configuration and that we need to change frequently while adding host and services in nagios server

1.    /etc/nagios3   — Main configuration folder, which consist of various configuration files for nagios server and client based configuration files from where we will able to manage various services, notification related task on nagios.
2.    /etc/nagios/ apache2.conf   — web configuration file for nagios. Also have link in /etc/apache2/conf.d/nagios3.conf for hosting nagios page.
3.    /etc/nagios3/ nagios.cfg    — It contains all configurations files that needs to consider while start and reloading the nagios configurations
4.    /etc/nagios3/ htpasswd.users   — store nagiosadmin password, you can your nagiosadmin password with htpassword command will get store in this file
5.    /etc/nagios3/cgi.cfg    –store various nagios variables while nagios is running
6.    /etc/ nagios-plugins/config    –this directory contains various command definitions, which later used to configure services for various hosts, so that we will able to service status nagios browser.
7.    /etc/nagios3/ndo2db.cfg    — nagios database configuration file
8.    /etc/nagios3/ resource.cfg    –store variable for nagios binary files directory which comes in effect.
9.    /etc/nagios3/conf.d    — contains all host configuration files that tends to consider while setting runtime configuration.
10.    /etc/nagios3/stylesheets    — css files for nagios interface

Now let’s see how we can add some new hosts in nagios configurations.
For this activity, first we need to configure client machine as well. So that it will respond to my nagios servers as well. For this we need to install one nagios package on client machine and configure it to allow nagios server.

#apt-get install nagios-nrpe*
# grep allowed_hosts /etc/nagios/nrpe.cfg
allowed_hosts=, <nagios-server-IP>
#/etc/init.d/nagios-nrpe-server     start


Now come on to nagios Server side, do following below steps

#cd /etc/nagios3/conf.d
# cp localhost_nagios2.cfg    srv11.cfg  #copy localhost_nagios2.cfg file to new files(name can be assigned as per host’s hostname)

Now edit this “srv11-8.cfg”.open this file in vi editor and search and replace like this

:%s/localhost/ srv11/g


Add this machine in /etc/nagios3/conf.d/ostgroups_nagios2.cfg with localhost, in case you also want to put in groups.

members          localhost

Recheck and reload nagios configuration with below commands

nagios3 -v /etc/nagios3/nagios.cfg
/etc/init.d/nagios3 restart


Now, we have this host in nagios page