[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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
howtos:software:install_nagios_on_slackware [2015/08/01 12:01 (UTC)] – Saving so I won't lose ALOT of work already. arfonhowtos:software:install_nagios_on_slackware [2015/11/27 11:35 (UTC)] – [Install Nagios On Slackware] jamesaxl
Line 4: Line 4:
  
   - Create the nagios group and user: <code>   - Create the nagios group and user: <code>
-groupadd -g 213 nagios +     groupadd -g 213 nagios 
-useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios+     useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios
 </code> </code>
   - 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): <code>   - 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): <code>
-usermod -aG nagios apache+     usermod -aG nagios apache
 </code> </code>
   - Install the Nagios::Plugin Perl module: <code>   - Install the Nagios::Plugin Perl module: <code>
-     cpan -i Nagios::Plugin+     cpan -i Monitoring::Plugin
 </code> </code>
   - Use [[http://sbopkg.org/|sbopkg]] or install the individual packages using scripts from [[http://slackbuilds.org/|SlackBuilds.org]], and install the following in this order:   - Use [[http://sbopkg.org/|sbopkg]] or install the individual packages using scripts from [[http://slackbuilds.org/|SlackBuilds.org]], and install the following in this order:
     * RRDTool     * RRDTool
-    * nagios (currently, the package which can be built using a [[http://slackbuilds.org/network/nagios/ | SlackBuilds.org script]] is nagios-3.3.1)+    * nagios (currently, the package which can be built using a [[http://slackbuilds.org/network/nagios/ | SlackBuilds.org script]] is nagios-4.0.8)
     * nagios-plugin package     * nagios-plugin package
     * nagios-graphing     * nagios-graphing
Line 35: Line 35:
 </code> </code>
   - Edit ''/etc/httpd/http.conf'' <code>   - Edit ''/etc/httpd/http.conf'' <code>
 +COMMENT:
 +      LoadModule mpm_event_module lib64/httpd/modules/mod_mpm_event.so
 +UNCOMMENT:
 +     #LoadModule mpm_prefork_module lib64/httpd/modules/mod_mpm_prefork.so
 UNCOMMENT: UNCOMMENT:
      #LoadModule cgi_module lib64/httpd/modules/mod_cgi.so      #LoadModule cgi_module lib64/httpd/modules/mod_cgi.so
            
-     (or #LoadModule cgi_module lib/httpd/modules/mod_cgi.so which ever applies)+     (or #LoadModule cgi_module lib/httpd/modules/mod_cgi.so on 32bit installs)
            
 CHANGE: CHANGE:
Line 63: Line 67:
 </code> </code>
   - Make sure apache starts at boot and start/restart apache: <code>   - Make sure apache starts at boot and start/restart apache: <code>
-chmod 755 /etc/rc.d/rc.httpd +     chmod 755 /etc/rc.d/rc.httpd 
-/etc/rc.d/rc.httpd restart+     /etc/rc.d/rc.httpd restart
 </code> </code>
   - Set the password for //nagiosadmin// : <code>   - Set the password for //nagiosadmin// : <code>
-htpasswd -c /etc/nagios/htpasswd.users nagiosadmin+     htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
 </code> </code>
   - (Not sure if this is necessary but, leaving it in until I can test) \\ Make sure nagios starts at boot and start/restart nagios:   - (Not sure if this is necessary but, leaving it in until I can test) \\ Make sure nagios starts at boot and start/restart nagios:
Line 98: Line 102:
  
   - Run the ''htpasswd'' command for each user: <code>   - Run the ''htpasswd'' command for each user: <code>
-htpasswd -c /etc/nagios/htpasswd.users bob +     htpasswd -c /etc/nagios/htpasswd.users bob 
-htpasswd -c /etc/nagios/htpasswd.users sue+     htpasswd -c /etc/nagios/htpasswd.users sue
 </code> </code>
   - Edit ''/etc/nagios/cgi.cfg'' and add the user(s) too: <code>   - Edit ''/etc/nagios/cgi.cfg'' and add the user(s) too: <code>
Line 109: Line 113:
 ====== TROUBLESHOOTING ====== ====== TROUBLESHOOTING ======
 ERROR: When browsing to the nagios webpage (as nagiosadmin) you get "You do not have permission" ERROR: When browsing to the nagios webpage (as nagiosadmin) you get "You do not have permission"
 +
 HINT: Check /var/log/httpd/error_log to see what is failing. HINT: Check /var/log/httpd/error_log to see what is failing.
  
Line 115: Line 120:
 FIX2: In /etc/http/httpd.conf make sure: FIX2: In /etc/http/httpd.conf make sure:
     UNCOMMENT: Include /etc/httpd/mod_php.conf     UNCOMMENT: Include /etc/httpd/mod_php.conf
-    DO THE "<IfModule dir_module>" CHANGE LISTED ABOVE+    Do the "<IfModule dir_module>" change listed above.
          
 +-----
  
 +ERROR: When clicking on Nagios cgi pages, they are downloaded and not executed.
 +
 +FIX: Make sure the "LoadModule cgi_module" is uncommented as described above.
 +
 +-----
  
 ERROR: "stderr: execvp(/usr/libexec/monitoring-plugins/check_ping, ...) failed. errno is 2: No such file or directory" ERROR: "stderr: execvp(/usr/libexec/monitoring-plugins/check_ping, ...) failed. errno is 2: No such file or directory"
Line 124: Line 135:
      CHANGE: $USER1$=/usr/libexec/monitoring-plugins      CHANGE: $USER1$=/usr/libexec/monitoring-plugins
      TO: $USER1$=/usr/libexec/nagios      TO: $USER1$=/usr/libexec/nagios
 +
 +-----
 +
 +ERROR: I've done the FIXes above and it's still not working...
 +
 +FIX: Didya restart httpd and/or nagios?
 +     /etc/rc.d/rc.httpd restart
 +     /etc/rc.d/rc.nagios restart
 +
 +
 +
 +
 +====== Install NRPE On A Target Machine ======
 +
 +**ON THE TARGET MACHINE (as root):**
 +
 +  groupadd -g 213 nagios
 +  useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios
 +
 +Install nagios via SBo (Required by Nagios-plugins)
 +
 +Install nagios-plugins via SBo (Required by NRPE)
 +
 +Install nrpe via SBo
 +
 +Ignore the xinetd stuff, you have to run NRPE as a daemon on Slackware (unless you want to go through the headache of replacing inetd with xinetd)
 +
 +So, start NRPE in Daemon mode:
 +  chmod 755 /etc/rc.d/rc.nrpe
 +  /etc/rc.d/rc.nrpe start
 +
 +Test NRPE
 +  /usr/libexec/nagios/check_nrpe -H localhost
 +  NRPE v2.15
 +  
 +  /usr/libexec/nagios/check_nrpe -H localhost -c check_users
 +  USERS OK - 1 users currently logged in |users=1;5;10;0
 +
 +Add your Nagios server's IP into the allowed_hosts list:
 +  vi /etc/nagios/nrpe.cfg
 +   allowed_hosts=127.0.0.1,192.168.1.77  (WHERE: 192.168.1.77 is the IP of your Nagios server)
 +
 +  chown nagios:nagios /etc/nagios/nrpe.cfg
 +
 +-----
 +**ON THE NAGIOS SERVER MACHINE:**
 +
 +Add the client machine into one of the .cfg files
 +
 +I did this:
 +  vi /etc/nagios/nagios.cfg
 +ADD:
 + # Definitions for monitoring a linux machine
 + cfg_file=/etc/nagios/objects/linux.cfg
 +
 +  chown nagios:nagios /etc/nagios/nagios.cfg
 +
 +  vi /etc/nagios/objects/linux.cfg_file
 +   #########################################################
 +   # Linux  configuration file
 +   #########################################################
 +   
 +   define host {
 +     use     linux-server
 +     host_name   MyLinuxBox
 +     alias     LinuxBox1
 +     address   192.168.1.110
 +     register   1
 +     }
 +   define service{
 +     host_name MyLinuxBox
 +     service_description PING
 +     check_command check_ping!100.0,20%!500.0,60%
 +     max_check_attempts 2
 +     check_interval 2
 +     retry_interval 2
 +     check_period 24x7
 +     check_freshness 1
 +     contact_groups admins
 +     notification_interval 2
 +     notification_period 24x7
 +     notifications_enabled 1
 +     register 1
 +     }
 +   
 +   #########################################################
 +   # END OF FILE
 +   #########################################################
 +
 +  chown nagios:nagios /etc/nagios/objects/linux.cfg_file
 +
 +Restart Nagios
 +   /etc/rc.d/rc.nagios restart
 +
 +
 +
  
  
 howtos:software:install_nagios_on_slackware ()