Wednesday, November 11, 2009

installing NAGIOS in Ubuntu 10.04+

This post has been updated on 24th July 2012:
For the completion of my computer Networking course, i done a project on implementation and configuring NAGIOS and configuring some addons also..So here i would like to share with you some thing about Nagios.

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

A webserver preferably Apache is required for viewing Nagios. So if not done , Install Apache and make sure it works!
sudo apt-get install apache2
// TESTING APACHE: go to http://localhost/ if it shows "It Works" you are done.

NAGIOS INSTALLATION
You can install nagios by two methods.
  1. Installing using Package manager . Use this for a easy to go installation within few steps. I prefer this
  2. By downloading Source code and then compiling it .Use this if you want the latest version of Nagios to be installed. For this , you should have some idea about source code compilings
Method 1: Install using package manager

Go Type sudo apt-get install nagios3 nagios-nrpe-plugin from command line and You will be asked to enter a password for the nagiosadmin user.
Done ! that's it

Method 2: By compiling source code

  1. Download Nagios Source code from the website: http://www.nagios.org/download/core/ and Nagios Plugin source code from http://www.nagios.org/download/plugins
  2. keep your downloaded file in home directory
  3. Extract the tar ball file
  4. sudo tar -zxvf nagios-3.2.0.tar.gz
  5. Go into the directory
  6. cd nagios-3.2.0
  7. 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
  8. 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
  9. Add a user for the Nagios interface:
    sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
  10. Restart Apache:
    sudo /etc/init.d/apache2 restart
  11. INSTALLING NAGIOS PLUGIN:

  12. 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
  13. Create a link to start the service:
    sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

  14. Verify the config:
    sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  15. Start Nagios:
    sudo /etc/init.d/nagios start
Done.

After Installation
After Nagios installation by either methods, you should be able to log into the Nagios web interface (http://localhost/nagios or http://localhost/nagios3 depending upon your Nagios version) using the nagiosadmin user and password.

Next task is to configure NAGIOS to monitor your network like adding your routers, servers and services . You can check out this post for NAGIOS configurations . Nagios without addons is of not much use. You can check out this post for NRPE addon.NRPE

Njoy

3 comments:

  1. very nice and clear description :) thx!

    ps. to add nagios to startup script You might use command below:
    update-rc.d nagios defaults

    ReplyDelete
  2. Try latest web server monitoring software for free only at
    http://zyrion.com/download/

    ReplyDelete