informatica:linux:nagios
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| informatica:linux:nagios [2009/11/16 21:27] – 192.168.1.30 | informatica:linux:nagios [2015/04/13 20:19] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| nagios nagios3 monitorizacion smp http | nagios nagios3 monitorizacion smp http | ||
| + | |||
| Line 7: | Line 8: | ||
| ====== Nagios ====== | ====== Nagios ====== | ||
| - | nagios monitorizacion nagios3 | + | nagios monitorizacion nagios3 |
| + | |||
| + | http:// | ||
| Es una herramienta de monitorización tanto de recursos privados | Es una herramienta de monitorización tanto de recursos privados | ||
| + | |||
| ===== Instalación ===== | ===== Instalación ===== | ||
| - | aptitude update && aptitude install nagios3 | + | |
| + | |||
| ===== Objetos ===== | ===== Objetos ===== | ||
| + | |||
| + | http:// | ||
| ^ Nombre ^ Descripción ^ Ubicación (1) ^ | ^ Nombre ^ Descripción ^ Ubicación (1) ^ | ||
| Line 34: | Line 42: | ||
| cfg_dir=/ | cfg_dir=/ | ||
| + | |||
| + | **IMPORTANTE** | ||
| + | |||
| + | 1. Se pueden crear subdirectorios en / | ||
| + | |||
| + | 2. Todos los archivos de configuración tienen que acabar en .cfg | ||
| ===== Anfitrión ===== | ===== Anfitrión ===== | ||
| Line 39: | Line 53: | ||
| Por ejemplo creamos el siguiente archivo: | Por ejemplo creamos el siguiente archivo: | ||
| - | | + | |
| Con el siguiente contenido: | Con el siguiente contenido: | ||
| Line 50: | Line 64: | ||
| address maquina1.mine.nu ; | address maquina1.mine.nu ; | ||
| } | } | ||
| + | </ | ||
| Grabamos y salimos. | Grabamos y salimos. | ||
| - | |||
| - | |||
| - | </ | ||
| ===== Contacto ===== | ===== Contacto ===== | ||
| Line 145: | Line 157: | ||
| - | ===== Monitorizar los servicios locales de una máquina remote: NRPE ===== | ||
| - | **EN CONSTRUCCIÓN** | ||
| - | nagios nrpe | ||
| - | nagios.sourceforge.net/ | ||
| - | 1. En la máquina remota: | ||
| - | aptitude update && aptitude install nagios xinetd nagios-nrpe-server netstat nagios-nrpe-plugin | ||
| - | | ||
| - | 2. Configurar NRPE para que corra bajo xinetd | ||
| - | 2.1 Crear: | ||
| - | nano / | ||
| - | Con el siguiente contenido: | ||
| - | < | + | ===== Monitorizar los servicios locales de una máquina remote: NRPE ===== |
| - | service nrpe | + | |
| - | { | + | |
| - | flags = REUSE | + | |
| - | socket_type | + | |
| - | wait = no | + | |
| - | user = nagios | + | |
| - | server | + | |
| - | server_args | + | |
| - | log_on_failure += USERID | + | |
| - | disable | + | |
| - | # Ip de la máquina donde corre nagios | + | |
| - | only_from | + | |
| - | } | + | |
| - | </ | + | |
| - | 2.2 Grabar y salir | + | http:// |
| - | 2.3 Editar: | + | 1. En la maquina local (la que tiene instalada nagios): |
| - | nano / | + | Instalar nrpe-plugin: |
| - | Y añadir la siguiente linea: | + | sudo aptitude update && sudo aptitude install nagios-nrpe-plugin |
| - | nrpe 5666/tcp # NRPE | + | Echarle un ojo a este archivoÑ |
| - | 2.4 Grabar y salir | + | / |
| - | 2.5 Comprobar de si nrpe está corriendo como demonio: | + | Reiniciar el servicio: |
| - | | + | |
| - | 22573 ? Ss 0:00 / | + | |
| - | Si es así, matar el proceso: | + | 2. En la máquina remota: |
| - | kill -9 22573 | + | Instalar nrpe (y plugins): |
| - | 2.6 Arranco xinetd: | + | sudo aptitude update && sudo aptitude install nagios-nrpe-server nagios-plugins |
| - | / | + | Crear archivo de configuración: |
| - | 2.7 Comprobar que el servicio nrpe está corriendo bajo xinetd: | + | sudo vim / |
| - | netstat -at | grep nrpe | + | Con el siguiente contenido: |
| - | tcp 0 0 *: | + | < |
| - | + | allowed_hosts=monitor.jj.com | |
| - | **ERRORES** | + | command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 10 -c 1 |
| - | + | </code> | |
| - | * **Error: NRPE daemon cannot be run as user/group root!** | + | |
| - | + | ||
| - | Hemos reiniciado xinetd: | + | |
| - | + | ||
| - | /etc/init.d/xinetd restart | + | |
| - | + | ||
| - | Y hemos intentado arrancar a mano nrpe como un servicio bajo xinetd: | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| - | Vemos que no arranca el servicio: | + | |
| - | + | ||
| - | ps ax | grep nrpe | + | |
| - | + | ||
| - | Y vemos el log de sistema: | + | |
| - | + | ||
| - | clear && cat / | + | |
| - | + | ||
| - | **Solución**: | + | |
| - | + | ||
| - | 1. Asegurarnos que en el archivo: | + | |
| - | + | ||
| - | nano /etc/ | + | |
| - | + | ||
| - | Existe la siguiente directiva: | + | |
| - | + | ||
| - | user = nagios | + | |
| - | + | ||
| - | Y que, lógicamente, | + | |
| - | + | ||
| - | 2. Reiniciar xinetd: | + | |
| - | /etc/init.d/xinetd restart | + | En este caso habilitamos el comando ' |
| - | | + | **RECOMENDADO**: También lo podemos hacer editando: |
| - | No arranca el servicio nrpe porque el puerto (ver el puerto asociado a ' | + | sudo vim /etc/nagios/ |
| - | lsof -ni :5666 | + | Reiniciar el servicio: |
| - | | + | /etc/init.d/nagios-nrpe-server restart |
| - | nrpe 2478 nagios | + | |
| - | **Solución** | + | 3. Probarlo. Desde la máquina local: |
| - | 1. Matar el proceso | + | Para probar |
| - | | + | |
| - | 2. Reiniciar xinetd: | + | Para probar el comando antes habilitado: |
| - | /etc/init.d/xinetd restart | + | /usr/lib/nagios/ |
| ===== Ejemplo: comprobar si una máquina está levantada ===== | ===== Ejemplo: comprobar si una máquina está levantada ===== | ||
| Line 577: | Line 531: | ||
| PROCS CRITICAL: 0 processes with command name noexiste | PROCS CRITICAL: 0 processes with command name noexiste | ||
| + | |||
| ===== Ejemplo: comprobar si una partición está llena ===== | ===== Ejemplo: comprobar si una partición está llena ===== | ||
| Line 658: | Line 613: | ||
| DISK CRITICAL - free space: / 4510 MB (72% inode=88%): | DISK CRITICAL - free space: / 4510 MB (72% inode=88%): | ||
| </ | </ | ||
| + | |||
| + | ===== Configurar interfaz web ===== | ||
| + | |||
| + | |||
| + | Queremos acceder a nagios desde una interfaz gráfica. Para ello instalamos apache2 en la misma máquina: | ||
| + | |||
| + | 1. Instalar apache2 | ||
| + | |||
| + | sudo aptitude install apache2 -R | ||
| + | |||
| + | 2. Crear un usuario: | ||
| + | |||
| + | sudo htpasswd / | ||
| + | |||
| + | Teclear dos veces la contraseña | ||
| + | |||
| + | 3. Crear el siguiente archivo: | ||
| + | |||
| + | sudo vim / | ||
| + | |||
| + | Con el siguiente contenido: | ||
| + | |||
| + | < | ||
| + | |||
| + | ScriptAlias / | ||
| + | ScriptAlias / | ||
| + | |||
| + | # Where the stylesheets (config files) reside | ||
| + | Alias / | ||
| + | |||
| + | # Where the HTML pages live | ||
| + | Alias /nagios3 / | ||
| + | |||
| + | < | ||
| + | Options FollowSymLinks | ||
| + | |||
| + | DirectoryIndex index.php | ||
| + | |||
| + | AllowOverride AuthConfig | ||
| + | Order Allow,Deny | ||
| + | Allow From All | ||
| + | |||
| + | AuthName " | ||
| + | AuthType Basic | ||
| + | AuthUserFile / | ||
| + | require valid-user | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| + | 4. Recargar la configuración de apache: | ||
| + | |||
| + | sudo apache2ctl reload | ||
| + | |||
| + | 5. Probar: | ||
| + | |||
| + | http:// | ||
informatica/linux/nagios.1258406861.txt.gz · Last modified: (external edit)
