Nagios is a free, open-source tool that can be used to monitor network components and services. When it detects a problem, it can send alert messages by either email or pager. It can also be configured so that only designated personnel can view status information for particular services or equipment.
Nagios isn’t in the official Red Hat or CentOS repositories, so the first thing you’ll need to do is to install the Dag Wieers/RPMForge repository into your YUM configuration. First, go to the Dag Wieers/RPMForge website.
Copy and paste the appropriate command for your Red Hat-style distro to the command-line of your local computer.
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
To keep the RPMForge packages from overriding official CentOS packages, install the YUM Priorities plug-in.
yum install yum-priorities
Then, open the /etc/yum/pluginconf.d/priorities.conf file, and verify that the following lines are present:
enabled = 1
Open the /etc/yum.repos.d/CentOS-Base.repo file, or whatever its equivalent it for your distro, and add the line:
to the “base”, “addons”, “updates”, and “extras” sections of the file. Add the line:
to the “centosplus” and “contrib” sections of the file. (Again, the section names may vary, depending on which particular distro that you’re running.)
Open the /etc/yum.repos.d/rpmforge.repo file, and add the line:
To test your configuration, run the command,
When it finishes, you should see a line similar to:
818 packages excluded due to repository priority protections
yum install nagios nagios-plugins
Change the Contact Information
Place your email in the email location.
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email your_email ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
To enable encrypted communication between the Nagios server and any client on which you wish to view network status information, you’ll also want to install the mod_ssl package.
# nagios -v /etc/nagios/nagios.cfg
nagios -v /etc/nagios/nagios.cfg
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
Reading configuration data…
Running pre-flight check on configuration data…
Checked 8 services.
Checked 1 hosts.
Checking host groups…
Checked 1 host groups.
Checking service groups…
Checked 0 service groups.
Checked 1 contacts.
Checking contact groups…
Checked 1 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checked 24 commands.
Checking time periods…
Checked 5 time periods.
Checking for circular paths between hosts…
Checking for circular host and service dependencies…
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…
Total Warnings: 0
Total Errors: 0
Things look okay – No serious problems were detected during the pre-flight check
By default it should run and you should be able to login to the web interface after you create the nagios user.
htpasswd -c htpasswd.users nagios
Re-type new password:
Adding password for user nagios
Now login to the web interface with http://ip_address/nagios
You will not have all of the rights to view everything but for the purposes of making sure it all works you will see it is all running. Now you need to configure it for your settings.