====== Nagios 3.0 ======
===== Descripción =====
Nagios es un sistema de monitor de actividad de servidores y servicios.
Funciona de manera remota haciendo las consultas adecuadas y no necesita agente. Puede ser configurado tambien para leer alertas y valores de SNMP.
===== Prerequisitos =====
* Un servidor web .. como Apache 2.0
===== Procedimiento =====
==== A. Instalación ====
Instale los paquetes rpm o deb necesarios que usualmente son:
nagios y nagios-plugins
o si los piensa bajar como tar.gzs del sitio oficial
nagios-3.0.5.tar.gz nagios-plugins-1.4.13.tar.gz
Aqui toca seguir las instrucciones estandar que vienen siendo algo como
$> ./configure --prefix=/usr/local/nagios3\\
$> make all\\
$> make install\\
$> make install-init *OJO esto instala en /etc/rc.d/init.d\\
$> make install-commandmode\\
$> make install-config\\
$> make install-webconf *OJO instala en /etc/httpd/conf.d/nagios
==== B. Configuración ====
**Archivos de Configuracion**
La presente versión de nagios permite trabajar con un solo archivo de configuración **nagios.conf** (para todo!: host, servicios, administradores, grupos), pero recomiendan trabajar con archivos separados por la simple razón de que cuando se tiene una configuración compleja este archivo se nos puede volver algo bastante extenso y complejo para la identificación de errores.
Editamos el archivo "nagios.cfg" para que nos permita trabajar con multiples archivos. Este archivo deberá tener las siguientes opciones habilitadas (muchos ya los traen).
> # OBJECT CONFIGURATION FILE(S)\\
> cfg_file=/etc/nagios/objects/contactgroups.cfg\\
> cfg_file=/etc/nagios/objects/contacts.cfg\\
> cfg_file=/etc/nagios/objects/hostgroups.cfg\\
> cfg_file=/etc/nagios/objects/hosts.cfg\\
> cfg_file=/etc/nagios/objects/services.cfg\\
> cfg_file=/etc/nagios/objects/timeperiods.cfg\\
> \\
> # EXTERNAL COMMAND OPTION\\
> check_external_commands=1\\
> \\
> # EXTERNAL COMMAND CHECK INTERVAL\\
> command_check_interval=1
Como se ha dividido el sistema en varios archivos, comente la opción de localhost para excluir el local:
> # Host and service definitions for monitoring this machine\\
> #cfg_file=/etc/nagios/localhost.cfg
En caso que no existan, cree cada uno de los archivos de configuración a mano (notese que el archivo "nagios.cfg" hace referencia a estos archivos):
$> touch contactgroups.cfg contacts.cfg hostgroups.cfg hosts.cfg services.cfg timeperiods.cfg
Despues de la version 3.0 vienen en el directorio /etc/nagios/objects, y para los especiales creados por skina se esta creando un directorio **/etc/nagios/skina** para aislar lo que viene en la distribucion de nuestra configuracion.
Ahora permisos a los mismos
$> chown nagios.nagios contactgroups.cfg contacts.cfg hostgroups.cfg hosts.cfg services.cfg timeperiods.cfg
Cada uno de los archivos de configuracón que creamos tiene una función determinada. A mencionar:
* **contacts.cfg**\\
Aqui se guardan los usuarios. Será necesario tener un usuario administrador ("skina"), el cual\\
corresponde con el usuario del .htpasswd que le dimos al servidor Apache con anterioridad.\\
* **contactgroups.cfg**\\
Se adicionan los diferentes usuarios que creamos en el archivo contacts.cfg a los grupos que queramos, \\
para después poder filtrar (si nos interesa). Es decir, podemos tener una configuración varios usuarios con\\
diferentes permisos.\\
* **hosts.cfg**\\
Se agregan todos los nodos que queramos monitorizar (máquinas, switch's, impresoras, etc)\\
* **hostgroups.cfg**\\
Aquí se agregan los grupos a los que pertenece cada host. Ejemplo: Podemos tener un grupo de Servidores,\\
otro de Routers, otro de Impresoras. Es de gran ventaja ya que Nagios nos permite realizar no solo informes\\
de estado historicos de cada host, sino tambien de grupos de host. \\
* **services.cfg**\\
Se configuran cada uno de los servicios que queremos que sean monitoreados en cada host.\\
* **timeperiods.cfg**\\
Aqui se configuaran los tiempos de alerta o de chequeo
**Interfaz Web**
**1.** Autentiacion de usuario: Verifique que exista el archivo admin en la siguiente ruta /etc/httpd/conf/users/ y que sea de la siguiente manera
%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%*
skina:cni8GLvftzdNQ
%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%%%**%%*
La instalación de un servidor de Internet de Skina suele incluir un archivo en /etc/httpd/conf.d/nagios.conf donde habilita la interfaz web. Revise que la ruta hacia\\
donde apunta esta línea sea correcta es decir etc/httpd/conf/users/admin (suele esta en /etc/nagios/nagiosusers o algo asi).
**2.** Si el archivo admin no existe Agregue un usuario con la siguiente sentencia:,
$> htpasswd -c /etc/httpd/conf/users/admin skina
Tenga en cuenta este usuario, ya que tiene que usuarlo cuando edite los archivos de configuración.
**3.** Como este es el super-usuario, edite el archivo "cgi.cfg" que se encuentra en /etc/nagios para habilitarlo como super:
> # AUTHENTICATION USAGE\\
> use_authentication=1\\
> \\
> # SYSTEM/PROCESS INFORMATION ACCESS\\
> authorized_for_system_information=skina\\
> \\
> # CONFIGURATION INFORMATION ACCESS\\
> authorized_for_configuration_information=skina\\
> \\
> # SYSTEM/PROCESS COMMAND ACCESS\\
> authorized_for_system_commands=skina\\
> \\
> # GLOBAL HOST/SERVICE VIEW ACCESS\\
> authorized_for_all_services=skina\\
> authorized_for_all_hosts=skina\\
> \\
> # GLOBAL HOST/SERVICE COMMAND ACCESS\\
> authorized_for_all_service_commands=skina\\
> authorized_for_all_host_commands=skina\\
>
Puede poner 10_consejos_para_la_resolucion_de_problemas.html acta_de_constitucion_interna_del_proyecto.html active_directory.html administrar_servidores_con_ipmi.html admin_rpms_con_yum.html albasoftware_libre_de_gestion_educativa.html alta_disponibilidad_de_conexion_a_internet.html ansible_administracion_centralizada_de_servidores.html anti_virusanti_spam_y_hardening_de_correo2024.html anti_virusanti_spam_y_hardening_de_correo.html apache2_mod_security.html apacheservidor_de_www.html aplicativos_usando_ldap.html autoconf.html aws_amazon_ec2.html aws_amazon_lambda.html bacula_backup2024.html bacula_backup.html bandwidthd.html bind_dns.html bonding.html cacti.html cambio_contrasena_ldap_ad_por_web.html cambios_recientes.html caracteres_octal_hexa_unicode_html.html centos_sobre_hyperv.html cfengine.html chumne_administrador_de_licencias.html ciclo_de_pruebas_orfeo.html cluster_con_haproxy.html cluster_ldap.html colaborador_del_mes.html comision_de_proyectos_obsoleto.html como_desplegar_remoto_con_un_tunel_ssh.html como_hacer_manual_de_funciones.html como_instalar_spoon.html como_limpiar_cache_dns.html como_publicar_docs.html como_reportar_spam.html como_se_implementa_orfeo_sgd.html compensatorios_obsoleto.html condiciones_generales_de_contrato_de_soporte_v14.html configuracion_de_tomcat_como_modulo_de_apache.html configuracion_de_x_lite_cliente_sip.html configuracion_pidgin.html configuracion_planta_telefonica_voip.html configurar_redes.html consola_serial.html consul_open_participation_ruby.html controlador_de_dominio_secundario_samba4.html convertir_pdf_a_a_pdf_plano.html copiar_disco_por_la_red.html cpanel.html crack_de_wep_con_aircrack_ng.html creacion_servidor_codema.html creacion_usuario_postgres_solo_para_consultas.html crear_instalador_de_windows_facil_con_nsis.html crear_instancias_de_orfeong.html crear_paquetes_deb_y_rpm.html crear_repositorios_de_paquetes_deb_y_rpm.html cuestionario_de_severidad.html cups.html cygwn.html dd_wrt.html declaracion_de_trabajo_sow.html deploy_instancia_de_orfeo_express_5x_en_amazon.html deploy_instancia_de_orfeo_express_6x_en_amazon.html descargar_pagina_web_recursivo.html deshabilite_ipv6.html dhcp_multiples_vlans.html dhcp_server.html dhcp_y_dns_dinamico.html directrices_de_manejo_de_tiquetes_en_mesa_de_ayuda_glpi.html docker.html documentacion_de_codigo.html documentos_de_implementacion_de_orfeo_5x.html documentos_estandar_control_proyectos_desarrollo.html dotproject.html drbd.html drp_plan_de_recuperacion_de_desastres.html dsl_personalizacion.html egroupware_ex_phpgw.html ejabberd.html elastix.html enigmail.html enlightenment.html entidad_de_certificacion_a_mano.html entidad_de_certificacion.html entidad_de_certificacion_openca.html envio_y_recepcion_de_fax_en_asterisk.html errores_modelos.html esquema_backup_ikatta.html estandar_bitacora.html estandar_comunicaciones_por_correo_electronico.html estandar_de_archivos_y_directorios.html estandar_de_interfaz_para_proyectos_de_desarrollo.html estandar_de_manejo_de_cronograma.html estandar_de_revision_de_documentos.html estandar_de_soporte_y_mantenimiento_de_skinatech.html estandares_de_comunicacion_de_soporte.html estandar_estacion_de_trabajo_gnu_linux.html estandar_estacion_de_trabajo_ms_windows.html estandar_firma_skina.html estandar_para_interfaz_de_proyectos_de_desarrollo.html estandar_para_la_creacion_de_bases_de_dato.html example_howto.html exim_mta.html extraccion_de_texto_de_documentos.html fail2ban.html falla_laboral.html fax_server.html fink.html firewalld.html firewall_skina_howto.html flujo_de_trabajo_de_proyecto.html flujo_de_trabajo_de_proyecto_trello.html formatos_de_documentos_estandares_de_skinatech.html freenas.html freenx.html freetds.html ftpproxy.html generar_diccionarios_de_datos_en_workbench.html getfacl_y_setfacl.html getmenu2.html gforge.html git_flow.html git.html gitlab.html glassfish.html glpi10.html glpi95.html gnokii.html gnupg_gpg.html google_cloud_platform.html graylog_consolidador_de_bitacoras.html grub.html hacer_modelo_y_o_backup.html hardening_de_linux.html hearbeat_cluster.html hipergate.html hispaniola_firewall_ikatta.html horario_de_trabajo.html how_to_enviar_html_imagenes_con_php5.html howto.html howto_mon.html howto_php_nuke.html huawei_e220.html ibm_aix_snmp_setup_for_nagios.html ibm_db2.html ids_logchecklogwatchtripwireaideetc.html ilo2_e_ilo3.html implementacion_de_oauth2_google_en_orfeo_ng.html implementacion_de_oauth2_microsoft_en_orfeo_ng.html implementacion_glpi.html indicadores_de_gestion.html informes_semanales.html informix_apache_php.html infraestructura_de_operacion.html instalacion_asterisk_en_centos_53.html instalacion_asterisk_en_.html instalacion_de_modelo_de_servidor_con_minilinux.html instalacion_de_modelo_de_servidor.html instalacion_de_pqrs_en_orfeo_sgd.html instalacion_ldap_smb_34_en_debian_lenny.html instalacion_minima_appliance.html instalacion_minima.html instalacion_r_server_&_r_shiny.html instalacion_r_server_&_r_shiny_server.html instalacion_splunk.html instalacion_y_configuracion_apachephp_con_db2_y_soporte_con_odbc.html instalacion_y_configuracion_de_sphinx_para_orfeo.html instalacion_y_configuracion_gatekeeper_h323.html instalacion_y_configuracion_lotus_domino.html instalacion_zimbra.html instalar_cancelador_de_eco_hpec_en_asterisk.html instructivo_de_demos_de_skinatech.html instructivo_formato_de_diagnostico.html ipcop_firewall.html ipsec.html ipsec_zeroshell.html iptables.html iscsi.html ispconfig_v1.html ispconfig_v3.html iwatch_inotifywatch_notificar_eventos_en_carpetas.html jmeter.html joomla_cms.html kernel_compilar.html kuine_administracion_de_licencias.html kuine_generacion_de_licencias.html libchart.html licencia_por_calamidad_domestica.html linux_livecd.html lista_de_mejoras.html locale.html lvm.html lvs_linux_virtual_server.html mailman.html mailscanner.html manejo_de_certificados_integracion_pki.html manejo_de_firma_digital_en_php.html manejo_de_la_cuenta_de_correo_de_soporte.html manejo_de_mi_cuenta_de_correo_electronico.html manejo_de_recursos_egroupware_18.html mantis_bug_tracker.html manual_de_funciones_de_agente_de_soporte.html manual_de_funciones_de_consultor_de_tecnologia.html manual_de_telefonos.html manual_de_uso_asterisk.html manual_de_uso_fastrix.html manuales_de_funciones_area_administrativa.html manuales_de_funciones_area_tecnica.html maya_render_farm.html mdadm.html mejorar_rendimiento_libre_office.html metodologia_estandar_de_control_de_proyectos.html metodologia_estandar_de_control_de_proyectos_orfeo.html metodologia_para_desarrollo_de_software.html migracion_bacula_de_5_a_7.html migracion_orfeo_5_a_6.html migrando_samba3_a_samba4.html modelo_appliance.html modelo_de_procedimientos.html modelo_para_howtos.html modelo_para_propuesta.html monit.html montar_bucket_s3_amazon_y_oracle.html montar_orfeo_en_iis.html moodle.html ms_windows_en_linux_wine.html multi_factor_authentication_mfa.html multipath_conexion_con_san.html multiple_versiones_de_php.html multi_router_trafic_grapher_mrtg.html munin_alto_trafico.html munin.html mutliwan_openwrt.html mwan3_en_openwrt.html mysql_cluster_41.html mysql_ha.html mysql_mariadb.html mysql_proxy.html n2n_vpn.html nagios_30.html nagios_nrpe.html si quiere que todos los usuarios autenticados puedan ver la informacion
===== Configuraciones especiales =====
==== 1. Agregar un servicio particular ====
En el archivo commands.cfg se define el comando a ser usado
> ######### by skina\\
> \\
> # 'check_ssh22' command definition\\
> define command{\\
> command_name check_ssh22\\
> command_line $USER1$/check_ssh -H $HOSTADDRESS$ -p 2222\\
> } \\
> \\
> # 'check_mysql' command definition\\
> define command{\\
> command_name check_mysql\\
> command_line $USER1$/check_mysql -H $HOSTADDRESS$\\
> }
Claro, esto supone que los scripts existen en /usr/lib/nagios/plugins.
==== 2. Agregar imagenes al grafico ====
Pongalas en... /usr/share/nagios/images/logos
==== 3. Monitoreo distribuido de Servicios ====
La idea es que haya un servidor nagios central que simplemente recopila la información de otros nagios que realmente hacen la tarea. Esto es bueno para reducir carga de CPU del central y el uso de ancho de banda.
Como los otros servidores pueden estar detras de un firewall que no me va a perrmitir monitoriarlos, se usa chequeo pasivo, o sea los remotos se reportan al central autonomamente.
**En el cliente**
* Solo servicios y servidores que son monitoriadeso por el cliente estan en su configuracion..
* Coloque el valor [[http://nagios.sourceforge.net/docs/3_0/configmain.html#enable_notifications|enable_notifications]] puesto en 0. Esto previene que el cliente envie notificaciones autonomamente.
* Configure [[http://nagios.sourceforge.net/docs/3_0/configmain.html#obsess_over_services|obsess over services]].
* Defina el comando [[http://nagios.sourceforge.net/docs/3_0/configmain.html#ocsp_command|ocsp command]] en submit_check_results que toca definir
Si quiere tambien servidores tiene que agregar
* Configure [[http://nagios.sourceforge.net/docs/3_0/configmain.html#obsess_over_services|obsess over hosts]].
* Defina el comando [[http://nagios.sourceforge.net/docs/3_0/configmain.html#ocsp_command|ochp command]] en submit_hosts_results que toca definir
** En el servidor recolector**
* The central server has its [[http://nagios.sourceforge.net/docs/3_0/configmain.html#enable_notifications|enable_notifications]] directive set to 1. This will enable notifications. (optional, but recommended)
* The central server has [[http://nagios.sourceforge.net/docs/3_0/configmain.html#execute_service_checks|active service checks]] disabled (optional, but recommended - see notes below)
* The central server has [[http://nagios.sourceforge.net/docs/3_0/configmain.html#check_external_commands|external command checks]] enabled (required)
* The central server has [[http://nagios.sourceforge.net/docs/3_0/configmain.html#accept_passive_service_checks|passive service checks]] enabled (required)
*
* OJO .. . quitele las direcciones a los hosts .. . porque si no, el va a tratar de chequearlos igual y/o deshabilite los chequeos activos por la interfaz web.
Para tener en cuenta
* Siga el instructivo, es bastante bueno. Tenga en cuenta los siguientes detalles
* - Toca buscar el server y el cliente de ncsa. Suele ser nagios-ncsa y nagios-ncsa-client
* - Los eventhandlers en (Centos) estan en /usr/lib/nagios/plugins/eventhandlers o mejor $USER1$/eventhandlers
* - Los scripts de envio estan en los anexos
* El server que recoge la informacion tiene que estar el demonio de ncsa corriendo en el puerto 5667
* Defina misma encripcion y misma contraseña para la comunicacion (estamos poniendo encripcion 6)\\
Otros trucos
- Es posible entregarle manualmente un resultado de chequeo pasivo. A veces me ha servido para que el servidor muestre OK.
* http:%%//%%nagios.sourceforge.net/docs/3_0/distributed.html --
* http:%%//%%nagios.sourceforge.net/docs/3_0/passivechecks.html --
* http:%%//%%www.packtpub.com/article/passive-checks-nsca-nagios-service-check-acceptor --
==== 4. Nagios + Algo ====
[[egw/index.php?menuaction=wiki.uiwiki.view&lang=es-es&page=Nagios%2BBacula|Nagios+Bacula]]
[[egw/index.php?menuaction=wiki.uiwiki.view&lang=es-es&page=Nagios%2BSNMP|Nagios+SNMP]]
==== 5. NDOUtils (backend MySQL - MariaDB) ====
Ppara almacenar la información actual e historica en un //backend// de base de datos MySQL - MariaDB. Esta información puede ser utilizado posteriormente para algunos módulos adicionales como Nagviz o para generar informes personalizados de disponibilidad con la información almacenada.
En esencia se debe tener
* Una base de datos creada con usuario y contraseña y sus permisos; y su estrtuctura creada
* El modulo adecuado (2 o 3) copiado en /usr/bin/ndomod.o
* El ejecutable de ndo2db en /usr/local/nagios/bin
* Archivo de configuracion /usr/local/nagios/etc/ndo2db.cfg y ndomod.cfg
* Un servicio init corriendo ndo2db
http:%%//%%nagioswiki.com/wiki/index.php/NDOutils_on_CentOS --
===== Problemas =====
==== 1. Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration. ====
- Pues arranque a mano /usr/bin/nagios -v /etc/nagios/nagios.cfg a ver que problema tiene.
==== 2. La grafica no me muestra nada ====
- verifique cgi.cfg por los permisos para tener acceso a la interfaz grafica.
==== 3. Return code of 127 is out of bounds - plugin may be\tmissing ====
- Verifique que en la ruta /usr/lib/nagios/plugin se encuentre instalado el plugin que esta utilizando
drwxr-xr-x 3 root root 4096 oct 13 15:23 .\\
drwxr-xr-x 4 root root 4096 nov 18 2008 ..\\
-rwxr-xr-x 1 root root 42088 nov 18 2008 check_ping\\
drwxr-xr-x 4 root root 4096 sep 15 10:48 eventhandlers\\
-rwxr-xr-x 1 root root 24284 nov 18 2008 negate\\
-rwxr-xr-x 1 root root 23180 nov 18 2008 urlize\\
-rwxr-xr-x 1 root root 862 nov 18 2008 utils.sh
De lo contrario descargue el paquete
===== Referencias =====
==== 1. Como configurar hosts ====
http:%%//%%nagios.sourceforge.net/docs/3_0/objectdefinitions.html#host
===== Anexos =====
==============================================================\\
/etc/nagios/contacts.cfg\\
==============================================================
################################################################################\\
# CONTACT DEFINITIONS\\
#\\
# don't forget to make sure these point to a real person/alias!\\
#\\
# service_notification_options are w,u,c,r,f,n\\
# w=warning u=unknown c=critical r=recovery f=flapping n=none\\
#\\
# host_notification_options d,u,r,f,n\\
# d=down u=unreachable r=recovery f=flapping n=none\\
################################################################################
\\
define contact{\\
contact_name mmoreno\\
alias Miguel Angel Moreno\\
service_notification_period 24x7\\
host_notification_period 24x7\\
service_notification_options w,u,c,r\\
host_notification_options d,u,r\\
service_notification_commands notify-by-email\\
host_notification_commands host-notify-by-email\\
email mmoreno@skinatech.com\\
}
define contact{\\
contact_name jgomez\\
alias Jaime Gomez\\
service_notification_period 24x7\\
host_notification_period 24x7\\
service_notification_options w,u,c,r\\
host_notification_options d,u,r\\
service_notification_commands notify-by-email\\
host_notification_commands host-notify-by-email\\
email jgomez@skinatech.com\\
}
==============================================================\\
/etc/nagios/contactgroups.cfg\\
==============================================================
> ################################################################################\\
> # CONTACT GROUP DEFINITIONS\\
> #\\
> # SYNTAX:\\
> #\\
> ################################################################################\\
> # 'admins' contact group definitions\\
> define contactgroup{\\
> contactgroup_name admins\\
> alias Administradores del Sistema\\
> members mmoreno, jgomez\\
> }\\
==============================================================\\
/etc/nagios/hosts.cfg\\
==============================================================
> ################################################################################\\
> # HOST DEFINITIONS\\
> #\\
> # SYNTAX:\\
> #\\
> ################################################################################\\
> \\
> \\
> ####################################################################\\
> # SWITCH & ROUTERS\\
> ####################################################################\\
> \\
> define host{\\
> host_name switch\\
> alias Switch Central\\
> }\\
> \\
> define host{\\
> host_name Router-NetGear\\
> alias Router Inalambrico NetGear\\
> address 192.168.8.254\\
> parents switch\\
> check_command check-host-alive\\
> max_check_attempts 20\\
> notification_interval 60\\
> notification_period 24x7\\
> contact_groups admins\\
> notification_options d,u,r\\
> }\\
> \\
> define host{\\
> host_name Router-ETB\\
> alias Router GreatSpeed ETB\\
> parents Router-NetGear\\
> }\\
> define host{\\
> host_name Router-TELECOM\\
> alias Router HUAWEI TELECOM\\
> address 192.168.8.253\\
> parents Router-NetGear\\
> check_command check-host-alive\\
> max_check_attempts 20\\
> notification_interval 60\\
> notification_period 24x7\\
> contact_groups admins\\
> notification_options d,u,r\\
> }\\
> \\
> ####################################################################\\
> # SERVIDORES\\
> ####################################################################\\
> \\
> define host{\\
> host_name babylon\\
> alias Babylon Servidor de Escritorios\\
> address 192.168.8.200\\
> parents switch\\
> check_command check-host-alive\\
> max_check_attempts 20\\
> notification_interval 60\\
> notification_period 24x7\\
> contact_groups admins\\
> notification_options d,u,r\\
> }\\
> \\
> define host{\\
> host_name ska\\
> alias Ska Servidor de Impresion\\
> address 192.168.8.201\\
> parents switch\\
> check_command check-host-alive\\
> max_check_attempts 20\\
> notification_interval 60\\
> notification_period 24x7\\
> contact_groups admins\\
> notification_options d,u,r\\
> }\\
> \\
> \\
> define host{\\
> host_name zion\\
> alias Zion Servidor de Archivos\\
> address 192.168.8.205\\
> parents switch\\
> check_command check-host-alive\\
> max_check_attempts 20\\
> notification_interval 60\\
> notification_period 24x7\\
> contact_groups admins\\
> notification_options d,u,r\\
> }\\
> ####################################################################\\
> # WORKSTATIONS\\
> ####################################################################\\
> \\
> define host{\\
> host_name creole\\
> alias Workstation de Contabilidad\\
> address 192.168.8.207\\
> parents switch\\
> check_command check-host-alive\\
> max_check_attempts 20\\
> notification_interval 60\\
> notification_period 24x7\\
> contact_groups admins\\
> notification_options d,u,r\\
> }\\
> \\
> \\
> define host{\\
> host_name shai-hulud\\
> alias Portatil Compaq Comercial\\
> address 192.168.8.213\\
> parents switch\\
> check_command check-host-alive\\
> max_check_attempts 20\\
> notification_interval 60\\
> notification_period 24x7\\
> contact_groups admins\\
> notification_options d,u,r\\
> }\\
>
==============================================================\\
/etc/nagios/hostgroups.cfg\\
==============================================================
> ################################################################################\\
> # HOST GROUP DEFINITIONS\\
> #\\
> # SYNTAX:\\
> #\\
> ################################################################################\\
> define hostgroup{\\
> hostgroup_name routers\\
> alias Routers and Gateways\\
> members switch, Router-NetGear, Router-ETB, Router-TELECOM\\
> }\\
> \\
> define hostgroup{\\
> hostgroup_name servers\\
> alias Servers\\
> members babylon,zion,ska\\
> }\\
> \\
> define hostgroup{\\
> hostgroup_name workstations\\
> alias Workstations\\
> members creole,shai-hulud\\
> }\\
==============================================================\\
/etc/nagios/services.cfg\\
==============================================================
> ################################################################################\\
> # SERVICE DEFINITIONS\\
> #\\
> # SYNTAX:\\
> #\\
> ################################################################################\\
> \\
> \\
> ################################################################################\\
> # PING\\
> ################################################################################\\
> \\
> define service{\\
> host_name Router-ETB, Router-TELECOM, ska, babylon,zion, creole, shai-hulud\\
> service_description PING\\
> is_volatile 0\\
> check_period 24x7\\
> max_check_attempts 3\\
> normal_check_interval 5\\
> retry_check_interval 1\\
> contact_groups admins\\
> notification_interval 240\\
> notification_period 24x7\\
> notification_options c,r\\
> check_command check_ping!100.0,20%!500.0,60%\\
> }\\
> \\
> ################################################################################\\
> # DNS\\
> ################################################################################\\
> \\
> define service{\\
> host_name babylon, Router-ETB, Router-TELECOM\\
> service_description DNS Service\\
> is_volatile 0\\
> check_period 24x7\\
> max_check_attempts 4\\
> normal_check_interval 5\\
> retry_check_interval 2\\
> contact_groups admins\\
> notification_interval 120\\
> notification_period 24x7\\
> notification_options w,u,c,r\\
> check_command check_dns\\
> }\\
> \\
> \\
> ################################################################################\\
> # SMTP\\
> ################################################################################\\
> \\
> define service{\\
> host_name zion\\
> service_description SMTP Service\\
> is_volatile 0\\
> check_period 24x7\\
> max_check_attempts 4\\
> normal_check_interval 5\\
> retry_check_interval 2\\
> contact_groups admins\\
> notification_interval 120\\
> notification_period 24x7\\
> notification_options w,u,c,r\\
> check_command check_smtp\\
> }\\
==============================================================\\
/etc/nagios/timeperiods.cfg\\
==============================================================
> ################################################################################\\
> # TIMEPERIOD DEFINITIONS\\
> #\\
> # SYNTAX:\\
> #\\
> ################################################################################\\
> \\
> # '24x7' timeperiod definition\\
> define timeperiod{\\
> timeperiod_name 24x7\\
> alias 24 Hours A Day, 7 Days A Week\\
> sunday 00:00-24:00\\
> monday 00:00-24:00\\
> tuesday 00:00-24:00\\
> wednesday 00:00-24:00\\
> thursday 00:00-24:00\\
> friday 00:00-24:00\\
> saturday 00:00-24:00\\
> }\\
> \\
> # 'workhours' timeperiod definition\\
> define timeperiod{\\
> timeperiod_name workhours\\
> alias "Normal" Working Hours\\
> monday 08:00-17:00\\
> tuesday 08:00-17:00\\
> wednesday 08:00-17:00\\
> thursday 08:00-17:00\\
> friday 08:00-17:00\\
> }\\
> \\
> # 'nonworkhours' timeperiod definition\\
> define timeperiod{\\
> timeperiod_name nonworkhours\\
> alias Non-Work Hours\\
> sunday 00:00-24:00\\
> monday 00:00-09:00,17:00-24:00\\
> tuesday 00:00-09:00,17:00-24:00\\
> wednesday 00:00-09:00,17:00-24:00\\
> thursday 00:00-09:00,17:00-24:00\\
> friday 00:00-09:00,17:00-24:00\\
> saturday 00:00-24:00\\
> }
==============================================================\\
commands .. necesario\\
==============================================================
define command{ command_name submit_check_result command_line $USER1$/eventhandlers/submit_check_result $HOSTNAME$ '$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$' }define command{ command_name submit_hosts_result command_line $USER1$/eventhandlers/submit_host_result $HOSTNAME$ $HOSTSTATE$ '$HOSTOUTPUT$' }
==============================================================\\
/usr/lib/nagios/plugins/eventhandlers/submit_check_result\\
==============================================================
#!/bin/sh# Arguments:# $1 = host_name (Short name of host that the service is# associated with)# $2 = svc_description (Description of the service)# $3 = state_string (A string representing the status of# the given service - "OK", "WARNING", "CRITICAL"# or "UNKNOWN")# $4 = plugin_output (A text string that should be used# as the plugin output for the service checks)## Convert the state string to the corresponding return codecentral_server="localhost"return_code=-1CLOCK=`date +%s`case "$3" in OK) return_code=0 ;; WARNING) return_code=1 ;; CRITICAL) return_code=2 ;; UNKNOWN) return_code=-1 ;;esac# pipe the service check info into the send_nsca program, which# in turn transmits the data to the nsca daemon on the central# monitoring serverecho "[$CLOCK] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$return_code;$4" | /usr/sbin/send_nsca -H $central_server -c /usr/local/nagios-skina/etc/send_nsca.cfg
==============================================================\\
/usr/lib/nagios/plugins/eventhandlers/submit_host_result\\
==============================================================
#!/bin/sh# Arguments:# $1 = host_name (Short name of host that the service is# associated with)# $2 = svc_description (Description of the service)# $3 = state_string (A string representing the status of# the given service - "OK", "WARNING", "CRITICAL"# or "UNKNOWN")# $4 = plugin_output (A text string that should be used# as the plugin output for the service checks)## Convert the state string to the corresponding return codecentral_server="localhost"CLOCK=`date +%s`return_code=-1case "$2" in OK) return_code=0 ;; UP) return_code=0 ;; DOWN) return_code=1 ;; UNREACHABLE) return_code=2 ;; UNKNOWN) return_code=-1 ;;esac# pipe the service check info into the send_nsca program, which# in turn transmits the data to the nsca daemon on the central# monitoring serverecho "[$CLOCK] PROCESS_HOST_CHECK_RESULT;$1;$return_code;$3" | /usr/sbin/send_nsca -H $central_server -c /usr/local/nagios-skina/etc/send_nsca.cfg
==============================================================
FIN
==============================================================
Primera version Wiki Miguel Angel Moreno 2007-07-07
Segunda versión Wiki Isabel Rodriguez, Carolina Gutierrez y Sandra Cruz 2009-10-13
----
__**Advertencia**__
Este documento es privado y es de uso exclusivo de sus autores y de SKINA TECH. Cualquier uso sin una autorización escrita es contra le ley de derechos de autor y de propiedad intelectual, y será motivo de una acción legal.
----