Diferencia entre revisiones de «Usuario:ManuelRomero/proyecto/proyectoIternova/Servicios»
De WikiEducator
Línea 58: | Línea 58: | ||
apt.cfg disk.cfg ftp.cfg load.cfg news.cfg ping.cfg real.cfg tcp_udp.cfg users.cfg | apt.cfg disk.cfg ftp.cfg load.cfg news.cfg ping.cfg real.cfg tcp_udp.cfg users.cfg | ||
dhcp.cfg dummy.cfg http.cfg mail.cfg ntp.cfg procs.cfg ssh.cfg telnet.cfg | dhcp.cfg dummy.cfg http.cfg mail.cfg ntp.cfg procs.cfg ssh.cfg telnet.cfg | ||
+ | </source> | ||
+ | ===Ficheros de configuración del nagios === | ||
+ | /etc/nagios3/connf.d/servicios.cfg | ||
+ | <source lang=bash> | ||
+ | define service{ | ||
+ | use generic-service ; Name of service template to use | ||
+ | host_name 5c43117b78e8 ;hay que poner cada host a monitorizar | ||
+ | service_description SSH | ||
+ | check_command check_ssh | ||
+ | notifications_enabled 0 | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service ; Name of service template to use | ||
+ | host_name 5c43117b78e8 | ||
+ | service_description HTTP | ||
+ | check_command check_http | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service ; Name of service template to use | ||
+ | |||
+ | host_name 5c43117b78e8 | ||
+ | service_description MYSQL | ||
+ | check_command check_mysql | ||
+ | notifications_enabled 0 | ||
+ | } | ||
+ | define service{ | ||
+ | use generic-service ; Name of service template to use | ||
+ | host_name 5c43117b78e8 | ||
+ | service_description Disk | ||
+ | check_command check_disk | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | define service{ | ||
+ | use generic-service ; Name of service template to use | ||
+ | host_name 5c43117b78e8 | ||
+ | service_description Load | ||
+ | check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service ; Name of service template to use | ||
+ | host_name 5c43117b78e8 | ||
+ | service_description PING | ||
+ | check_command check_ping!100.0,20%!500.0,60% | ||
+ | } | ||
+ | define service{ | ||
+ | use generic-service ; Name of service template to use | ||
+ | |||
+ | host_name 5c43117b78e8 | ||
+ | service_description Process | ||
+ | check_command check_procs | ||
+ | notifications_enabled 0 | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
</source> | </source> |
Última revisión de 21:30 5 jun 2017
1.- en Monitorizacion_Constants
- Defino como constantes cada servicio a monitorizar
- En este caso tengo los siguientes
//Tipos de Servicios a monitorizar const SERVICIO_UNDEFINED = -1; //Servicio no definido const SERVICIO_SSH = 1; //SSH ssh.cfg const SERVICIO_HTTP = 2; //Servicio http HTTP const SERVICIO_MYSQL = 3; //Servicio uso mysql Mysql const SERVICIO_DISCOS = 4; // Current_load Disk const SERVICIO_CPU = 5; //Servicio uso de cpu Load const SERVICIO_PING = 6; //PING const SERVICIO_PROCESS = 7; //Procesos check_total_process
2.- En el servidor Nagios he de tener configurado los equipos que voy a monitorizar así como los servicios que quiero. En la siguiente carpeta
- En /etc/nagios3/conf.d# tengo los siguientes ficheros
contacts_nagios2.cfg generic-service_nagios2.cfg services_nagios2.cfg extinfo_nagios2.cfg host_monitorizar.cfg servicios.cfg generic-host_nagios2.cfg hostgroups_nagios2.cfg timeperiods_nagios2.cfg
- Importante observar el fichero host_monitorizar.cfg (host que quiero monitorizar) y servicios.cfg (Los serivicios a monitorizar).
3.- Los servicios que tenemos disponibles para monitorizar los disponemos en el servidor nagios
/usr/lib/nagios/plugins# ls check_apt check_icmp check_nntps check_smtp check_breeze check_ide_smart check_nrpe check_snmp check_by_ssh check_ifoperstatus check_nt check_spop check_clamd check_ifstatus check_ntp check_ssh check_cluster check_imap check_ntp_peer check_ssmtp check_dbi check_ircd check_ntp_time check_swap check_dhcp check_jabber check_nwstat check_tcp check_dig check_ldap check_oracle check_time check_disk check_ldaps check_overcr check_udp check_disk_smb check_load check_pgsql check_ups check_dns check_log check_ping check_users check_dummy check_mailq check_pop check_wave check_file_age check_mrtg check_procs negate check_flexlm check_mrtgtraf check_real urlize check_ftp check_mysql check_rpc utils.pm check_host check_mysql_query check_rta_multi utils.sh check_hpjd check_nagios check_sensors check_http check_nntp check_simap
- Aquí seleccionaríamos los servicios que queremos monitorizar
- Por otro lado, aquí una url dónde poder monitorizar todo
https://www.monitoring-plugins.org/doc/man/
2.- En el equipo que esté monitorizando ese servicio comprobar el script o configuración correspondiente
en /etc/nagios-plugin/config tendrá que haber un cfg por servicio
ls
apt.cfg disk.cfg ftp.cfg load.cfg news.cfg ping.cfg real.cfg tcp_udp.cfg users.cfg
dhcp.cfg dummy.cfg http.cfg mail.cfg ntp.cfg procs.cfg ssh.cfg telnet.cfg
Ficheros de configuración del nagios
/etc/nagios3/connf.d/servicios.cfg
define service{ use generic-service ; Name of service template to use host_name 5c43117b78e8 ;hay que poner cada host a monitorizar service_description SSH check_command check_ssh notifications_enabled 0 } define service{ use generic-service ; Name of service template to use host_name 5c43117b78e8 service_description HTTP check_command check_http } define service{ use generic-service ; Name of service template to use host_name 5c43117b78e8 service_description MYSQL check_command check_mysql notifications_enabled 0 } define service{ use generic-service ; Name of service template to use host_name 5c43117b78e8 service_description Disk check_command check_disk } define service{ use generic-service ; Name of service template to use host_name 5c43117b78e8 service_description Load check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 } define service{ use generic-service ; Name of service template to use host_name 5c43117b78e8 service_description PING check_command check_ping!100.0,20%!500.0,60% } define service{ use generic-service ; Name of service template to use host_name 5c43117b78e8 service_description Process check_command check_procs notifications_enabled 0 }