Nagios at Savannah
Overview
Nagios is the selected alerting/monitoring platform that Savannah uses. Nagios configuration and custom plugins can be found in the administration Git repository.
Throughout the rest of the wiki page \$NAG_CONF means the directory /etc/nagios3/conf.d
Access
The Nagios web interface is available at http://nagios.savannah.gnu.org/. It is protected by Basic Auth. To gain access, add yourself to /etc/nagios3/htpasswd.users
htpasswd /etc/nagios3/htpasswd.users username
Alerting
Nagios will send email alerts to users configured in \$NAG_CONF/contacts.cfg. As well as individual users, the savannah-reports-private mailing list is configured as a contact.
Configuration
- Nagios runs on mgt.savannah.gnu.org
- All hosts run NRPE to do active load, disk, users and processor checks
- /opt/administration/nagios/conf.d is symlinked /etc/nagios3/conf.d
Service group vs host group
Any back-end checks that are global across all systems should have their checks in the host group. _Services_ that Savannah provides (various VCS systems, WWW, DNS etc...) should be configured as a service and use the "virtual" host name of the system (e.g. git.savannah.gnu.org is a CNAME for vcs.savannah.gnu.org)
Adding a new host
- Edit:
- \$NAG_CONF/hosts.cfg
and add the new host.
- Edit:
- \$NAG_CONF/hostgroups.cfg
and add the host to the all host group.
- Check the configuration:
- /etc/init.d/nagios3 reload # It will do a configtest and abort the reload on failure
Your new host should appear in Nagios under the host groups.
Adding a new plugin
Plugins for Nagios are simply scripts and binaries that follow specific exit codes and messages to stdout.
Custom plugins are located in /opt/administration/nagios/plugins. When creating a new plugin, add it here. Plugins follow a common naming convention of check_{name_of_service}.
Plugins should return three exit status.
- GREEN - The script should exit with a code of 0 and print "OK - extra text..." to stdout
- YELLOW - The script should exit with a code of 1 and print "WARNING
- extra text..." to stdout
- RED - The script should exit with a code of 2 and print "CRITICAL - extra text..." to stdout
Once a new plugin has been created, it will need to be added as a command in Nagios. Custom commands should be added to \$NAG_CONF/custom_commands.cfg.
Once the new command has been created, a service can then be added that uses this check_command.
Adding a new service
Services map a check command to a host/service group. Add services to \$NAG_CONF/services.cfg. Look in this file for examples of configuring services.