INSTALACIÓN DE NAGIOS 2.7 EN DEBIAN ETCH, PARTE 1
Este tutorial esta basado en la documentación oficial de nagios, y algunas tutoriales en español que hay en Internet, escribo este post, por que queria comentar mi experiencia con este espectacular programa que lo recomiendo un montón!
Nagios® es un software de monitorización de redes y sistemas, con licencia GPL. Nagios observa servidores y servicios de red específicos, alertándote cuando las cosas van mal y cuando están bien.
Para correr Nagios junto con sus plugins, solo es necesario tener un sistema operativo (de preferencia Linux :D ) con un servidor web, un compilador de C y la librería gd versión 1.6.3 o superior.
INSTALANDO NAGIOS
Este tutorial esta basado en debian etch que a la fecha es testing, intente instalarlo con apt-get install … pero la configuración por defecto no me funciono, tal vez por que el etch aun esta en testing, además me obligaba a usar el paquete exim4, y en el servidor de pruebas tengo qmail y esto me ocasionaría un conflicto. Entonces explicaré como instalar desde los fuentes.
De la página oficial de nagios:
http://www.nagios.org/download/
Descargamos la ultima versión ( a la fecha 2.7 ), en este caso nagios-2.7.tar.gz , y el paquete de plugins, en este caso la versión nagios-plugins-1.4.5.tar.gz (ya esta disponible la versión de plugins 1.4.6, pero me dio un error de compilación, entonces no la use)
Primero creamos los usuarios y grupos necesarios (www-data es el usuario en que corre apache en debian, en otras distribuciones puede variar)
adduser nagios
groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd www-data
Creamos el directorio donde instalaremos nagios
mkdir /usr/local/nagios
Cambiamos de usuario y grupo el directorio recién creado
chown nagios:nagios -R /usr/local/nagios/
En el directorio donde este descargado nagios, lo descomprimimos
tar zxvf nagios-2.7.tar.gz
Luego ingresamos al directorio
cd nagios-2.7
Una vez en el directorio, ejecutamos
./configure – -prefix=/usr/local/nagios – -with-cgiurl=/nagios/cgi-bin – -with-htmurl=/nagios/ – -with-nagios-user=nagios – -with-nagios-group=nagios – -with-command-group=nagcmd
Si el configure no nos informa ningún error compilamos
make all
Instalamos…
make install
Creamos un script de inicialización en /etc/init.d/
make install-init
Ahora configuración del script creado para que se ejecute siempre al arranque (update-rc.d es el comando en debian para configurar servicios al arranque, en otras distribuciones puede variar)
update-rc.d nagios defaults
Configuramos permisos de algunos directorios
make install-commandmode
Instalamos algunas configuraciones de ejemplo, atención a este paso, por que nos basaremos en estos archivos para crear los nuestros
make install-config
Creamos enlaces simbólicos de binarios para nuestro sistema
ln -s /usr/local/nagios/bin/nagios /usr/sbin/nagios
ln -s /usr/local/nagios/bin/nagiostats /usr/sbin/nagiostats
Ahora instalaremos los plugins
Descomprimimos el paquete
tar zxvf nagios-plugins-1.4.5.tar.gz
cd nagios-plugins-1.4.5
Ejecutamos el script de configuración
./configure – -prefix=/usr/local/nagios – -with-cgiurl=/nagios/cgi-bin
Si el configure no nos informa ningún error compilamos
make
Instalamos…
make install
make install-root
Si hemos llegado a este punto sin problemas, crearemos la interfaz web de nagios
En el caso de ejemplo (debian etch) editaremos el archivo de configuración por default de apache2
/etc/apache2/sites-available/default
Al final agregamos
ScriptAlias /nagios/cgi-bin «/usr/local/nagios/sbin»
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName «Nagios Access»
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios «/usr/local/nagios/share»
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName «Nagios Access»
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Ahora creamos el archivo con el password para el usuario
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Reiniciamos apache
/etc/init.d/apache2 restart
Ahora podremos comprobar si funciona apuntando con un navegador a nuestro servidor. Ejemplo
http://192.168.0.66/nagios
Debe aparecer en pantalla la típica ventana de autenticación de apache. Nos autenticamos y debemos ingresar a un panel de administración web, en hora buena!
CONFIGURANDO NAGIOS
Empieza lo interesante, vamos a configurar nagios!!!
En este caso crearé un entorno para mi empresa y algunos clientes como ejercicio. Monte el servidor nagios en un portátil abandonado, un PIII, con 128Mb de RAM, en el que ya tenia instalado apache2 con Debian etch, el portátil se conecta a Internet con el ADSL de mi apartamento, desde acá supervisaré los servidores de Tecsua los cuales son un firewall y dos servidores web y de correo. También supervisaré dos clientes específicos, uno consta de un router y un firewall, y el segundo cliente nada más supervisaremos un servidor de aplicaciones que solo esta encendido en horarios de oficina. Figura 1
Espero os sirva de base para sus configuraciones especificas.
Figura 1
Pero antes de eso veamos como se «ordena» esto en el sistema Nagios.
Deben crearse los «contactos», que son las personas a las que se les debe notificar cualquier cosa que este configurada en nagios. Estos contactos deben clasificarse en «grupos», que como su nombre lo indica, establece características en común para esos «contactos».
En mi ejemplo, tenemos tres contactos, los clasificados en dos grupos llamados admin y tehcnical, Figura 2
1 – nagiosadmin, es el administrador general, hace parte del grupo «admin»
2 – supervisor, un supuesto supervisor general, hace parte del grupo «admin»
3 – technical_1, un supuesto técnico de soporte, hace parte del grupo «technical»
Figura 2
Ahora debemos crear «hosts» (entiéndase por host a un servidor, un router, etc), y estos hosts también deben clasificarse en grupos con características en común
En mi ejemplo, tenemos 7 hosts clasificados en dos grupos llamados tecsuaservers y tecsuaclients, Figura 3
1 – tecsua_router, router de acceso a internet de las oficinas de tecsua, obviamente hace parte del grupo tecsuaservers
2 – firewall_tecsua, firewall general en las oficinas de tecsua, grupo tecsuaservers
3 – tecsua_server_1, servidor web y de en las correo oficinas de tecsua, grupo tecsuaservers
4 – tecsua_server_2, servidor web y de correo de un cliente en las oficinas de tecsua, grupo tecsuaservers
5 – c1_router, router de acceso a internet de un cliente especifico c1, grupo tecsuaclients
6 – firewall_c1, es el firewall general de el cliente especifico c1, grupo tecsuaclients
7 – appserver_c2, es el servidor de aplicaciones de un cliente especifico c2, el cual solo esta encendido en horarios de oficina, grupo tecsuaclients
Figura 3
Y por ultimo, debemos crear «servicios», que pueden ser de cualquier tipo (ping, smtp, http, etc), y estos servicios deben estar asociados a un host.
En mi ejemplo son 12 servicios,
- host & services
- appserver_c2 HTTP, PING
- c1_router PING
- firewall_c1 PING
- firewall_tecsua PING
- tecsua_router PING
- tecsua_server_1 HTTP, PING, SMTP
- tecsua_server_2 HTTP, PING, SMTP
Una vez tenemos claro el escenario, (para esto recomiendo hacer un mapa como los anteriores) solo es codificar esto en los archivos de configuración.
Cuando ejecutamos en la instalación el comando make install-config, este nos creo unos archivos base en /usr/local/nagios/etc. El archivo de configuración principal es:
nagios.cfg, el cual trae toda una serie de configuraciones por defecto que aplican bien para la mayoría de los casos.
También nos creo el archivo localhost.cfg, el cual viene preconfigurado para supervisar el sistema local, es muy útil estudiar este archivo, trae ejemplos muy explicativos, pero en mi caso y como generalmente se hace, fraccioné este archivo el varios archivos sueltos, para que sea mas cómodo configurar las cosas. A continuación explico las pequeñas modificaciones a algunos archivos y muestro en pantalla los archivos creados sueltos, los cuales pueden crear con su editor favorito dentro de carpeta de configuración de nagios.
1 – En el archivo nagios.cfg
a – Buscar la linea que apunta al archivo de ejemplo localhost.cfg y comentarla para que no use ese archivo
# Host and service definitions for monitoring this machine
# cfg_file=/usr/local/nagios/etc/localhost.cfg
b – Descomentar las lineas que apuntan a varios archivos de configuración, estos son los que vamos a crear si no existen
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
#cfg_file=/usr/local/nagios/etc/dependencies.cfg
#cfg_file=/usr/local/nagios/etc/escalations.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg
2 – En el archivo cgi.cfg
a – Buscar la linea use_authentication que esta establecida por defecto a 1, y configurarla a 0, sin autenticación, esto es NO recomendado, pero por ser la parte 1 del manual no nos complicaremos tanto, en la parte 2 hablaremos al detalle de la autenticación.
use_authentication=0
b – Al final del archivo des comentar las alarmas sonoras si las queremos usar, estar se ejecutarán en el cliente.
host_unreachable_sound=hostdown.wav
host_down_sound=hostdown.wav
service_critical_sound=critical.wav
service_warning_sound=warning.wav
service_unknown_sound=warning.wav
normal_sound=noproblem.wav
3 – Ahora creamos los archivos de configuración, aclaro nuevamente que este es para mi ejemplo, podéis ajustar estos archivos a tus necesidades. (cambiar xxx.xxx.xxx.xxx por sus direcciones IP)
A – contactgroups.cfg
define contactgroup{
contactgroup_name admin
alias Nagios Administrators
members nagiosadmin,supervisor
}
define contactgroup{
contactgroup_name technical
alias Network Technicals
members technical_1
}
B – contacts.cfg
define contact{
contact_name nagiosadmin
alias Nagios Administrator
service_notification_period 24×7
host_notification_period 24×7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email jose.cely@xxxxx.xxx
}
define contact{
contact_name supervisor
alias Network Supervisor
service_notification_period 24×7
host_notification_period 24×7
service_notification_options u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email linus@xxxxx.xxx
}
define contact{
contact_name technical_1
alias Techical One
service_notification_period 24×7
host_notification_period 24×7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email alam.brito@xxxxx.xxx
}
C – hosts.cfg
# Generic host definition template – This is NOT a real host, just a template!
define host{
name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24×7 ; Send host notifications at any time
register 0 ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL HOST, JUST A TEMPLATE!
}
define host{
use generic-host ; Name of host template to use
host_name tecsua_router
alias Router SAGEM ADSL
address xxx.xxx.xxx.xxx
check_command check-host-alive
max_check_attempts 20
contact_groups admin
notification_interval 60
notification_period 24×7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name firewall_tecsua
alias Firewall Tecsua
address xxx.xxx.xxx.xxx
parents tecsua_router
check_command check-host-alive
max_check_attempts 10
contact_groups admin
notification_interval 120
notification_period 24×7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name tecsua_server_1
alias www.tecsua.com
address xxx.xxx.xxx.xxx
parents firewall_tecsua
check_command check-host-alive
max_check_attempts 10
contact_groups admin
notification_interval 120
notification_period 24×7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name tecsua_server_2
alias www.xxxxxx.com.co
address xxx.xxx.xxx.xxx
parents firewall_tecsua
check_command check-host-alive
max_check_attempts 10
contact_groups admin
notification_interval 120
notification_period 24×7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name c1_router
alias Router Coquito ADSL
address xxx.xxx.xxx.xxx
check_command check-host-alive
max_check_attempts 20
contact_groups admin
notification_interval 60
notification_period 24×7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name firewall_c1
alias Firewall xxxxxxxxx
address xxx.xxx.xxx.xxx
parents c1_router
check_command check-host-alive
max_check_attempts 10
contact_groups admin
notification_interval 120
notification_period 24×7
notification_options d,u,r
}
define host{
use generic-host ; Name of host template to use
host_name appserver_c2
alias Aplication Server xxxxx
address xxx.xxx.xxx.xxx
check_command check-host-alive
max_check_attempts 10
contact_groups admin
notification_interval 120
notification_period workhours
notification_options d,u,r
}
D – hostgroups.cfg
define hostgroup{
hostgroup_name tecsuaservers
alias Tecsua Servers
members firewall_tecsua, tecsua_router, tecsua_server_1, tecsua_server_2
}
define hostgroup{
hostgroup_name tecsuaclients
alias Tecsua Clients
members c1_router, firewall_c1, appserver_c2
}
E – services.cfg
# Generic service definition template – This is NOT a real service, just a template!
define service{
name generic-service ; The ‘name’ of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service ‘freshness’
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
register 0 ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
define service{
# use generic-service ; Name of service template to use
host_name tecsua_router
service_description PING
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 240
notification_period 24×7
notification_options c,r
check_command check_ping!100.0,20%!500.0,60%
}
define service{
# use generic-service ; Name of service template to use
host_name c1_router
service_description PING
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical
notification_interval 240
notification_period 24×7
notification_options c,r
check_command check_ping!100.0,20%!500.0,60%
}
define service{
# use generic-service ; Name of service template to us
host_name tecsua_server_1
service_description HTTP
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 120
notification_period 24×7
notification_options w,u,c,r
check_command check_http
}
define service{
# use generic-service ; Name of service template to us
host_name tecsua_server_2
service_description HTTP
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 120
notification_period 24×7
notification_options w,u,c,r
check_command check_http
}
define service{
# use generic-service ; Name of service template to us
host_name appserver_c2
service_description HTTP
is_volatile 0
check_period workhours
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical
notification_interval 120
notification_period workhours
notification_options w,u,c,r
check_command check_http
}
define service{
# use generic-service ; Name of service template to us
host_name tecsua_server_1
service_description SMTP
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 120
notification_period 24×7
notification_options w,u,c,r
check_command check_smtp
}
define service{
# use generic-service ; Name of service template to us
host_name tecsua_server_2
service_description SMTP
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 120
notification_period 24×7
notification_options w,u,c,r
check_command check_smtp
}
define service{ # use generic-service ; Name of service template to us
host_name firewall_tecsua
service_description PING
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 120
notification_period 24×7
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
}
define service{ # use generic-service ; Name of service template to us
host_name firewall_c1
service_description PING
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical
notification_interval 120
notification_period 24×7
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
}
define service{ # use generic-service ; Name of service template to us
host_name appserver_c2
service_description PING
is_volatile 0
check_period workhours
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical
notification_interval 120
notification_period workhours
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
}
define service{ # use generic-service ; Name of service template to us
host_name tecsua_server_1
service_description PING
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 120
notification_period workhours
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
}
define service{ # use generic-service ; Name of service template to us
host_name tecsua_server_2
service_description PING
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups technical,admin
notification_interval 120
notification_period workhours
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
}
F – timeperiods.cfg
# This defines a timeperiod where all times are valid for checks,
# notifications, etc. The classic «24×7» support nightmare. : – )
define timeperiod{
timeperiod_name 24×7
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 09:00-18:00
tuesday 09:00-18:00
wednesday 09:00-18:00
thursday 09:00-18:00
friday 09:00-18:00
saturday 10:00-13:00
}
# ‘nonworkhours’ timeperiod definition
define timeperiod{
timeperiod_name nonworkhours
alias Non-Work Hours
sunday 00:00-24:00
monday 00:00-09:00,18:00-24:00
tuesday 00:00-09:00,18:00-24:00
wednesday 00:00-09:00,18:00-24:00
thursday 00:00-09:00,18:00-24:00
friday 00:00-09:00,18:00-24:00
saturday 00:00-10:00,13:00-24:00
}
# ‘none’ timeperiod definition
define timeperiod{
timeperiod_name none
alias No Time Is A Good Time
}
Con estos archivos base podremos inicializar nagios por primera vez, pero siempre después de cualquier configuración podemos correr una verificación de los archivos de configuración, antes de iniciar, para eso esta la bandera -v en el comando nagios, la cual verifica la sintaxis y correctas relaciones/asignaciones.
Corremos la verificación
nagios -v /usr/local/nagios/etc/nagios.cfg
Que en mi ejemplo al final me de dio esta salida:
Total Warnings: 0
Total Errors: 0
Things look okay – No serious problems were detected during the pre-flight check
Todo figura OK, en algunas configuraciones puede que nos muestre algún warning, pero estos no son tan trascendentales.
Ahora iniciaremos nagios por primera vez!.
/etc/init.d/nagios start
Podemos comprobar que el procesa esta en ejecución con
ps -A|grep nagios
Que en mi caso me muestra esta salida
4883 ? 00:00:00 nagios
En hora buena, ahora podemos acceder vía web a nagios, si la configuración de apache fue correcta deberíamos poder acceder vía web, en mi caso abro un navegador y apunto a mi servidor
http://192.168.0.66/nagios
Nos pedirá nombre de usuario y contraseña (los anteriormente creados), una vez logeados, podremos ver nuestros servidores y servicios, si es le primera vez que inicia nagios, debemos esperar unos minutos para que nagios ejecute sus comandos de supervisión configurados y de esta forma poder empezar a ver resultados en pantalla, Nagios tiene una interfaz web muy intuitiva que no explicaré en este articulo, ya es cuestión de vosotros profundizar. A continuación algunas capturas de pantalla:
![]() |
– | ![]() |
– | ![]() |
– | ![]() |
Esto es todo por esta primera parte, si este tutorial tiene buena acogida escribiré la parte 2, explicando los mapas 2D y 3D, alarmas sonoras, integración con RRDTools, etc!
Links:
Nagios
http://nagios.org
How to no oficial en Español
http://nagios.linuxbaja.org
37 Responses so far
silveestre
febrero 26th, 2007
9:12 am
Muy bueno su artículo, trabaja un tema de vanzada….
Creo que es un gran aporte para las ISP, además que para los que no comprendemos claramente el lenguaje, debes ampliar la funcionalidad de nagios.
Felicitaciones……
Diego Andrade
febrero 27th, 2007
3:03 pm
Pues debo admitir que la ignorancia es atrevida, por un momento pense que Nagios era la nueva marca creada por frito Lay, para complementar a Doritos. Pero resulta que Nagios no es comestible, pero si es un sistema de monitoreo de redes, para sistemas GNU/Linux. me caeria de perlas en el ISP, ahora si estoy entendiendo que debian es La créme de la créme.
Creo que usted sigue dando pasos de gigante, mientras yo me dedico a descargar, llegara el momento de estar en el camino indicado.
Sayonara José
Jose A. Cely Saidiza
marzo 6th, 2007
3:26 pm
Recibí un mail de Ethan Galstad, el desarrollador principal de Nagios :D !
De: Ethan Galstad
Para: Jose Antonio Cely
Asunto: Re: I wrote a tutorial for installation and configuration for nagios 2.7
Fecha: Mon, 05 Mar 2007 09:22:49 -0600 (10:22 COT)
Hi Jose –
Thanks for doing this! I just added a link to your tutorial on the new
NagiosCommunity.org wiki at:
http://www.nagioscommunity.org/wiki/index.php/Howtos:specific
Thanks again and take care.
Jose Antonio Cely wrote:
> I wrote a tutorial for installation and configuration for nagios 2.7 in debian etch, with samples and graphs
>
> http://josecely.tecsua.com/?p=31
>
> My company
>
> http://www.tecsua.com
—
Ethan Galstad,
Nagios Developer
—
Email: nagios@nagios.org
Website: http://www.nagios.org
Felipe Casanova
marzo 7th, 2007
10:31 pm
Felicitaciones Jose !!!
Excelente tutorial en español y muy completo. Me sirvio bastante ya que va al grano con las configuraciones y esta bien ordenado. Sigue adelante con la segunda parte.
Muchas Gracias !!
mario franco
abril 17th, 2007
10:49 am
Hola,
Muy bueno el articulo, pero tengo un roblema al momento de reiniciar el servidor Apache 2, me sale el siguiente error:
Forcing reload of web server (apache2)…Syntax error on line 53 of /etc/apache2/sites-enabled/000-default:
AllowOverride not allowed here
failed!
Si alguien me puede ayudar se lo agradeceria muchisimo
Jose A. Cely Saidiza
abril 17th, 2007
4:12 pm
Hola Mario
Deberías copiar el archivo completo para poder cual es la linea 53, pero estoy un 99% seguro que debe ser un simple error de sintaxis o te falta algún paquete de apache.
Salu2
Roberto
mayo 21st, 2007
9:28 pm
Hola Jose, la verdad muy buen manual, justo lo que andaba buscando, para utilizar en mi trabajo, la verdad he avanzado muy poco ya que me salio un error al igual q mario, seguro es de configuracion del apache, por lo q si no es mucho molestia hechale un ojo a la configuracion del archivo.
vim /etc/apache2/sites-available/default
NameVirtualHost *
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
Options FollowSymLinks
AllowOverride None
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2’s default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ «/usr/share/doc/»
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
ScriptAlias /nagios/cgi-bin “/usr/local/nagios/sbin”
# SSLRequireSSL
Options ExecCGI
#AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios “/usr/local/nagios/share”
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName “Nagios Access”
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
al momento de reiniciar el servidor sale el siguiente mensaje:
laptop-home:/etc/init.d$ apache2 -k restart
Syntax error on line 53 of /etc/apache2/sites-enabled/000-default:
AllowOverride not allowed here
httpd not running, trying to start
laptop-home:/etc/init.d$
taffer
junio 1st, 2007
10:41 am
Realmente útil, y perfectamente usable para poner un nagios en marcha «out of the box», como dicen por ahí. Muchas gracias por compartirlo !
Diego
junio 6th, 2007
8:41 am
Excelente Tutorial!!
Referido al tema del apache, te cuento que la ruta
\
Diego
junio 6th, 2007
8:50 am
Maldito teclado!! mis disculpas, al muy maldito se le trabo la tecla de backspace y me borro gran parte del post jejej aqui va de nuevo:
Excelente Tutorial!!
Referido al tema del apache, te cuento que la ruta
/etc/apache2/sites-available/default es la que contiene la definicion de los virtual hosts para apache2. La sintaxis que planteas esta bien, pero deberia ir entre las directivas . Vamos al grano, les paso como me quedo a mi:
NameVirtualHost *
.
.
.
ScriptAlias /nagios/cgi-bin «/usr/local/nagios/sbin»
# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName «Nagios Access»
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios «/usr/local/nagios/share»
# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName «Nagios Access»
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
.
.
.
Bueno, espero les sirva.
Saludos desde Argentina!!
miguel
julio 4th, 2007
8:57 am
hola Jose, soy principiante en linux, instale nagios con tu manual, pero tengo un error porque no encuentra Status map y Trends, esto es lo que sale:
Not Found
The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server.
————————————————————————————–
Apache/2.2.3 (Debian) PHP/5.2.0-8+etch4 Server at 10.xx.xx.xxx Port 80
_________________________________________________________________
_________________________________________________________________
Not Found
The requested URL /nagios/cgi-bin/trends.cgi was not found on this server.
—————————————————————————————
Apache/2.2.3 (Debian) PHP/5.2.0-8+etch4 Server at 10.xx.xx.xxx Port 80
ya tengo mucho tiempo buscando que es lo que falta, me han dicho que don librerias que faltan, ojala puedas ayudarme, y si puedes porfavor explicamelo paso a paso
gerardo ramirez
agosto 7th, 2007
1:25 pm
tono,
amigo.
te quiero dar las gracias por este medio por tu orientacion, este documento nos ha servido para la instalacion de nuestro nagios el cual nos permite controlar dia a dia, minuto a minuto la operacion del instituto nacional de cancerologia.
espero que tus aportes a la comunidad sigan siendo utiles, sige documentando que muchos los requerimos.
salu2
gerardo Ramirez
octavio
agosto 26th, 2007
8:31 pm
saludos desde mexico, hola amigo estoy muy interesado en implementar nagios en mi trabajo ya que tengo , varios equipos a monitorear, aquimi problema es que los equipos utilizanmipdinamicas y no se como hacer para que nagios siga a cada equipo en cunato cambie de ip, agradeceria tu ayuda.
muchas gracias.
que buen manual para la comunidad.!!
mantrax…
darwin
septiembre 11th, 2007
11:10 am
hola ya he venido monitoreando mi nagios pero despues de unos meses me sale lo siguiente en el var/log/messages y no he podido volver a iniciar mi nagios y no he podido dar con la respuesta si pudieras colaborarme te lo agradeceria
Sep 11 09:56:33 redes nagios: Nagios 3.0a4 starting… (PID=24339)
Sep 11 09:56:33 redes nagios: LOG VERSION: 2.0
Sep 11 09:56:33 redes nagios: Finished daemonizing… (New PID=24340)
Sep 11 09:56:33 redes kernel: audit(1189522593.298:58): avc: denied { read append } for pid=24346 comm=\
Jose A. Cely Saidiza
septiembre 11th, 2007
11:49 am
Para Darwin
Creo que por acá esta la solución a tu problema
http://web.mit.edu/rhel-doc/4/RH-DOCS/rhel-rg-es-4/ch-selinux.html
Salu2
joelrob
octubre 15th, 2007
10:00 am
Quisiera saber si estaria de acuerdo si traduzco esta guia de espanol a ingles. No he pudido encontrar ninguna guia que existe en ingles por Debian Etch, todos estan escritos por versiones mas viejo de Debian. Por supuest le daria reconocimiento como autor original.
Jose A. Cely Saidiza
octubre 29th, 2007
3:46 pm
Para joelrob
Claro que sip, además todos los contenidos estan licenciados bajo Creative Commons, tambien te puedo enviar los archivos .dia de las imágenes (que son muy simples, pero pueden servir).
Estamos en contacto en jose_punto_cely_ARRObA_gmail_punto_com.
Salu2
RMM
noviembre 13th, 2007
12:25 pm
Muy buen manual Toño, excelente.
Estoy implantando Nagios y para ello me he apoyado en tu manual, pero una vez que edito /ect/apache2/sites-available/ default y reinicio apache, me da el siguiente error:
apache2: Syntax error on line 189 of etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/httpd.conf: No such file or directory
Me estoy volviendo loco para slucionar el dichoso error, lo he intentado desinstalando e instalando de nuevo el apache, he revisado que no haya ningun error en la sintaxis, he eliminado la linea, la he modificado, he renombrado el fichero…. y no doy con ello, por favor necesito ayuda que estoy desesperado.
Gracias y un saludo a todos.
dcreatorx
diciembre 3rd, 2007
8:53 am
Toño se a olvidad de meter el código para el virtualhost entre un
. A mi también me pasó. No obstante, felicidades por el tutorial está muy conseguido. A ver si haces la parte 2 sobre los comandos externos y las notificaciones ! Hasta luego !
hernan diaz
febrero 7th, 2008
3:54 pm
hermano muy buen manual pero estoy mas interesado en la segunda parte que piensas hacer donde tengo unos pequeños problemillas, si ya lo tienes por favor te agradeceria un monton me lo enviaras a mi correo gracias!!
Masilva
febrero 19th, 2008
1:11 pm
Tremendo tutorial… ahora lo que frena a implementarlo y si trabajara sin problemas en ubuntu 6.06…. por favor alguien que me indique si lo puedo implementar alli tranquilamente
Francisco
abril 3rd, 2008
11:32 am
muy buen manual, me saco de varios errores que tenia, pero a la hora de verificar la configuracion me manda un error:
Error in configuration file \\\’/usr/local/nagios/etc/nagios.cfg\\\’ – Line 73 (UNKNOWN VARIABLE)
lo cheque junto con el manual que proporciona nagios y esta bien:
object_cache_file=/usr/local/nagios/var/objects.cache
si me pudieras ayudar te lo agradeceria
EVELYN
abril 9th, 2008
3:27 pm
NECESITO AYUDA CON NAGIOS 2.10 EN TIMEPERIODS.CFG
cuando restauro me da el error
Timeperiod ’24×7′ has already been defined
Error: Could not register timeperiod (config file ‘/etc/nagios2/timeperiods.cfg’, starting on line 5)
en el fichero timeperiods.cfg
tengo esto:
define timeperiod{
timeperiod_name workhours
alias Standard Work Hours
monday 09:00-17:00
tuesday 09:00-17:00
wednesday 09:00-17:00
thursday 09:00-17:00
friday 09:00-17:00
}
define timeperiod{
timeperiod_name 24×7
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
}
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
}
# This one is a favorite: never :)
define timeperiod{
timeperiod_name never
alias Never
}
# end of file
jenny adriana
junio 25th, 2008
12:41 pm
Necesito ayudaaa, no he podido pasar las imagenes a formato .gd2, cuando instalo la libreria me sale error en el fichero que permiso denegado.
gracias
Arich.net
junio 30th, 2008
3:20 am
No encuentro varios CGI que son:
– statusmap.cgi
– trends.cgi
– histogram.cgi
Alguien sabe donde o en que complementos están.
Estoy utilizando Nagios 3.0.2
juanra
octubre 22nd, 2008
2:45 am
Hola tengo un pequeño problemilla con nagios version 3.0.3, lo tengo instalado sobre red hat, y siempre que he visto este sistema de mo0nitoraje lo he visto sobre plataformas de ubuntu, opensuse y fedora puede venir ahi el fallo
Zigor A. Eiguren
diciembre 3rd, 2008
9:46 am
Para Arich.net:
Es posible que lo hayas solucionado ya,… pero por si acaso.
El problema es que la librería gd2 instala sus librerías en /usr/local/lib, pero nagios en esos tres CGIs, lo busca en /usr/lib (de hecho si haces un tail -F /var/log/apache2/error.log, verás que cuando pinchas en uno de esos te dice que tiene un problema con la librería libgd.so.2, algo así como:
[Wed Dec 03 11:23:42 2008] [error] [client 128.0.0.120] Premature end of script headers: trends.cgi, referer: http://128.0.0.206/nagios/side.html
/usr/local/nagios/sbin/histogram.cgi: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory.
La solución:
ln -s /usr/local/lib/libgd.so.2 /usr/lib/libgd.so.2.
Por cierto,… yo estoy utilizando Nagios 3.0.3 sobre una máquina virtual en OpenVZ que tiene Debian Etch.
Saludos.
Pablo Angel
febrero 3rd, 2009
1:16 am
Primero muchas gracias por compartir este manual pero tengo un problema el nagios solo me funciona con la direccion localhost o con 127.0.0.1 y no con la IP de la LAN y la verdad no soy experto ni en nagios ni en linux agradezco tu ayuda y tiempo
Erick
marzo 26th, 2009
10:34 am
para quienes aun tienen problemas al reiniciar apache y les aparece este error
AllowOverride not allowed here
acá les entrego la solucion saludos
ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName «Nagios Access»
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Alias /nagios /usr/local/nagios/share
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName «Nagios Access»
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
Erick
marzo 26th, 2009
10:37 am
para quienes aun tienen problemas al reiniciar apache y les aparece este error
AllowOverride not allowed here
saben mejor vean la documentacion del sitio oficial nagios.org de ese documento saque el script perono puedo pegarlo aca
saludos
Bernardo Duran
mayo 28th, 2009
2:24 pm
Hola… Instale el Nagios en Centos 5.3 y me ha corrido muy bien. Pero tengo que configurar las Alarmas y Notificaciones no se si me podrias ayudar con eso… Muchas gracias
Giovanni
junio 5th, 2009
10:49 am
Erick exactamente de que parte del documento hablas cuando dices -saben mejor vean la documentacion del sitio oficial nagios.org de ese documento saque el script perono puedo pegarlo aca- ??
Gracias
jaime
enero 25th, 2010
4:09 pm
hola amigo, tu tutorial es muy bueno, sabes tengo un problemilla, pasa q no tengo el archivo statusmap.cfg, y no puedo ver el mapa, como deberia crear este archivo???
te agradezco desde ya
saludos
Luinux
abril 6th, 2010
11:54 am
Yo lo resolví compilando nuevamente el nagios con el nagios-plugins, al hacer esto, practicamente no pierde el config de los archivos ya existentes, pues los guarda con un identificador para luego reemplazarlos.
Utilizando Exim4 en Debian para enviar mensajes a través de Gmail — « Tips and tips
noviembre 4th, 2010
11:04 pm
[…] que nuestros scripts en php envíen email, o aplicaciones que hacen uso intensivo de correo (Ej. Nagios, Asterisk, Gforge, etc). Además, tienes el registro de email enviados, bien sea con los logs, o en […]
Ruth
diciembre 9th, 2010
5:42 am
hola Jose
Instale nagios sobre Debian Lenny, pero tengo unos errores no encuentra Statusmap ni Trends, esto es lo que sale:
Not Found
The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server.
Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_perl/2.0.4 Perl/v5.10.0 Server at 192.xxx.xxx.xxx Port 80_________________________________________________________________
Not Found
The requested URL /nagios/cgi-bin/trends.cgi was not found on this server.
Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_perl/2.0.4 Perl/v5.10.0 Server at 192.xxx.xxx.xxx Port 80
He visto que trends.c y statusmaps.c no estan compilados
-rw-rw-r– 1 nagios nagios 93190 jul 3 2009 trends.c
-rw-rw-r– 1 nagios nagios 91076 jul 8 2009 statusmap.c
Pero todo lo demas si lo he compilado con la siguiente instruccion y me sale lo siguiente:
statusmap.c:60: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
statusmap.c:61: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
statusmap.c:221: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
statusmap.c: In function ‘main’:
statusmap.c:276: error: ‘READ_ALL_STATUS_DATA’ undeclared (first use in this function)
statusmap.c:276: error: (Each undeclared identifier is reported only once
statusmap.c:276: error: for each function it appears in.)
statusmap.c: In function ‘draw_host_links’:
statusmap.c:1439: error: ‘hoststatus’ undeclared (first use in this function)
statusmap.c:1439: error: ‘this_hoststatus’ undeclared (first use in this function)
statusmap.c:1440: error: ‘parent_hoststatus’ undeclared (first use in this function)
statusmap.c:1479: error: ‘HOST_DOWN’ undeclared (first use in this function)
statusmap.c:1479: error: ‘HOST_UNREACHABLE’ undeclared (first use in this function)
statusmap.c: In function ‘draw_hosts’:
statusmap.c:1575: error: ‘hoststatus’ undeclared (first use in this function)
statusmap.c:1575: error: ‘temp_hoststatus’ undeclared (first use in this function)
statusmap.c:1659: error: ‘HOST_DOWN’ undeclared (first use in this function)
statusmap.c:1661: error: ‘HOST_UNREACHABLE’ undeclared (first use in this function)
statusmap.c:1663: error: ‘HOST_UP’ undeclared (first use in this function)
statusmap.c:1665: error: ‘HOST_PENDING’ undeclared (first use in this function)
statusmap.c: In function ‘draw_host_text’:
statusmap.c:1854: error: ‘hoststatus’ undeclared (first use in this function)
statusmap.c:1854: error: ‘temp_hoststatus’ undeclared (first use in this function)
statusmap.c:1874: error: ‘HOST_DOWN’ undeclared (first use in this function)
statusmap.c:1878: error: ‘HOST_UNREACHABLE’ undeclared (first use in this function)
statusmap.c:1882: error: ‘HOST_UP’ undeclared (first use in this function)
statusmap.c:1886: error: ‘HOST_PENDING’ undeclared (first use in this function)
statusmap.c: In function ‘write_host_popup_text’:
statusmap.c:1907: error: ‘hoststatus’ undeclared (first use in this function)
statusmap.c:1907: error: ‘temp_status’ undeclared (first use in this function)
statusmap.c:1957: error: ‘HOST_DOWN’ undeclared (first use in this function)
statusmap.c:1964: error: ‘HOST_UNREACHABLE’ undeclared (first use in this function)
statusmap.c:1971: error: ‘HOST_UP’ undeclared (first use in this function)
statusmap.c:1974: error: ‘HOST_PENDING’ undeclared (first use in this function)
statusmap.c:2012: error: ‘SERVICE_OK’ undeclared (first use in this function)
statusmap.c:2015: error: ‘SERVICE_CRITICAL’ undeclared (first use in this function)
statusmap.c:2018: error: ‘SERVICE_WARNING’ undeclared (first use in this function)
statusmap.c:2021: error: ‘SERVICE_UNKNOWN’ undeclared (first use in this function)
statusmap.c:2024: error: ‘SERVICE_PENDING’ undeclared (first use in this function)
statusmap.c: In function ‘draw_circular_layer_markup’:
statusmap.c:2741: error: ‘hoststatus’ undeclared (first use in this function)
statusmap.c:2741: error: ‘temp_hoststatus’ undeclared (first use in this function)
statusmap.c:2835: error: ‘HOST_DOWN’ undeclared (first use in this function)
statusmap.c:2835: error: ‘HOST_UNREACHABLE’ undeclared (first use in this function)
El mismo error me sale en trends.c
¿Sabes como lo podria solucionar?
Muchas gracias por adelantado.
Un saludo.
Jegrys
mayo 19th, 2011
10:57 am
Hola buenos dias quisiera saber si este manual se puede aplicar para nagios 3?
Leave a comment