Sunday, June 13, 2010

Monitoring with Nagios

If planning on monitoring your servers, Nagios is the guy.

Official documentation:

For Fedora configuration and SElinux issues refer to:

Install the necessary packages:
yum -y install \
httpd \
php \
nagios \

Main configuration and relevant files:
/etc/httpd/conf.d/nagios.conf -- (refer further on by the alias http-nagios)
/var/log/httpd/error_log -- error_log (alias)
/var/log/httpd/access_log -- access_log (alias)
/etc/nagios/passwd -- pass_nagios (alias)
/etc/nagios/nagios.cfg -- cfg_nagios (alias)
/etc/nagios/cgi.cfg -- cgi_nagios (alias)

The default user is "nagios" (specified in http-nagios) and you need to set its password before trying to access your fresh Nagios site
htpasswd -c /etc/nagios/passwd nagios

Add further users, such as the nagiosadmin, with:
htpasswd /etc/nagios/passwd nagiosadmin

Check it:
cat /etc/nagios/passwd

Setup Nagios to accept access from the nagios user: editing the cgi_nagios file and change it to have the following settings:


Note: every time you change your cgi_nagios file you need to restart the nagios service:
service nagios restart

Start the services:
service httpd start
service nagios start

Set services to run automatically:
chkconfig --level 345 httpd on
chkconfig --level 345 nagios on

Try to access the home-page:

Note: This is VERY important to notice that it is NOT localhost but You can change it on http-nagios file.
Troubleshooting: If have any problem look at error_log file and check if the user is actually on the pass_nagios file.

No comments: