Nagios Network Monitoring System
Nagios is an open source software for network monitoring in all aspects. Nagios is quite popular monitoring system but requires unix administration skills. Let's see how to install Nagios on your server.
Installation and Configuration:
You can find Nagios source packages at . There are RPMs for Red Hat servers and packages for different systems. You can also refer to installation guide
There are a lot of configuration files but when you sorted them out once you don't have to come back to configure them again in the future until you add new host. The location of config files are usually at /usr/local/nagios/etc but it depends on your Linux distributive.
The first file you should work with is the main Nagios configuration file. Note that you could keep all of the Nagios configuration directives in one file but you can also split the directives out among assorted files.
The main configuration file specifies the location of other config files, log files, configuration directories, the Nagios system user name and group, lock file, temp file, and etc. Please see the Nagios documentation for all files and directives.
If you want Nagios to enable "flap detection" you can find this option inside the main configuration file too. Basically, "flap detection" detects whether a host or service is "flapping" — which is to say, rapidly changing between states.
CGI configuration (cgi.cfg) file is used to specify where your files are and which users are able to access various sections of the Nagios web-based interface. There are several directives — the default syntax is "directive=value" — so, for example, the "authorized_for_all_services" directive would be specified like this:
authorized_for_all_services=nagiosadmin,username
Note that there is no space between the two values.
The cgi.cfg also specifies the location for the main Nagios configuration file, the path to the HTML files for Nagios, PING syntax, and so on.
On Debian, access is controlled by htaccess; by default, it's /etc/nagios/htpasswd.users. If you want to add users, you can use htpasswd to generate additional entries. For example:
htpasswd -nb username password
will print a username and password to standard out so you can cut and paste the password into the htpasswd.users file. Or use "htpasswd htpasswd.users username" to be prompted for a password, and the file will be updated automagically.
We'll configure Nagios so that you can reach its Web-based interface. You'll probably need to edit the Apache configuration file to add the Nagios section, or simply add an include to point to the default configuration. On Debian, it's not added by default. The conf file can be found under /etc/nagios/apache.conf. To add this to your Apache configuration, the best way to go is usually just to add an Include directive, like so:
Include /etc/nagios/apache.conf
Here is a sample host configuration that defines a default set of services, and a specific host:
define host{
name default
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
register 0
}
define host{
use default
host_name www.networkmonitoringblog.com
alias Networkmonitoringblog
address 192.168.1.1
check_command check-host-alive
max_check_attempts 5
notification_interval 60
notification_period 24x7
notification_options d,u,r
}
Note that "1" indicates a service or check is enabled; "0" indicates it is disabled. The first entry defines a default set of rules that can be inherited by other hosts. The second entry defines a specific host. For the most part, these configuration options are self-explanatory — host_name is the name of a host that's being monitored; notification_period is when you'd want notifications sent out.
The notification options are "d" for "down," "u" for unreachable, and "r" for recovery. If you want no notifications, use "n" — but there's usually not much point in having Nagios configured to monitor a server and not send notifications.
Nagios's Web-based interface allows you to monitor hosts and services when you happen to be in front of a computer — but what happens when everyone's out of the office? Nagios will email and page admins to alert them to problems. While this isn't terribly fun when you're on the receiving end of the pages, it's a necessary evil. To configure a contact, follow this basic template:
define contact{
contact_name nagios
alias Site Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email,notify-by-epager
host_notification_commands host-notify-by-email,host-notify-by-epager
email admin@sitename.com
pager pagenagios-admin@pager.com
}
Note that you can omit the "host-notify-by-epager" if your admin(s) does not have a pager. You can also set up contact groups, assuming you have multiple admins or perhaps different admins for different departments and so on. For example, you might set up a group for Linux servers and a different group for Solaris servers.
Please don't forget to checl regulary the Nagios FAQs and the Nagios mailing lists.
Nagios doesn't have a Web-based management interface, but there are a few projects that provide one if you're looking for that sort of thing. is a PHP interface for managing Nagios. is a plugin for Webmin that can be used to manage Nagios, and is a PHP/MySQL frontend for Nagios configuration.
This article was written on basis of website.
Comments
Got something to say?
You must be logged in to post a comment.