[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

no way to compare when less than two revisions

Diferencias

Muestra las diferencias entre dos versiones de la página.


es:howtos:software:nagios [2019/02/28 01:49 (UTC)] (actual) – creado slackwarespanol
Línea 1: Línea 1:
 +====== Nagios ======
  
 +====== Installation ======
 +
 +  - Create the nagios group and user: <code>
 +     groupadd -g 213 nagios
 +     useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios
 +</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
 +</code>
 +  - Install the Nagios::Plugin Perl module: <code>
 +     cpan -i Monitoring::Plugin
 +</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:
 +    * RRDTool
 +    * 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-graphing
 +  - Edit ''/etc/nagios/nagios.conf'' and turn off the logging: <code>
 +CHANGE:
 +     use_syslog=1
 +TO:
 +     use_syslog=0
 +CHANGE:
 +     log_notifications=1
 +TO:
 +     log_notification=0
 +</code>
 +  - Edit ''/etc/httpd/extra/nagios.conf'', after the ''<Directory "/var/www/htdocs/nagios">'' line: <code>
 +CHANGE:
 +     Options None
 +TO:
 +     Options FollowSymLinks
 +</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:
 +     #LoadModule cgi_module lib64/httpd/modules/mod_cgi.so
 +     
 +     (or #LoadModule cgi_module lib/httpd/modules/mod_cgi.so on 32bit installs)
 +     
 +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
 +     
 +RIGHT AFTER:
 +     DocumentRoot /srv/httpd/htdocs
 +ADD:
 +     Include /etc/httpd/extra/nagios.conf
 +</code>
 +  - Make sure apache starts at boot and start/restart apache: <code>
 +     chmod 755 /etc/rc.d/rc.httpd
 +     /etc/rc.d/rc.httpd restart
 +</code>
 +  - Set the password for //nagiosadmin// : <code>
 +     htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
 +</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:
 +    - Edit ''/etc/rc.d/rc.local'' and add: <code>
 +# Start nagios:
 +if [ -x /etc/rc.d/rc.nagios ]; then
 +  echo "Starting nagios..."
 +  /etc/rc.d/rc.nagios start
 +fi
 +</code>
 +    - 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: <code>
 +# Stop nagios:
 +if [ -x /etc/rc.d/rc.nagios ]; then
 +  echo "Stopping nagios..."
 +  /etc/rc.d/rc.nagios stop
 +fi
 +</code>
 +  - Make rc.nagios executable: <code>
 +# chmod 755 /etc/rc.d/rc.nagios
 +</code>
 +  - Start nagios: <code>
 +# /etc/rc.d/rc.nagios restart
 +</code>
 +
 +====== 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: <code>
 +     htpasswd -c /etc/nagios/htpasswd.users bob
 +     htpasswd -c /etc/nagios/htpasswd.users sue
 +</code>
 +  - Edit ''/etc/nagios/cgi.cfg'' and add the user(s) too: <code>
 +authorized_for_all_services=nagiosadmin,bob,sue
 +authorized_for_all_hosts=nagiosadmin,bob,sue
 +</code> (or add "''*''" to allow all authenticated users)
 +
 +
 +====== TROUBLESHOOTING ======
 +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.
 +
 +FIX1: Make sure that /srv/www/htdocs/nagios is "drwxrwxr-x nagios nagios"
 +
 +FIX2: In /etc/http/httpd.conf make sure:
 +    UNCOMMENT: Include /etc/httpd/mod_php.conf
 +    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"
 +
 +FIX:  vi /etc/nagios/resource.cfg
 +     CHANGE: $USER1$=/usr/libexec/monitoring-plugins
 +     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
 +
 +
 +
 +
 +
 +====== Sources ======
 +
 +<!-- If you are copying information from another source, then specify that source -->
 +<!-- * Original source: [[http://some.website.org/some/page.html]] -->
 +<!-- Authors are allowed to give credit to themselves! -->
 + * Originally written by [[wiki:user:arfon | arfon]]
 +<!-- * Contributions by [[wiki:user:yyy | User Y]] -->
 +
 +<!-- Please do not modify anything below, except adding new tags.-->
 +<!-- You must remove the tag-word "template" below before saving your new page -->
 +{{tag>howtos software nagios network_monitoring author_arfon}}
 es:howtos:software:nagios ()