martes, 28 de enero de 2014

Monitoring IBM TS3100 Tape Library with Nagios



Descargué el "check_ibm_ts_tape.pl" del siguiente enlace: http://www.claudiokuenzler.com/nagios-plugins/check_ibm_ts_tape.php en la ruta donde guardo los scripts de nagios (en mi caso /ruta-nagios/libexec):

# wget http://www.claudiokuenzler.com/nagios-plugins/check_ibm_ts_tape.pl
--2014-01-28 17:06:08--  http://www.claudiokuenzler.com/nagios-plugins/check_ibm_ts_tape.pl
Resolving www.claudiokuenzler.com... 144.76.83.23
Connecting to www.claudiokuenzler.com|144.76.83.23|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7078 (6.9K) [text/x-perl]
Saving to: `check_ibm_ts_tape.pl'
100%[=======================================================================================================================================>] 7,078       30.9K/s   in 0.2s
2014-01-28 17:06:10 (30.9 KB/s) - `check_ibm_ts_tape.pl' saved [7078/7078]
#


Damos permisos de ejecución:


# chmod a+x check_ibm_ts_tape.pl


Lo ejecutamos sin parámetros y nos muestra que library's están disponibles:


# ./check_ibm_ts_tape.pl
Model must be either ts3100 or ts3200.


Si le damos --help nos muestra la ayuda:


# ./check_ibm_ts_tape.pl --help
check_ibm_ts_tape.pl (c) 2012 Claudio Kuenzler (published under GPL License)
Version: 20120901
Usage: ./check_ibm_ts_tape.pl -H host [-C community] -m model -t checktype
Options:
-H      Hostname or IP address of tape library.
-C      SNMP community name (if not set, public will be used).
-m      Model of the tape library. Must be either ts3100 or ts3200.
-t      Type to check. See below for valid types.
--help  Show this help/usage.
Check Types:
info -> Show basic information of the tape library (hostname, serial number, etc)
status -> Checks the current status and outputs error codes if status is not ok
clean -> Checks all drives of tape library if cleaning is required



Ejecutamos el comando completo (Donde 192.168.0.100 es la ip de la Library, la Comunidad la especificamos con el -C, el modelo con el -m y lo que deseamos chequear con el -t, en este caso uso el info):

# ./check_ibm_ts_tape.pl -H 192.168.0.100 -C Comunidad -m ts3100 -t info
server.dominio (IBM TS3100) - Product-No: XXXX-TL - S/N: XXXXXXXX - running on Firmware X.XX


Ejecutamos el mismo comando, pero ahora con el check de status y luego el de clean:


# ./check_ibm_ts_tape.pl -H 192.168.0.100 -C Comunidad -m ts3100 -t info
ts3100 WARNING - Current status is: non-critical - No error (error code: 0) 
# ./check_ibm_ts_tape.pl -H 192.168.0.100 -C Comunidad -m ts3100 -t clean
ts3100 WARNING - 1 tape drive needs to be cleaned


Editamos el commands.cfg del nagios y agregamos lo siguiente:

# vi /ruta-del-nagios/commands.cfg
define command{
command_name check_library
command_line $USER1$/check_ibm_ts_tape.pl -H $HOSTADDRESS$ -C Comunidad -m ts3100 -t $ARG1$
}


Editamos el hosts.cfg y el services.cfg de la ruta del nagios y agregamos lo siguiente:

# vi /ruta-del-nagios/hosts.cfg
define host{
        host_name         Tape_Library
        alias                   Tape_Library
        address              192.168.0.100
        }
# vi /ruta-del-nagios/services.cfg
define service{
use                             generic-service,srv-pnp
host_name                  Tape_Library
service_description      Clean
check_command         check_library!clean
}
define service{
use                             generic-service,srv-pnp
host_name                  Tape_Library
service_description      Info
check_command         check_library!info
}
define service{
use                             generic-service,srv-pnp
host_name                  Tape_Library
service_description      Status
check_command         check_library!status
}


Verificamos la configuración del nagios antes de reiniciarlo:

#/ruta-del-nagios/bin/nagios -v /ruta-del-nagios/etc/nagios.cfg


Si devuelve 0 warnings y 0 errors reiniciamos el servicio con:


# /etc/init.d/nagios reload

No hay comentarios: