[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.

Welcome to the Slackware Documentation Project

This is an old revision of the document!


Install Nagios On Slackware

(Slackware 13.37)

  1. Create the nagios group and user:
    # groupadd -g 213 nagios
    # useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios
  2. Add the 'apache' user to the 'nagios' group, so that it can write to the /var/nagios/rw directory ('a' option prevents the user to be removed from other groups, the member of which he is already):
    # usermod -aG nagios apache
  3. Install the Nagios::Plugin Perl module:
         cpan -i Nagios::Plugin
  4. 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
  5. 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
  6. Edit /etc/httpd/extra/nagios.conf, after the <Directory “/var/www/htdocs/nagios”> line:
    CHANGE:
         Options None
    TO:
         Options FollowSymLinks
  7. 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
  8. Make sure apache starts at boot and start/restart apache:
    # chmod 755 /etc/rc.d/rc.httpd
    # /etc/rc.d/rc.httpd restart
  9. Set the password for nagiosadmin :
    # htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
  10. (Not sure if this is necessary but, leaving it in until I can test)
    Make sure nagios starts at boot and start/restart nagios:
    1. 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
    2. 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
  11. Make rc.nagios executable:
    # chmod 755 /etc/rc.d/rc.nagios
  12. 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

  1. Run the htpasswd command for each user:
    # htpasswd -c /etc/nagios/htpasswd.users bob
    # htpasswd -c /etc/nagios/htpasswd.users sue
  2. 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

 howtos:software:install_nagios_on_slackware ()