Difference between revisions of "Nagios"
|Line 93:||Line 93:|
Revision as of 23:35, 10 January 2010
Nagios is an open source host, service and network monitoring program. It monitors specified hosts and services, alerting you to any developing issues, errors or improvements. This article describes the installation and configuration of Nagios.
Some of Nagios' features include:
- Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
- Monitoring of host resources (processor load, disk usage, etc.)
- Simple plugin design that allows users to easily develop their own service checks
- Parallelized service checks
- Ability to define network host hierarchy using "parent" hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
- Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
- Ability to define event handlers to be run during service or host events for proactive problem resolution
- Automatic log file rotation
- Support for implementing redundant monitoring hosts
- Optional web interface for viewing current network status, notification and problem history, log file, etc.
From the PKGBUILD: freetype2 gd glib2 libtool. According to the official documentation a webserver is not required, but if you wish to use any of the CGI features then a webserver (apache preferred) and the gd library are required. This is assumed for this installation
$ yaourt -S nagios nagios-plugins
Copy the sample config files as root:
# cp /etc/nagios/cgi.cfg.sample /etc/nagios/cgi.cfg # cp /etc/nagios/nagios.cfg.sample /etc/nagios/nagios.cfg # cp /etc/nagios/objects/commands.cfg.sample /etc/nagios/objects/commands.cfg # cp /etc/nagios/objects/contacts.cfg.sample /etc/nagios/objects/contacts.cfg # cp /etc/nagios/objects/localhost.cfg.sample /etc/nagios/objects/localhost.cfg # cp /etc/nagios/objects/templates.cfg.sample /etc/nagios/objects/templates.cfg # cp /etc/nagios/objects/timeperiods.cfg.sample /etc/nagios/objects/timeperiods.cfg
Make owner/group for all the files you just copied and belong to root equal to nagios/nagios:
chown -R nagios:nagios /etc/nagios
Create htpasswd.users file with a username and password, eg. nagiosadmin and secretpass
# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
If the owner/group of the nagios-plugins you installed are root:root, as encountered by andaway the following needs to be done:
# chown -R nagios:nagios /usr/share/nagios
Once Nagios is configured, it is time to configure the webserver.
Edit /etc/httpd/conf/httpd.conf, add the following to the end of the file:
# nagios Include /etc/httpd/conf/extra/nagios.conf
Add the apache user http to the group nagios, otherwise you will get the following error when using nagios:
Could not open command file '/var/nagios/rw/nagios.cmd' for update!:
# usermod -G nagios -a http
Edit /etc/php/php.ini to include /usr/share/nagios in the open_basedir directive.
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps:/etc/webapps:/usr/share/nagios
Now you should be able to access nagios through your webbrowser using the username and password you have created above using htpasswd: