Continuando con la publicación anterior instalar cinga2 en debian wheezy ahora les indico como monitorear nuestros servidores remotos utilizando el nuevo método desarrollado por Icinga el cual supone mejoras de seguridad frene a NRPE, aunque este último aun se puede utilizar.
Lo primero es utilizar el asistente para crear los certificados. Ten en cuenta que debes contestar que no (n) a la primera pregunta puesto que estamos configurando el nodo central.
root@master ~# icinga2 node wizard
Welcome to the Icinga 2 Setup
Wizard!
We'll guide you through all required configuration details.
Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: n
Welcome to the Icinga 2 Setup
Wizard!
We'll guide you through all required configuration details.
Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: n
Ya creado el certificado del master podemos crear las claves para realizar la conexión de los satelites ó nodos a monitorear, el primero en este caso es otro servidor debian wheezy (satelite1.localdomain) y el segundo será un servidor Windows Server 2008 R2 (satelite2.localdomain). Creo que es obvio que debes cambiar estos nombres por los FQDN de tus servidores
root@master ~# icinga2 pki ticket --cn 'satelite1.localdomain'
10b849e68cd01572c86003f88c0bcaa21877c4a1
10b849e68cd01572c86003f88c0bcaa21877c4a1
Servidor Linux
En el servidor a monitorear "satelite1.localdomain" debemos hacer una instalación básica de icinga2, recuerda que con este tipo de instalación lo que se quiere es que el servidor corra todos los chequeos internamente y luego pase el resultado de estos al nodo principal, para ello hacemos lo siguiente:
root@satelite1 ~# echo "deb http://debmon.org/debmon debmon-wheezy main" > /etc/apt/sources.list.d/wheezy-debmon.list
~# wget -O - http://debmon.org/debmon/repo.key 2>/dev/null | apt-key add - OK
~# wget -O - http://debmon.org/debmon/repo.key 2>/dev/null | apt-key add - OK
root@satelite1 ~# echo "deb http://http.debian.net/debian wheezy-backports main" > /etc/apt/sources.list.d/wheezy-backports.list
root@satelite1 ~# apt-get update
root@satelite1 ~# apt-get install icinga2 nagios-plugins
root@satelite1 ~# icinga2 feature enable command
root@satelite1 ~# service icinga2 restart
root@satelite1 ~# icinga2 feature enable command
root@satelite1 ~# service icinga2 restart
Si quieres más detalles del proceso de instalación revisa instalar cinga2 en debian wheezy
Ya con icinga2 instalado procedemos a correr el wizard para configurar la conexión con el master, esta vez contestamos que si a la primera pregunta (Y) y respondemos las preguntas del asistente, a continuación un ejemplo:
root@satelite1 ~# icinga2 node wizard
Welcome to the Icinga 2 Setup Wizard!
We'll guide you through all required configuration details.
Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]:
Starting the Node setup routine...
Please specifiy the common name (CN) [satelite1.localdomain]: satelite1.localdomain
Please specifiy the local zone name [satelite1.localdomain]:
Please specify the master endpoint(s) this node should connect to:
Master Common Name (CN from your master setup): master.localdomain
Do you want to establish a connection to the master from this node? [Y/n]: Y
Please fill out the master connection information:
Master endpoint host (Your master's IP address or FQDN): 192.168.0.13
Master endpoint port [5665]:
Add more master endpoints? [y/N]:
Please specify the master connection for CSR auto-signing (defaults to master endpoint host):
Host [192.168.0.13]:
Port [5665]:
information/base: Writing private key to '/etc/icinga2/pki/satelite1.localdomain.key'.
information/base: Writing X509 certificate to '/etc/icinga2/pki/satelite1.localdomain.crt'.
information/cli: Generating self-signed certifiate:
information/cli: Fetching public certificate from master (192.168.0.13, 5665):
information/cli: Created backup file '/etc/icinga2/pki/trusted-master.crt.orig'.
information/cli: Writing trusted certificate to file '/etc/icinga2/pki/trusted-master.crt'.
information/cli: Stored trusted master certificate in '/etc/icinga2/pki/trusted-master.crt'.
Please specify the request ticket generated on your Icinga 2 master.
(Hint: # icinga2 pki ticket --cn 'satelite1.localdomain'): 10b849e68cd01572c86003f88c0bcaa21877c4a1
information/cli: Processing self-signed certificate request. Ticket '10b849e68cd01572c86003f88c0bcaa21877c4a1'.
information/cli: Created backup file '/etc/icinga2/pki/satelite1.localdomain.crt.orig'.
information/cli: Writing signed certificate to file '/etc/icinga2/pki/satelite1.localdomain.crt'.
information/cli: Writing CA certificate to file '/etc/icinga2/pki/ca.crt'.
Please specify the API bind host/port (optional):
Bind Host []:
Bind Port []:
Accept config from master? [y/N]: y
Accept commands from master? [y/N]: y
information/cli: Disabling the Notification feature.
Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Enabling the Apilistener feature.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Created backup file '/etc/icinga2/features-available/api.conf.orig'.
information/cli: Generating local zones.conf.
information/cli: Dumping config items to file '/etc/icinga2/zones.conf'.
information/cli: Created backup file '/etc/icinga2/zones.conf.orig'.
information/cli: Updating constants.conf.
information/cli: Created backup file '/etc/icinga2/constants.conf.orig'.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
Done.
Now restart your Icinga 2 daemon to finish the installation!
Welcome to the Icinga 2 Setup Wizard!
We'll guide you through all required configuration details.
Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]:
Starting the Node setup routine...
Please specifiy the common name (CN) [satelite1.localdomain]: satelite1.localdomain
Please specifiy the local zone name [satelite1.localdomain]:
Please specify the master endpoint(s) this node should connect to:
Master Common Name (CN from your master setup): master.localdomain
Do you want to establish a connection to the master from this node? [Y/n]: Y
Please fill out the master connection information:
Master endpoint host (Your master's IP address or FQDN): 192.168.0.13
Master endpoint port [5665]:
Add more master endpoints? [y/N]:
Please specify the master connection for CSR auto-signing (defaults to master endpoint host):
Host [192.168.0.13]:
Port [5665]:
information/base: Writing private key to '/etc/icinga2/pki/satelite1.localdomain.key'.
information/base: Writing X509 certificate to '/etc/icinga2/pki/satelite1.localdomain.crt'.
information/cli: Generating self-signed certifiate:
information/cli: Fetching public certificate from master (192.168.0.13, 5665):
information/cli: Created backup file '/etc/icinga2/pki/trusted-master.crt.orig'.
information/cli: Writing trusted certificate to file '/etc/icinga2/pki/trusted-master.crt'.
information/cli: Stored trusted master certificate in '/etc/icinga2/pki/trusted-master.crt'.
Please specify the request ticket generated on your Icinga 2 master.
(Hint: # icinga2 pki ticket --cn 'satelite1.localdomain'): 10b849e68cd01572c86003f88c0bcaa21877c4a1
information/cli: Processing self-signed certificate request. Ticket '10b849e68cd01572c86003f88c0bcaa21877c4a1'.
information/cli: Created backup file '/etc/icinga2/pki/satelite1.localdomain.crt.orig'.
information/cli: Writing signed certificate to file '/etc/icinga2/pki/satelite1.localdomain.crt'.
information/cli: Writing CA certificate to file '/etc/icinga2/pki/ca.crt'.
Please specify the API bind host/port (optional):
Bind Host []:
Bind Port []:
Accept config from master? [y/N]: y
Accept commands from master? [y/N]: y
information/cli: Disabling the Notification feature.
Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Enabling the Apilistener feature.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Created backup file '/etc/icinga2/features-available/api.conf.orig'.
information/cli: Generating local zones.conf.
information/cli: Dumping config items to file '/etc/icinga2/zones.conf'.
information/cli: Created backup file '/etc/icinga2/zones.conf.orig'.
information/cli: Updating constants.conf.
information/cli: Created backup file '/etc/icinga2/constants.conf.orig'.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
Done.
Now restart your Icinga 2 daemon to finish the installation!
Con esto ya tenemos configurado el nodo, solo falta reiniciar el servicio
root@satelite1 ~# service icinga2 restart
Ahora nos conectamos al servidor principal "master" y actualizamos nuestra configuración para que se muestre el nuevo host
root@master ~# icinga2 node update-config
root@master ~# service icinga2 reload
root@master ~# service icinga2 reload
Listo, ya nos podemos dirigir a nuestra interfaz web del servidor master y podremos observar el nuevo host
Servidor Windows
Lo primero que debemos hacer es descargar el agente para Windows desde http://packages.icinga.org/windows/ ten en cuenta que debes tener instalado .NET Framework 2.0
El proceso de instalación es como el de cualquier paquete de Windows, es decir.. siguiente, siguiente, siguiente
Una vez instalado configuramos lo siguiente
Luego nos conectamos al servidor master y actualizamos nuestra configuración
root@master ~# icinga2 node update-config
root@master ~# service icinga2 reload
root@master ~# service icinga2 reload
Hasta acá el ejemplo de monitorización con el uso de agentes, como mencione en una entrada anterior en la pagina de Icinga encuentras información más detallada del proceso así como otras formas de configurar los agentes sin utilizar el wizard.
Comentarios