[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
This is an old revision of the document!
Table of Contents
Install Nagios On Slackware
(Slackware 13.37)
- Create the nagios group and user:
# groupadd -g 213 nagios # useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios
- Add the 'apache' user to the 'nagios' group, so that it can write to the
/var/nagios/rw
directory:# usermod -G nagios apache
- Install the Nagios::Plugin Perl module:
cpan -i Nagios::Plugin
- Use sbopkg or install the individual packages using scripts from SlackBuilds.org, and install the following in this order:
- RRDTool
- nagios (currently, the package which can be built using a SlackBuilds.org script is nagios-3.3.1)
- nagios-plugin package
- nagios-graphing
- Edit
/etc/nagios/nagios.conf
and turn off the logging:CHANGE: use_syslog=1 TO: use_syslog=0 CHANGE: log_notifications=1 TO: log_notification=0
- Edit
/etc/httpd/extra/nagios.conf
, after the<Directory “/var/www/htdocs/nagios”>
line:CHANGE: Options None TO: Options FollowSymLinks
- Edit
/etc/httpd/http.conf
CHANGE: <IfModule dir_module> DirectoryIndex index.html </IfModule> TO: <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> CHANGE: # Uncomment the following line to enable PHP: # # Include /etc/httpd/mod_php.conf TO: # Uncomment the following line to enable PHP: # Include /etc/httpd/mod_php.conf ADD: Include /etc/httpd/extra/nagios.conf
- Make sure apache starts at boot and start/restart apache:
# chmod 755 /etc/rc.d/rc.httpd # /etc/rc.d/rc.httpd restart
- Set the password for nagiosadmin :
# htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
- (Not sure if this is necessary but, leaving it in until I can test)
Make sure nagios starts at boot and start/restart nagios:- Edit
/etc/rc.d/rc.local
and add:# Start nagios: if [ -x /etc/rc.d/rc.nagios ]; then echo "Starting nagios..." /etc/rc.d/rc.nagios start fi
- Edit
/etc/rc.d/rc.local_shutdown
(you may have to create this file if it does not exist, and make it executable) and add:# Stop nagios: if [ -x /etc/rc.d/rc.nagios ]; then echo "Stopping nagios..." /etc/rc.d/rc.nagios stop fi
- Make rc.nagios executable:
# chmod 755 /etc/rc.d/rc.nagios
- Start nagios:
# /etc/rc.d/rc.nagios restart
Check That Nagios Is Running
Goto http://YOUR_MACHINE/nagios/ and you should see Nagios working.
Add Users
- Run the
htpasswd
command for each user:# htpasswd -c /etc/nagios/htpasswd.users bob # htpasswd -c /etc/nagios/htpasswd.users sue
- Edit
/etc/nagios/cgi.cfg
and add the user(s) too:authorized_for_all_services=nagiosadmin,bob,sue authorized_for_all_hosts=nagiosadmin,bob,sue
(or add “
*
” to allow all authenticated users)
Sources
* Originally written by arfon