How to monitor network services using Nagios

Today in the morning, one of my friend asked me to help resolving network related problem. Actually, he didn’t know what the problem exactly was. All he know was just he could not access to network mapped drive. Let me describe this problem in detail in next paragraph.

There is an enterprise network with 2 servers: Microsoft Windows 2000 Advanced Server and RedHat Linux 8.0. He usually works on Microsoft Windows XP using shared data and database on Windows 2000. Sometimes he encounters connection problem that he will be unable to access to the Windows 2000 for a while.

I don’t know too. When he called me, I found that everything works fine as expect so I had to wait for next time again and again. That means I have to prove its connectivity problem all time even when I don’t stay awake. My solution is to deploy network monitoring system on this enterprise network to actively monitor the connectivity and availability of all servers and services. At last, I chose Nagios. Nagios seems to be the most advanced and feature-rich network monitoring system written in C. However, its configuration system is very complicated. Below is my procedure to install and configure Nagios.

  1. Download and extract Nagios and its plugin (I chose to install Nagios 1.3)
  2. Run configure script to generate Makefile
  3. Run make all, make install, make install-init, make install-commandmode and make install-config
  4. Install nagios as a service using chkconfig --add nagios
  5. Rename all configuration files in /usr/local/nagios/etc and modify them to match your environment
  6. Verify configuration files using /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  7. Configure Apache by adding below configuration
    ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/

        AllowOverride AuthConfig
        Options ExecCGI
        Order allow,deny
        Allow from all
    Alias /nagios/ /usr/local/nagios/share/

        Options None
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
  8. Create .htaccess in /usr/local/nagios/sbin and /usr/local/nagios/share as follow.
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    require valid-user
  9. Create /usr/local/nagios/etc/htpasswd.user using htpasswd -c /usr/local/nagios/etc/htpasswd.user nagiosadmin
  10. Now you are ready to restart apache and start nagios

As this configuration, you could access to nagios at http://localhost/nagios/.

Technorati Tags: , , , , , , , ,

Post new comment