This site is for my reference purpose and I hope this will also help others to learn and know about the latest technologies.

Main menu

Post navigation

Installing Nagios on Ubuntu

Nagios is the Industry Standard Network Monitoring Engine. OK great so whats that mean, well nagios is a server that monitors your hosts and services and will inform you if something goes wrong and when it is fixed again. It can monitor network services, host resources and even network probes such as temperature and moisture.

These features as well as many more make nagios, by far, the most complete Network Monitoring tool on the market, however with all these features comes complexity and nagios has obviously been designed with the experienced Network Administrator in mind. But don’t worry too much, its not that difficult to learn as long as you take it one step at a time, and in today’s tutorial we’re going to look at the first step, actually getting it installed

First of all you will need a server running the LAMP Stack. Then you will need to setup a special user account and group for nagios, this allows nagios to have some rights over the server without giving it full root access, to do this first type:

sudo useradd -m -s /bin/bash nagios

to add the new user and group, then you’ll need to set the password, use:

sudo passwd nagios

Now create the ‘nagcmd’ group to allow external commands to be run, then add the nagios user and the apache user to the group:

then extract the source code form the tar file and navigate into the new folder:

tar -xzf nagios-3.4.3.tar.gz
cd nagios-3.2.1

now we just need to download gcc, the c++ compiler,

sudo apt-get install gcc

Now its time to install nagios, we are going to do this buy compiling the source code, this can seem a little confusing the first time you do it, but don’t worry you don’t relay have to understand it yet (that comes when you start to make your own programs) just follow the lines and you will be ok:

./configure --with-command-group=nagcmd
sudo make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode

Now we just need to configure the contacts .cfg file so nagious can email us the report:

sudo vim /usr/local/nagios/etc/objects/contacts.cfg

and change the email field to your email address.

Because the installer thinks Apache is installed in /etc/httpd/ witch it isn’t, we need to make a symlink to /etc/apache2/. A symlink is a file or folder that contains reference to another folder/file, so when the installer thinks its installing into /etc/httpd its actually installing into apache2, to do this type: