Tag Archives: Linux

Monitoring Network Services with Nagios 3 on Ubuntu – Part 1 of 2

Nagios is a popular and powerful open-source network monitoring system that can be used to monitor network servers and devices. It can send notification messages when network servers go offline by monitoring protocols like HTTP, FTP, SMTP, PING, SNMP and others. Another great feature of Nagios is the web interface that use CGIs written in C for fast tracking. This is a 2 part howto that helps you setup Nagios and get it up and running to send out SMS notifications. Following these instructions, you will end up with the following.

  • Nagios3 and nagios basic plugins installed
  • Nagios configured to monitor a few aspects of your system (CPU load, disk usage etc)
  • Nagios web interface accessible at http://localhost/nagios3/
  1. Install nagios version 3
  2. NOTE: These instructions assume you are running as root for convinience.  Alternatively you can ‘sudo’ every command or “sudo -s” to run commands as root for that session.

    $ aptitude install nagios3
  3. Create the web user password file:
  4. $ cd /etc/nagios3/
    $ htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin
    

    New password:

    Re-type new password:

    Take note of this password, you are going to use it to login to the nagios web interface.

  5. Pre-Flight checkAfter installation make sure everything’s fine.
    $ nagios3 -v nagios.cfg
  6. Testing it out
  7. Now you should have a working nagios installation. You can now check out the web interface by pointing your browser to

    http://localhost/nagios3 using nagiosadmin as the username and the password that you set earlier.

  8. Configuration
      The nagios configuration files are located in the directory /etc/nagios3 with the following configuration files
  • cgi.cfg –  
For controlling the web interface
  • commands.cfg – 
Definitions of nagios commands for checks are stored here
  • nagios.cfg –  Main
 nagios configuration file
  • conf.d/* –  All 
other
 configuration files reside here

Under conf.d you have the following configuration files for defining different service and host checks

  • contacts_nagios2.cfg -
 
 
Users and user groups definitions
  • generic_host_nagios2.cfg – Default template used for host definitions
  • generic_service_nagios2.cfg – 
Default template used for service definitions
  • hostgroups_nagios2.cfg – Groupings of hosts(network devices and servers)
  • services_nagios2.cfg –  Configuration file for service definitions that nagios should check
  • generic_service_nagios2.cfg –  
Default template used for service definitions

Other possible config files that might be under conf.d

  • host‐gateway_nagios3.cfg –  
Default
 route
 definition
  • extinfo_nagios2.cfg –  Additional information
  • localhost_nagios2.cfg – 
Definition of the nagios server itself

There you have it, you now have a working nagios installation. I will try to post the second part where we get to send SMS notifications for those times when you are not near the office (It happens)

Advertisements
Tagged , , , , ,