Thursday, April 8, 2010

Installing nagios in Linux



Nagios® is a system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.
Some of the many features of Nagios include:

* Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
* Monitoring of host resources (processor load, disk usage, etc.)
* Simple plugin design that allows users to easily develop their own service checks
* Parallelized service checks
* Ability to define network host hierarchy using "parent" hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
* Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
* Ability to define event handlers to be run during service or host events for proactive problem resolution
* Automatic log file rotation
* Support for implementing redundant monitoring hosts
* Optional web interface for viewing current network status, notification and problem history, log file, etc.
visit Nagios official website(http://www.nagios.org/) for documentation.
Below picture shows the frontend of nagios which works in web browser.


PRE-REQUISITES FOR INSTALLATION::

Download, install and Configure Apache
* 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


And restart apache server
* sudo /etc/init.d/apache2 restart
// TESTING APACHE: go to http://localhost/ if it shows "It Works" you are done.
// TEST PHP: type this " " (without quotes) and save it in a
file named test.php in the folder /var/www and then type http://localhost/test.php" in firefox and if it shows a page about php
configurations and all.. you are done ..
/*********************************************************/
DOWNLOAD NAGIOS AND PLUGINS:

From the website: http://www.nagios.org/download/core/
Download plugins also from :http://www.nagios.org/download/plugins

/*********************************************************/

INSTALLING NAGIOS::

1) keep your downloaded file in home directory
2) Extract the tar ball file
sudo tar -zxvf nagios-3.2.0.tar.gz
3)Go into the directory
cd nagios-3.2.0
4)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
5)Now install the Nagios tarballs that were downloaded previously:
* 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
6) Add a user for the Nagios interface:
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
7) Restart Apache:
sudo /etc/init.d/apache2 restart

/*********************************************************/
INSTALLING NAGIOS PLUGIN:


8) Extract and compile the plugins that were downloaded earlier:

* cd ~/
* tar -zxvf nagios-plugins-1.4.13.tar.gz
* cd nagios-plugins-1.4.13
* sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
* sudo make
* sudo make install
9) Create a link to start the service:
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

10)Verify the config:
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
11) Start Nagios:
sudo /etc/init.d/nagios start

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

Nagios without addons is of not much use.We added NRPE addon to nagios. You check out this post for that.NRPE


http://irfantechinfo.blogspot.com

0 comments: