Vamos a ver como monitorizar procesos nagios, para ello vamos a partir de los manuales que hemos realizado sobre monitorización básica en Windows y GNU/Linux
Monitorización basica de UNIX – *BSD – GNU/Linux en Nagios
Monitorización basica de Windows en Nagios
Definir los comandos :
para definir tenemos que añadir los siguientes comandos al fichero commands.cfg, este fichero estará… dependiendo de la instalación que habríais realizado
vi /etc/nagios3/commands.cfg
Y añadimos lo siguiente:
define command{
command_name check_process_snmp
command_line /usr/bin/perl $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -w $ARG3$ -c $ARG4$
}
Accedemos al direcctorio
Accedemos al directorio donde se encuentran los archivos de configuración en mi caso (/etc/nagios3/etc/cfg/Linux/)
cd /etc/nagios3/etc/cfg/Linux
Añadimos el nuevo chequeo.
vi cacti.cfg
Agregamos lo siguiente:
define service {
use linux-srv
host_name cacti_192.168.1.111
service_description Proceso MySQLD
check_command check_process_snmp!redorbita!mysqld!0!0
}define service {
use linux-srv
host_name cacti_192.168.1.111
service_description Proceso apache2
check_command check_process_snmp!redorbita!apache2!0!0
}
define service {
use linux-srv
host_name cacti_192.168.1.111
service_description Proceso MySQLD
check_command check_process_snmp!redorbita!mysqld!0,2!0,2
}define service {
use linux-srv
host_name cacti_192.168.1.111
service_description Proceso Apache2
check_command check_process_snmp!redorbita!apache2!0,30!0,50
}
Ahora vamos a realizar exactamente lo mismo con la monitorización en Microsoft Windows.
Accedemos al directorio donde se encuentran los archivos de configuración
cd /etc/nagios3/etc/cfg/Windows
Añadimos el nuevo chequeo.
vi cpd01.cfg
Agregamos lo siguiente:
define service {
use windows-srv
host_name cpd_192.168.1.112
service_description Proceso IIS
check_command check_process_snmp!redorbita!minetinfo.exe!0!0
}
chequeamos para ver si no hay ningún error en los archivos de configuración
rokitoh@nagios:/usr/lib/nagios/plugins# nagios3 -v /etc/nagios3/nagios.cfg
Nagios Core 3.2.1
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 03-09-2010
License: GPLWebsite: http://www.nagios.org
Reading configuration data…
Read main config file okay…
Processing object config file ‘/etc/nagios3/commands.cfg’…
Processing object config directory ‘/usr/lib/nagios/plugins’…
Processing object config file ‘/usr/lib/nagios/plugins/mailq.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_storage.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/ifstatus.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_load.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/breeze.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/ftp.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/apt.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/tcp_udp.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/ntp.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/dummy.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/mrtg.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/rpc-nfs.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/users.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/games.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/real.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/pgsql.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_vrrp.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/flexlm.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_win.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/ssh.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/ping.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/news.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/telnet.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/radius.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/fping.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/netware.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_cpfw.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_process.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/procs.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/ldap.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/mysql.cfg’…
Processing object config directory ‘/usr/lib/nagios/plugins/doc’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_int.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_mem.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/snmp_env.cfg’…
Processing object config file ‘/usr/lib/nagios/plugins/load.cfg’…
Processing object config directory ‘/etc/nagios3/conf.d’…
Processing object config file ‘/etc/nagios3/conf.d/timeperiods_nagios2.cfg’…
Processing object config file ‘/etc/nagios3/conf.d/contacts.cfg’…
Processing object config file ‘/etc/nagios3/conf.d/generic-host_nagios2.cfg’…
Processing object config file ‘/etc/nagios3/conf.d/generic-service_nagios2.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Windows/templete.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Windows/hosts.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Windows/cpd01.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Windows/contacts.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Linux/templete.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Linux/hosts.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Linux/cacti.cfg’…
Processing object config file ‘/etc/nagios3/etc/cfg/Linux/contacts.cfg’…
Warning: Duplicate definition found for service ‘Uso CPU’ on host ‘cacti_192.168.1.111’ (config file ‘/etc/nagios3/etc/cfg/Linux/cacti.cfg’, starting on line 23)
Warning: Duplicate definition found for service ‘Uso CPU’ on host ‘cacti_192.168.1.111’ (config file ‘/etc/nagios3/etc/cfg/Linux/cacti.cfg’, starting on line 16)
Read object config files okay…Running pre-flight check on configuration data…
Checking services…
Checked 14 services.
Checking hosts…
Checked 2 hosts.
Checking host groups…
Checked 2 host groups.
Checking service groups…
Checked 0 service groups.
Checking contacts…
Checked 3 contacts.
Checking contact groups…
Checked 3 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checking commands…
Checked 193 commands.
Checking time periods…
Checked 4 time periods.
Checking for circular paths between hosts…
Checking for circular host and service dependencies…
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…Total Warnings: 0
Total Errors: 0Things look okay – No serious problems were detected during the pre-flight check
Y reiniciamos nagios
rokitoh@nagios:/etc/nagios3/etc/cfg/Windows# service nagios3 reload
Reloading nagios3 monitoring daemon configuration files: nagios3.
Abrimos nagios en nuestro navegador favorito y si todo a salido bien lo tendríamos que tener OK!
Un saludo, rokitoh
:wq!