{"id":437,"date":"2012-04-07T12:09:20","date_gmt":"2012-04-07T10:09:20","guid":{"rendered":"http:\/\/diablo.craem.net\/wordpress\/?p=437"},"modified":"2012-04-07T12:09:20","modified_gmt":"2012-04-07T10:09:20","slug":"backup-exec-nagios-monitorizar-las-copias-parte-1","status":"publish","type":"post","link":"https:\/\/diablo.craem.net\/?p=437","title":{"rendered":"Backup Exec + Nagios; monitorizar las copias. Parte 1"},"content":{"rendered":"<p>Esta entrada explicar\u00e1 c\u00f3mo tener monitorizadas las copias de backup exec desde nagios. En principio parece que no tenga mucha utilidad, pero si ten\u00e9is varios clientes a monitorizar (como es mi caso, m\u00e1s de 20), tener todo unificado en una sola consola \/ web es bastante \u00e1gil.<br \/>\nPara ello, necesitaremos:<br \/>\n1\u00ba) Nagios > 3.x<br \/>\n2\u00ba) <a href=\"https:\/\/files.nsclient.org\/x-0.3.x_STABLE\/NSClient%2B%2B-0.3.9-x64.msi\" title=\"NsClient x64\">NSClient++ instalado en el servidor a monitorizar.<\/a><br \/>\n2\u00ba) nagios_be<br \/>\n     Instalaremos este <em>ejecutable<\/em> en el servidor a monitorizar, siendo los archivos:<br \/>\n     &#8211; <a href='https:\/\/diablo.craem.net\/wp-content\/uploads\/2012\/04\/check_be.exe'>check_be.exe<\/a><br \/>\n     &#8211; La documentaci\u00f3n de c\u00f3mo hacerlo:<a href='https:\/\/diablo.craem.net\/wp-content\/uploads\/2012\/04\/Check_be.txt'>Check_be<\/a><br \/>\nHe seleccionado la versi\u00f3n 3.x del Nsclient; es la que he ido probando y funciona bastante bien. Descargamos y lo instalamos en <strong>c:nagios<\/strong> del servidor a monitorizar.<br \/>\nUna vez instalado (siguiente, siguiente), editaremos el fichero c:nagiosnsc.ini y modificaremos (en negrita):<br \/>\n<code><br \/>\n[modules]<br \/>\nNRPEListener.dll<br \/>\nNSClientListener.dll<br \/>\nFileLogger.dll<br \/>\nCheckSystem.dll<br \/>\nCheckDisk.dll<br \/>\nCheckEventLog.dll<br \/>\nCheckHelpers.dll<br \/>\n;# NSCLIENT++ MODULES<br \/>\n;# A list with DLLs to load at startup.<br \/>\n;  You will need to enable some of these for NSClient++ to work.<br \/>\n; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !<br \/>\n; *                                                               *<br \/>\n; * N O T I C E ! ! ! - Y O U   H A V E   T O   E D I T   T H I S *<br \/>\n; *                                                               *<br \/>\n; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !<br \/>\n;FileLogger.dll<br \/>\n;CheckSystem.dll<br \/>\n;CheckDisk.dll<br \/>\n;NSClientListener.dll<br \/>\n;NRPEListener.dll<br \/>\n;SysTray.dll<br \/>\n;CheckEventLog.dll<br \/>\n;CheckHelpers.dll<br \/>\n;CheckWMI.dll<br \/>\n;<br \/>\n; Script to check external scripts and\/or internal aliases.<br \/>\n;CheckExternalScripts.dll<br \/>\n;<br \/>\n; NSCA Agent if you enable this NSClient++ will talk to NSCA hosts repeatedly (so dont enable unless you want to use NSCA)<br \/>\n;NSCAAgent.dll<br \/>\n;<br \/>\n; LUA script module used to write your own \"check deamon\".<br \/>\n;LUAScript.dll<br \/>\n;<br \/>\n; RemoteConfiguration IS AN EXTREM EARLY IDEA SO DONT USE FOR PRODUCTION ENVIROMNEMTS!<br \/>\n;RemoteConfiguration.dll<br \/>\n; Check other hosts through NRPE extreme beta and probably a bit dangerous! :)<br \/>\n;NRPEClient.dll<br \/>\n; Extreamly early beta of a task-schedule checker<br \/>\n;CheckTaskSched.dll<br \/>\n[Settings]<br \/>\n<strong>use_file=1<br \/>\nallowed_hosts=ip.del.servidor.nagios<br \/>\npassword=password<\/strong><br \/>\n[log]<br \/>\n[NSClient]<br \/>\n;# ALLOWED HOST ADDRESSES<br \/>\n;  This is a comma-delimited list of IP address of hosts that are allowed to talk to NSClient deamon.<br \/>\n;  If you leave this blank the global version will be used instead.<br \/>\n<strong>allowed_hosts=ip.del.servidor.nagios<\/strong><br \/>\n;<br \/>\n;# NSCLIENT PORT NUMBER<br \/>\n;  This is the port the NSClientListener.dll will listen to.<br \/>\n<strong>port=12489<\/strong><br \/>\n;<br \/>\n[NRPE]<br \/>\n;# NRPE PORT NUMBER<br \/>\n;  This is the port the NRPEListener.dll will listen to.<br \/>\n<strong>port=5666<\/strong><br \/>\n;<br \/>\n;# COMMAND TIMEOUT<br \/>\n;  This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off.<br \/>\n;command_timeout=60<br \/>\n;<br \/>\n;# COMMAND ARGUMENT PROCESSING<br \/>\n;  This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.<br \/>\n;allow_arguments=0<br \/>\n;<br \/>\n;# COMMAND ALLOW NASTY META CHARS<br \/>\n;  This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'\"[]{}) characters in arguments.\n;allow_nasty_meta_chars=0\n;\n;# USE SSL SOCKET\n;  This option controls if SSL should be used on the socket.\n;use_ssl=1\n;\n;# BIND TO ADDRESS\n;# ALLOWED HOST ADDRESSES\n;  This is a comma-delimited list of IP address of hosts that are allowed to talk to NRPE deamon.\n;  If you leave this blank the global version will be used instead.\n<strong>allowed_hosts=ip.del.servidor.nagios<\/strong><br \/>\n;<br \/>\n;# SCRIPT DIRECTORY<br \/>\n;  All files in this directory will become check commands.<br \/>\n;  *WARNING* This is undoubtedly dangerous so use with care!<br \/>\n;script_dir=scripts<br \/>\n;<br \/>\n;# SOCKET TIMEOUT<br \/>\n;  Timeout when reading packets on incoming sockets. If the data has not arrived withint this time we will bail out.<br \/>\n;socket_timeout=30<br \/>\n[Check System]<br \/>\n;# CPU BUFFER SIZE<br \/>\n;  so don't use a larger buffer then you need (ie. the longest check you do +1).<br \/>\n;CPUBufferSize=1h<br \/>\n;<br \/>\n;# CHECK RESOLUTION<br \/>\n;  The resolution to check values (currently only CPU).<br \/>\n;  The value is entered in 1\/10:th of a second and the default is 10 (which means ones every second)<br \/>\n;CheckResolution=10<br \/>\n;<br \/>\n;# CHECK ALL SERVICES<br \/>\n;  Configure how to check services when a CheckAll is performed.<br \/>\n;  ...=started means services in that class *has* to be running.<br \/>\n;  ...=stopped means services in that class has to be stopped.<br \/>\n;  ...=ignored means services in this class will be ignored.<br \/>\n;check_all_services[SERVICE_BOOT_START]=ignored<br \/>\n;check_all_services[SERVICE_SYSTEM_START]=ignored<br \/>\n;check_all_services[SERVICE_AUTO_START]=started<br \/>\n;check_all_services[SERVICE_DEMAND_START]=ignored<br \/>\n;check_all_services[SERVICE_DISABLED]=stopped<br \/>\n[External Script]<br \/>\n;# COMMAND TIMEOUT<br \/>\n;  This specifies the maximum number of seconds that the NRPE daemon will allow plug-ins to finish executing before killing them off.<br \/>\n;command_timeout=60<br \/>\n;<br \/>\n;# COMMAND ARGUMENT PROCESSING<br \/>\n;  This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed.<br \/>\n;allow_arguments=0<br \/>\n;<br \/>\n;# COMMAND ALLOW NASTY META CHARS<br \/>\n;  This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'\"[]{}) characters in arguments.\n;allow_nasty_meta_chars=0\n;\n;# SCRIPT DIRECTORY\n;  All files in this directory will become check commands.\n;  *WARNING* This is undoubtedly dangerous so use with care!\n;script_dir=c:myscriptdir\n[Script Wrappings]\nvbs=cscript.exe \/\/T:30 \/\/NoLogo scriptslibwrapper.vbs %SCRIPT% %ARGS%\nps1=cmd \/c echo scripts%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -\nbat=scripts%SCRIPT% %ARGS%\n[External Scripts]\n;check_es_long=scriptslong.bat\n;check_es_ok=scriptsok.bat\n;check_es_nok=scriptsnok.bat\n;check_vbs_sample=cscript.exe \/\/T:30 \/\/NoLogo scriptscheck_vb.vbs\n;check_powershell_warn=cmd \/c echo scriptspowershell.ps1 | powershell.exe -command -\n[External Alias]\nalias_cpu=checkCPU warn=80 crit=90 time=5m time=1m time=30s\nalias_cpu_ex=checkCPU warn=$ARG1$ crit=$ARG2$ time=5m time=1m time=30s\nalias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED\nalias_service=checkServiceState CheckAll\nalias_process=checkProcState $ARG1$=started\nalias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=physical\nalias_up=checkUpTime MinWarn=1d MinWarn=1h\nalias_file_age=checkFile2 filter=out \"file=$ARG1$\" filter-written=>1d MaxWarn=1 MaxCrit=1 \"syntax=%filename% %write%\"<br \/>\nalias_file_size=checkFile2 filter=out \"file=$ARG1$\" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 \"syntax=%filename% %size%\"<br \/>\nalias_file_size_in_dir=checkFile2 filter=out pattern=*.txt \"file=$ARG1$\" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 \"syntax=%filename% %size%\"<br \/>\nalias_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%)\"<br \/>\nalias_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%)\"<br \/>\nalias_event_log=alias_event_log_new<br \/>\ncheck_ok=CheckOK Everything is fine!<br \/>\n[Wrapped Scripts]<br \/>\n;check_test_vbs=check_test.vbs \/arg1:1 \/arg2:1 \/variable:1<br \/>\n;check_test_ps1=check_test.ps1 arg1 arg2<br \/>\n;check_test_bat=check_test.bat arg1 arg2<br \/>\n;check_battery=check_battery.vbs<br \/>\n;check_printer=check_printer.vbs<br \/>\n; [includes]<br \/>\n;# The order when used is \"reversed\" thus the last included file will be \"first\"<br \/>\n;# Included files can include other files (be carefull only do basic recursive checking)<br \/>\n;<br \/>\n; myotherfile.ini<br \/>\n; real.ini<br \/>\n[NSCA Agent]<br \/>\n;# CHECK INTERVALL (in seconds)<br \/>\n;   How often we should run the checks and submit the results.<br \/>\n;interval=5<br \/>\n;<br \/>\n;# ENCRYPTION METHOD<br \/>\n;   This option determines the method by which the send_nsca client will encrypt the packets it sends<br \/>\n;   to the nsca daemon. The encryption method you choose will be a balance between security and<br \/>\n;   performance, as strong encryption methods consume more processor resources.<br \/>\n;   You should evaluate your security needs when choosing an encryption method.<br \/>\n;<br \/>\n; Note: The encryption method you specify here must match the decryption method the nsca daemon uses<br \/>\n;       (as specified in the nsca.cfg file)!!<br \/>\n; Values:<br \/>\n;\t0 = None\t(Do NOT use this option)<br \/>\n;\t1 = Simple XOR  (No security, just obfuscation, but very fast)<br \/>\n;   2 = DES<br \/>\n;   3 = 3DES (Triple DES)<br \/>\n;\t4 = CAST-128<br \/>\n;\t6 = xTEA<br \/>\n;\t8 = BLOWFISH<br \/>\n;\t9 = TWOFISH<br \/>\n;\t11 = RC2<br \/>\n;\t14 = RIJNDAEL-128 (AES)<br \/>\n;\t20 = SERPENT<br \/>\n;encryption_method=14<br \/>\n;<br \/>\n;# ENCRYPTION PASSWORD<br \/>\n;  This is the password\/passphrase that should be used to encrypt the sent packets.<br \/>\n;password=<br \/>\n;<br \/>\n;# BIND TO ADDRESS<br \/>\n;  Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.<br \/>\n;  Leaving this blank will bind to \"one\" local interface.<br \/>\n; -- not supported as of now --<br \/>\n;bind_to_address=<br \/>\n;<br \/>\n;# LOCAL HOST NAME<br \/>\n;  The name of this host (if empty \"computername\" will be used.<br \/>\n;hostname=<br \/>\n;<br \/>\n;# NAGIOS SERVER ADDRESS<br \/>\n;  The address to the nagios server to submit results to.<br \/>\n;nsca_host=192.168.0.1<br \/>\n;<br \/>\n;# NAGIOS SERVER PORT<br \/>\n;  The port to the nagios server to submit results to.<br \/>\n;nsca_port=5667<br \/>\n;<br \/>\n;# CHECK COMMAND LIST<br \/>\n;  The checks to run everytime we submit results back to nagios<br \/>\n;  Any command(alias\/key) starting with a host_ is sent as HOST_COMMAND others are sent as SERVICE_COMMANDS<br \/>\n;  where the alias\/key is used as service name.<br \/>\n;<br \/>\n[NSCA Commands]<br \/>\n;my_cpu_check=checkCPU warn=80 crit=90 time=20m time=10s time=4<br \/>\n;my_mem_check=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=page<br \/>\n;my_svc_check=checkServiceState CheckAll exclude=wampmysqld exclude=MpfService<br \/>\n;host_check=check_ok<br \/>\n[NRPE Handlers]<br \/>\n;# COMMAND DEFINITIONS<br \/>\n;# Command definitions that this daemon will run.<br \/>\n;# Can be either NRPE syntax:<br \/>\ncommand[check_users]=\/usr\/local\/nagios\/libexec\/check_users -w 5 -c 10<br \/>\n;# Or simplified syntax:<br \/>\n;check_other=-H 192.168.0.1 -p 5666 -c remote_command -a arguments<br \/>\ncheck_cpu=inject checkCPU warn=80 crit=90 5 10 15<br \/>\nnrpe_cpu=inject checkCPU warn=80 crit=90 5 10 15<br \/>\n<strong>check_be=c:nagioscheck_be.exe \"c:Program FilesSymantecBackup ExecData\" \"CopiaESXi\"<\/strong><br \/>\n;# REMOTE NRPE PROXY COMMANDS<br \/>\n;  A list of commands that check other hosts.<br \/>\n;  Used by the NRPECLient module<br \/>\n[NRPE Client Handlers]<br \/>\n;check_other=-H 192.168.0.1 -p 5666 -c remote_command -a arguments<br \/>\ncheck_cpu=inject checkCPU warn=80 crit=90 5 10 15<br \/>\nnrpe_cpu=inject checkCPU warn=80 crit=90 5 10 15<br \/>\n<strong>check_be=c:nagioscheck_be.exe \"c:Program FilesSymantecBackup ExecData\" \"CopiaESXi\"<\/strong><br \/>\n;# LUA SCRIPT SECTION<br \/>\n;  A list of all Lua scripts to load.<br \/>\n;[LUA Scripts]<br \/>\n;scriptstest.lua<br \/>\n<\/code><br \/>\nReiniciamos el servicio de windows. Ahora copiamos el fichero check_be.exe en la carpeta que nos ha creado el instalador (c:nagios)<br \/>\nUna vez copiado, desde el servidor windows, comprobamos si funciona, ejecutando desde el terminal:<br \/>\n<code><br \/>\nC:nagios>check_be  \"c:Program FilesSymantecBackup ExecData\" \"CopiaESXi\" -w1 -c3<br \/>\n<strong>Job: CopiaESXi, Status: Completed with exceptions, Date:5\/4\/2012<\/strong><br \/>\nC:nagios><br \/>\n<\/code><br \/>\nAhora explicamos&#8230;<br \/>\nc:nagioscheck_be &#8211;> el ejecutable<br \/>\n\u00abc:Program FilesSymantecBackup ExecData\u00bb &#8211;> la ubicaci\u00f3n de los cat\u00e1logos de veritas, en mi caso, en la versi\u00f3n 2010.<br \/>\n\u00abCopiaESXi\u00bb &#8211;> el nombre que le hemos dado a la tarea dentro del backup exec<br \/>\n\u00ab-w1 -c3\u00bb &#8211;> Seg\u00fan la ayuda<br \/>\n  -c<n> :<br \/>\n        Return &#8216;critical&#8217; state if the last occurrence of the job is older<br \/>\n        than <n> days. This can help to determine if a scheduled job is<br \/>\n        disabled, locked, paused, or any other reason.<br \/>\n  -w<n> : Same, but for &#8216;warning&#8217; state<br \/>\nSeguimos&#8230;. damos por hecho que la prueba de arriba ha salido bien&#8230; ahora vamos a la parte de los ficheros del nagios<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Esta entrada explicar\u00e1 c\u00f3mo tener monitorizadas las copias de backup exec desde nagios. En principio parece que no tenga mucha utilidad, pero si ten\u00e9is varios clientes a monitorizar (como es mi caso, m\u00e1s de 20), tener todo unificado en una sola consola \/ web es bastante \u00e1gil. Para ello, necesitaremos: 1\u00ba) Nagios > 3.x 2\u00ba) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[31,39,102,117,197],"class_list":["post-437","post","type-post","status-publish","format-standard","hentry","category-linux","tag-backupexec","tag-check_be","tag-linux-2","tag-nagios","tag-windows"],"_links":{"self":[{"href":"https:\/\/diablo.craem.net\/index.php?rest_route=\/wp\/v2\/posts\/437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/diablo.craem.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diablo.craem.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diablo.craem.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diablo.craem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=437"}],"version-history":[{"count":0,"href":"https:\/\/diablo.craem.net\/index.php?rest_route=\/wp\/v2\/posts\/437\/revisions"}],"wp:attachment":[{"href":"https:\/\/diablo.craem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diablo.craem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diablo.craem.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}