How To Install Nagios on Ubuntu

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

Download, install and Configure Apache
first we have to install some necessary compliers and Apache to run Nagios.
run the next commands:
# sudo apt-get install build-essential
# sudo apt-get install libgd2-xpm-dev
# sudo apt-get install apache2
# sudo apt-get install php5-common php5 libapache2-mod-php5

Configure Apache to use PHP:

Run in a terminal:
# sudo vi /etc/apache2/apache2.conf
Paste the following into the file:
DirectoryIndex index.html index.php index.cgi

and restart the server with the command
# sudo /etc/init.d/apache2 restart

Download, install, and configure Nagios
Create a user to run the service and a group to run external commands:

# sudo useradd -m nagios
# sudo passwd nagios
# sudo groupadd nagcmd
# sudo usermod -a -G nagcmd nagios
# sudo usermod -a -G nagcmd www-data

Download the current version of Nagios and Nagios Plugins from -

Extract the Nagios tar:
# sudo tar -zxvf nagios-3.1.2.tar.gz
and change to the nagios-3.1.2 directory
# cd  nagios-3.1.2
Now install the Nagios use the flowing commands :
# sudo ./configure --with-command-group=nagcmd
# sudo make all
# sudo make install
# sudo make install-init
# sudo make install-config
# sudo make install-commandmode
# sudo make install-webconf

Add a user for the Nagios interface:
# sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Extract and compile the Nagios-plugins:
# tar -zxvf nagios-plugins-1.4.14.tar.gz
# cd nagios-plugins-1.4.14
# sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# sudo make
# sudo make install

Create a link to start the service:
# sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the config:
# sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Start Nagios:
# sudo /etc/init.d/nagios start

You should now be able to log into the Nagios web interface (http://localhost/nagios) using the nagiosadmin user and password.

No comments:

Post a Comment