Monitorización con Nagios

Testear un plugin

Para testear un plugin (hecho por nosotros o bajado de internet):

$ su - nagios
$ cd /tmp
$ /usr/local/nagios/libexec/check_uptime.pl; echo "Codigo de retorno del Plugin: $?"

Utilización de plugins que necesitan permiso de root para su ejecución: check_smartmon y check_md_raid

  • Cambiamos los permisos de los ficheros de ejecución, que residen en /usr/local/nagios/libexec:
$ cd /usr/local/nagios/libexec
$ chown nagios.nagcmd check_smartmon
$ chown nagios.nagcmd check_md_raid
$ chmod 755 check_smartmon
$ chmod 755 check_md_raid
  • Ahora ejecutamos la siguiente orden:
$ visudo
  • Añadimos las siguientes líneas:
nagios ALL = NOPASSWD: /usr/local/nagios/libexec/check_smartmon
nagios ALL = NOPASSWD: /usr/local/nagios/libexec/check_md_raid
  • Los comandos deben estar definidos de la siguiente manera (con el /usr/bin/sudo delante) en el fichero /usr/local/nagios/etc/objects/commands.cfg:
# ' check_smartmon' command definition
define command{
        command_name    check_smartmon
        command_line    /usr/bin/sudo $USER1$/check_smartmon -d $ARG1$
}
# ' check_md_raid'
define command{
        command_name    check_md_raid
        command_line    /usr/bin/sudo $USER1$/check_md_raid
}

Problema al ejecutar plugins: Can't locate utils.pm in @INC (@INC

Este problema se encuentra al ejecutar algunos plugins (check_smart, check_snmp, etc…)

Se soluciona de la siguiente manera.

Cambiar la línea:

use lib "/usr/local/nagios/libexec" ;

Por esta otra:

use lib "/usr/lib/nagios/plugins" ;
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License