Backup Exec + Nagios; monitorizar las copias. Parte 1

linux

Esta entrada explicará cómo tener monitorizadas las copias de backup exec desde nagios. En principio parece que no tenga mucha utilidad, pero si tenéis varios clientes a monitorizar (como es mi caso, más de 20), tener todo unificado en una sola consola / web es bastante ágil.
Para ello, necesitaremos:
1º) Nagios > 3.x
2º) NSClient++ instalado en el servidor a monitorizar.
2º) nagios_be
Instalaremos este ejecutable en el servidor a monitorizar, siendo los archivos:
check_be.exe
– La documentación de cómo hacerlo:Check_be
He seleccionado la versión 3.x del Nsclient; es la que he ido probando y funciona bastante bien. Descargamos y lo instalamos en c:nagios del servidor a monitorizar.
Una vez instalado (siguiente, siguiente), editaremos el fichero c:nagiosnsc.ini y modificaremos (en negrita):

[modules]
NRPEListener.dll
NSClientListener.dll
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
CheckEventLog.dll
CheckHelpers.dll
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
; You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; * *
; * N O T I C E ! ! ! - Y O U H A V E T O E D I T T H I S *
; * *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
;FileLogger.dll
;CheckSystem.dll
;CheckDisk.dll
;NSClientListener.dll
;NRPEListener.dll
;SysTray.dll
;CheckEventLog.dll
;CheckHelpers.dll
;CheckWMI.dll
;
; Script to check external scripts and/or internal aliases.
;CheckExternalScripts.dll
;
; NSCA Agent if you enable this NSClient++ will talk to NSCA hosts repeatedly (so dont enable unless you want to use NSCA)
;NSCAAgent.dll
;
; LUA script module used to write your own "check deamon".
;LUAScript.dll
;
; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!
;RemoteConfiguration.dll
; Check other hosts through NRPE extreme beta and probably a bit dangerous! :)
;NRPEClient.dll
; Extreamly early beta of a task-schedule checker
;CheckTaskSched.dll
[Settings]
use_file=1
allowed_hosts=ip.del.servidor.nagios
password=password

[log]
[NSClient]
;# ALLOWED HOST ADDRESSES
; This is a comma-delimited list of IP address of hosts that are allowed to talk to NSClient deamon.
; If you leave this blank the global version will be used instead.
allowed_hosts=ip.del.servidor.nagios
;
;# NSCLIENT PORT NUMBER
; This is the port the NSClientListener.dll will listen to.
port=12489
;
[NRPE]
;# NRPE PORT NUMBER
; This is the port the NRPEListener.dll will listen to.
port=5666
;
;# COMMAND TIMEOUT
; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off.
;command_timeout=60
;
;# COMMAND ARGUMENT PROCESSING
; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.
;allow_arguments=0
;
;# COMMAND ALLOW NASTY META CHARS
; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"[]{}) characters in arguments. ;allow_nasty_meta_chars=0 ; ;# USE SSL SOCKET ; This option controls if SSL should be used on the socket. ;use_ssl=1 ; ;# BIND TO ADDRESS ;# ALLOWED HOST ADDRESSES ; This is a comma-delimited list of IP address of hosts that are allowed to talk to NRPE deamon. ; If you leave this blank the global version will be used instead. allowed_hosts=ip.del.servidor.nagios
;
;# SCRIPT DIRECTORY
; All files in this directory will become check commands.
; *WARNING* This is undoubtedly dangerous so use with care!
;script_dir=scripts
;
;# SOCKET TIMEOUT
; Timeout when reading packets on incoming sockets. If the data has not arrived withint this time we will bail out.
;socket_timeout=30
[Check System]
;# CPU BUFFER SIZE
; so don't use a larger buffer then you need (ie. the longest check you do +1).
;CPUBufferSize=1h
;
;# CHECK RESOLUTION
; The resolution to check values (currently only CPU).
; The value is entered in 1/10:th of a second and the default is 10 (which means ones every second)
;CheckResolution=10
;
;# CHECK ALL SERVICES
; Configure how to check services when a CheckAll is performed.
; ...=started means services in that class *has* to be running.
; ...=stopped means services in that class has to be stopped.
; ...=ignored means services in this class will be ignored.
;check_all_services[SERVICE_BOOT_START]=ignored
;check_all_services[SERVICE_SYSTEM_START]=ignored
;check_all_services[SERVICE_AUTO_START]=started
;check_all_services[SERVICE_DEMAND_START]=ignored
;check_all_services[SERVICE_DISABLED]=stopped
[External Script]
;# COMMAND TIMEOUT
; This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off.
;command_timeout=60
;
;# COMMAND ARGUMENT PROCESSING
; This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.
;allow_arguments=0
;
;# COMMAND ALLOW NASTY META CHARS
; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"[]{}) characters in arguments. ;allow_nasty_meta_chars=0 ; ;# SCRIPT DIRECTORY ; All files in this directory will become check commands. ; *WARNING* This is undoubtedly dangerous so use with care! ;script_dir=c:myscriptdir [Script Wrappings] vbs=cscript.exe //T:30 //NoLogo scriptslibwrapper.vbs %SCRIPT% %ARGS% ps1=cmd /c echo scripts%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command - bat=scripts%SCRIPT% %ARGS% [External Scripts] ;check_es_long=scriptslong.bat ;check_es_ok=scriptsok.bat ;check_es_nok=scriptsnok.bat ;check_vbs_sample=cscript.exe //T:30 //NoLogo scriptscheck_vb.vbs ;check_powershell_warn=cmd /c echo scriptspowershell.ps1 | powershell.exe -command - [External Alias] alias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s alias_cpu_ex=checkCPU warn=$ARG1$ crit=$ARG2$ time=5m time=1m time=30s alias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED alias_service=checkServiceState CheckAll alias_process=checkProcState $ARG1$=started alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=physical alias_up=checkUpTime MinWarn=1d MinWarn=1h alias_file_age=checkFile2 filter=out "file=$ARG1$" filter-written=>1d MaxWarn=1 MaxCrit=1 "syntax=%filename% %write%"
alias_file_size=checkFile2 filter=out "file=$ARG1$" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%"
alias_file_size_in_dir=checkFile2 filter=out pattern=*.txt "file=$ARG1$" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%"
alias_event_log_old=CheckEventLog file=application file=system filter=new filter=out MaxWarn=1 MaxCrit=1 filter-generated=>2d filter-severity==success filter-severity==informational truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"
alias_event_log_new=CheckEventLog file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated gt -2d AND severity NOT IN ('success', 'informational')" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"
alias_event_log=alias_event_log_new
check_ok=CheckOK Everything is fine!
[Wrapped Scripts]
;check_test_vbs=check_test.vbs /arg1:1 /arg2:1 /variable:1
;check_test_ps1=check_test.ps1 arg1 arg2
;check_test_bat=check_test.bat arg1 arg2
;check_battery=check_battery.vbs
;check_printer=check_printer.vbs
; [includes]
;# The order when used is "reversed" thus the last included file will be "first"
;# Included files can include other files (be carefull only do basic recursive checking)
;
; myotherfile.ini
; real.ini
[NSCA Agent]
;# CHECK INTERVALL (in seconds)
; How often we should run the checks and submit the results.
;interval=5
;
;# ENCRYPTION METHOD
; This option determines the method by which the send_nsca client will encrypt the packets it sends
; to the nsca daemon. The encryption method you choose will be a balance between security and
; performance, as strong encryption methods consume more processor resources.
; You should evaluate your security needs when choosing an encryption method.
;
; Note: The encryption method you specify here must match the decryption method the nsca daemon uses
; (as specified in the nsca.cfg file)!!
; Values:
; 0 = None (Do NOT use this option)
; 1 = Simple XOR (No security, just obfuscation, but very fast)
; 2 = DES
; 3 = 3DES (Triple DES)
; 4 = CAST-128
; 6 = xTEA
; 8 = BLOWFISH
; 9 = TWOFISH
; 11 = RC2
; 14 = RIJNDAEL-128 (AES)
; 20 = SERPENT
;encryption_method=14
;
;# ENCRYPTION PASSWORD
; This is the password/passphrase that should be used to encrypt the sent packets.
;password=
;
;# BIND TO ADDRESS
; Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
; Leaving this blank will bind to "one" local interface.
; -- not supported as of now --
;bind_to_address=
;
;# LOCAL HOST NAME
; The name of this host (if empty "computername" will be used.
;hostname=
;
;# NAGIOS SERVER ADDRESS
; The address to the nagios server to submit results to.
;nsca_host=192.168.0.1
;
;# NAGIOS SERVER PORT
; The port to the nagios server to submit results to.
;nsca_port=5667
;
;# CHECK COMMAND LIST
; The checks to run everytime we submit results back to nagios
; Any command(alias/key) starting with a host_ is sent as HOST_COMMAND others are sent as SERVICE_COMMANDS
; where the alias/key is used as service name.
;
[NSCA Commands]
;my_cpu_check=checkCPU warn=80 crit=90 time=20m time=10s time=4
;my_mem_check=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=page
;my_svc_check=checkServiceState CheckAll exclude=wampmysqld exclude=MpfService
;host_check=check_ok
[NRPE Handlers]
;# COMMAND DEFINITIONS
;# Command definitions that this daemon will run.
;# Can be either NRPE syntax:
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
;# Or simplified syntax:
;check_other=-H 192.168.0.1 -p 5666 -c remote_command -a arguments
check_cpu=inject checkCPU warn=80 crit=90 5 10 15
nrpe_cpu=inject checkCPU warn=80 crit=90 5 10 15
check_be=c:nagioscheck_be.exe "c:Program FilesSymantecBackup ExecData" "CopiaESXi"
;# REMOTE NRPE PROXY COMMANDS
; A list of commands that check other hosts.
; Used by the NRPECLient module
[NRPE Client Handlers]
;check_other=-H 192.168.0.1 -p 5666 -c remote_command -a arguments
check_cpu=inject checkCPU warn=80 crit=90 5 10 15
nrpe_cpu=inject checkCPU warn=80 crit=90 5 10 15
check_be=c:nagioscheck_be.exe "c:Program FilesSymantecBackup ExecData" "CopiaESXi"
;# LUA SCRIPT SECTION
; A list of all Lua scripts to load.
;[LUA Scripts]
;scriptstest.lua

Reiniciamos el servicio de windows. Ahora copiamos el fichero check_be.exe en la carpeta que nos ha creado el instalador (c:nagios)
Una vez copiado, desde el servidor windows, comprobamos si funciona, ejecutando desde el terminal:

C:nagios>check_be "c:Program FilesSymantecBackup ExecData" "CopiaESXi" -w1 -c3
Job: CopiaESXi, Status: Completed with exceptions, Date:5/4/2012
C:nagios>

Ahora explicamos…
c:nagioscheck_be –> el ejecutable
«c:Program FilesSymantecBackup ExecData» –> la ubicación de los catálogos de veritas, en mi caso, en la versión 2010.
«CopiaESXi» –> el nombre que le hemos dado a la tarea dentro del backup exec
«-w1 -c3» –> Según la ayuda
-c :
Return ‘critical’ state if the last occurrence of the job is older
than days. This can help to determine if a scheduled job is
disabled, locked, paused, or any other reason.
-w : Same, but for ‘warning’ state
Seguimos…. damos por hecho que la prueba de arriba ha salido bien… ahora vamos a la parte de los ficheros del nagios

2 comentarios en «Backup Exec + Nagios; monitorizar las copias. Parte 1»

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *