Nagios Centreon sobre CentOS 6.4

Versión de Centreon:  centreon-2.4.4.tar.gz

Versión de nagios: Nagios 3.2.3

Versión de Centos: 6.4 x64

El contenido de este post, completa algunos de los errores que hemos encontrado al seguir esta estupenda guía:

http://www.thesysadminhimself.com/2013/02/installing-centreon-24-on-centos-63-x64-part-2.html

Aún así, debemos advertiros que no es fácil hacer funcionar centreon sobre una versión de Centos superior a 5. Animamos al equipo de centreon, con la versión 2.5 a la vuelta de la esquina, para que ya suban de versión de Centos.

Fichero de respuestas para install:

Basándonos en el fichero que propone thesysadminhimself, hemos hecho nuestro propio archivo, con las rutas propias para Centreon 2.4.4 sobre Centos 6.4

Aún así, nos ha hecho dos preguntas, una sobre RRDs.pm y otra sobre PEAR.php, pero ha sido mucho más fácil de instalar.


## CentWeb: Web front Centreon for Nagios
PROCESS_CENTREON_WWW=1
## CentStorage: Log and charts archiving.
PROCESS_CENTSTORAGE=1
## CentCore: Distributed Monitoring engine.
PROCESS_CENTCORE=1
## CentPlugins: Centreon Plugins for nagios
PROCESS_CENTREON_PLUGINS=1
## CentTraps: Centreon Snmp traps process for nagios
PROCESS_CENTREON_SNMP_TRAPS=1

#####################################################################
## Begin: Default variables
#####################################################################
## Your default variables
## $BASE_DIR is the centreon source directory
LOG_DIR=”$BASE_DIR/log”
LOG_FILE=”$LOG_DIR/install_centreon.log”

## Don’t change values above unless you perfectly understand
## what you are doing.
## Centreon temporary directory to work
TMP_DIR=”/tmp/centreon-setup”
## default snmp config directory
SNMP_ETC=”/etc/snmp/”
## a list of pear modules require by Centreon
PEAR_MODULES_LIST=”pear.lst”
#####################################################################
## End: Default variables
##################################################################

#####################################################################
## Begin: Centreon preferences
#####################################################################
## Above variables are necessary to run a silent install
## Where you want to install Centreon (Centreon root directory)
INSTALL_DIR_CENTREON=”/usr/local/centreon”
## Centreon log files directory
CENTREON_LOG=”/usr/local/centreon/log”
## Centreon config files
CENTREON_ETC=”/etc/centreon”
## Where is your Centreon binaries directory ?
CENTREON_BINDIR=”/usr/local/centreon/bin”
## Where is your Centreon data informations directory ?
CENTREON_DATADIR=”/usr/local/centreon/data”
## Centreon generation config directory
##  filesGeneration and filesUpload
## Where is your Centreon generation_files directory ?
CENTREON_GENDIR=”/usr/local/centreon”
## libraries temporary files directory
## Where is your Centreon variable library directory ?
CENTREON_VARLIB=”/var/lib/centreon”
## Where is your CentPlugins Traps binary?
CENTPLUGINSTRAPS_BINDIR=”/usr/local/centreon/bin”
## Where is the RRD perl module installed [RRDs.pm]
## ATTENTION: ON x64 SYSTEMS THE PATH IS LIB64 INSTEAD OF LIB
##               vv
RRD_PERL=”/usr/lib64/perl5/RRDs.pm”
## What is the Centreon group ?
CENTREON_GROUP=”centreon”
## What is the Centreon user ?
CENTREON_USER=”centreon”
## What is the Monitoring engine user ?
MONITORINGENGINE_USER=”nagios”
## What is the Monitoring engine group ?
MONITORINGENGINE_GROUP=”nagios”
## What is the Monitoring engine log directory ?
MONITORINGENGINE_LOG=”/var/log/nagios”
## Where is your monitoring plugins (libexec) directory ?
PLUGIN_DIR=”/usr/lib64/nagios/plugins/”
## Path to sudoers file (optional)
## Where is sudo configuration file
SUDO_FILE=”/etc/sudoers”
## What is the Monitoring engine init.d script ?
MONITORINGENGINE_INIT_SCRIPT=”/etc/init.d/nagios”
## What is the Monitoring engine binary ?
MONITORINGENGINE_BINARY=”/usr/bin/nagios”
## What is the Monitoring engine configuration directory ?
MONITORINGENGINE_ETC=”/etc/nagios”
## Where is the configuration directory for broker module ?
BROKER_ETC=”/etc/nagios”
## Where is the init script for broker module daemon ?
BROKER_INIT_SCRIPT=”/etc/init.d/ndoutils”
## Do you want me to configure your sudo ? (WARNING)
FORCE_SUDO_CONF=1

#####################################################################
## Begin: Apache preferences
#####################################################################
## Apache configuration directory (optional)
#DIR_APACHE=”/etc/apache”
## Apache local specific configuration directory (optional)
## Do you want to update Centreon Apache sub configuration file ?
# DIR_APACHE_CONF=”/etc/apache/conf.d”
## Apache configuration file. Only file name. (optional)
#APACHE_CONF=”apache.conf”
## Apache user (optional)
WEB_USER=”apache”
## Apache group (optional)
WEB_GROUP=”apache”
## Force apache reload (optional): set APACHE_RELOAD to 1
## Do you want to reload your Apache ?
APACHE_RELOAD=1
#####################################################################
## End: Apache preferences
#####################################################################

## Do you want me to install/upgrade your PEAR modules
PEAR_AUTOINST=1
## Centreon run dir (all .pid, .run, .lock)
## Where is your Centreon Run Dir directory?
CENTREON_RUNDIR=”/var/run/centreon”

## path to centstorage binary
## Where is your CentStorage binary directory
CENTSTORAGE_BINDIR=”/usr/local/centreon/bin”
## CentStorage RRDs directory (where .rrd files go)
## Where is your CentStorage RRD directory
CENTSTORAGE_RRD=”/var/lib/centreon”
## Do you want me to install CentStorage init script ?
CENTSTORAGE_INSTALL_INIT=1
## Do you want me to install CentStorage run level ?
CENTSTORAGE_INSTALL_RUNLVL=1

## path to centcore binary
CENTCORE_BINDIR=”usr/local/centreon/bin”
## force install init script (install in init.d)
## Set to “1” to enable
## Do you want me to install CentCore init script ?
CENTCORE_INSTALL_INIT=1
## force install run level for init script (add all link on rcX.d)
## Set to “1” to enable
## Do you want me to install CentCore run level
CENTCORE_INSTALL_RUNLVL=1

## Some plugins require temporary datas to process output.
## These temp datas are store in the CENTPLUGINS_TMP path.
## Where is your CentPlugins lib directory
CENTPLUGINS_TMP=”/var/lib/centreon/centplugins”

## path for snmptt installation
SNMPTT_BINDIR=”/usr/local/centreon/bin/”
## What is the Broker user ? (optional)
BROKER_USER=$MONITORINGENGINE_USER

## Nagios user (optional)
NAGIOS_USER=”nagios”
## Nagios group (optional)
NAGIOS_GROUP=”nagios”
## Centreon Connector PATH
## Mail (optional)
BIN_MAIL=”/bin/mail”
##
Error: Tras instalar, en centreon no se detecta Poller.

Configuration  Centreon  Pollers

En la columna “is running” se queda en rojo, y pone NO.

Solución:

Revisar en el inicio de nagios (service nagios restart) que no haya problemas de permisos o de rutas para el fichero nagios.cmd:

 /var/log/nagios/rw/nagios.cmd

Error: la información de nagios no está en centreon para su consulta

  • Revisar que se esté llenando , y vaciando service-perfdata:

tail -f  /var/log/nagios/service-perfdata

  • Revisar la configuración en nagios.cfg en centreon:

Configuration  Centreon  Pollers

Seleccionamos Central y revisamos que Perfdata file apunte a nuestro archivo de service-perfdata.

  • Revisar la configuración en Centreon de Configuration  Monitoring Engines  main.cfg

Seleccionamos la pestaña Data y los Service Performance Data Processing Command deben contener process-service-perfdata

Exportar configuración de nagios

  • Revisar en Centreon que los commands de perfdata estén en el apartado MISC  Configuration  Commands  Checks

Exportar configuración de nagios

  • Revisar que  ndoutils tenga conexión con su destino de datos:

tail -f /var/log/nagios/nagios.log

[1378717388] ndomod: Error writing to data sink!  Some output may get lost…

 

  • Revisar que ndoutils esté guardando su información en la tabla centreon_Status.

Primero, verificamos que se esté guardando la información de los propios hosts: SELECT * FROM `nagios_hosts` WHERE 1

Después, verificamos que se vierta en tiempo real la información del estado: SELECT * FROM `nagios_hoststatus` WHERE 1

 

Error: Al exportar da un error de tty

[ – ] Central
sudo: no tty present and no askpass program specified

El problema viene por la configuración en /etc/sudoers. Al ver el log de secure, vemos unas líneas como:

Oct 21 12:55:16 localhost sudo: pam_unix(sudo:auth): conversation failed
Oct 21 12:55:16 localhost sudo: pam_unix(sudo:auth): auth could not identify password for [apache]
Oct 21 12:55:16 localhost sudo:   apache : command not allowed ; TTY=unknown ; PWD=/usr/local/centreon/www ; USER=root ; COMMAND=/usr/bin/nagios -v /usr/local/centreon/filesGeneration/nagiosCFG/1/nagiosCFG.DEBUG

Verificamos en el archivo de sudoers, que la ruta de nagios, coincida realmente con la ruta donde está nuestro ejecutable de nagios.

En el caso de Centos 6.5:

CENTREON   ALL = NOPASSWD: /usr/bin/nagios* -v *
CENTREON   ALL = NOPASSWD: /usr/bin/nagios -v *
CENTREON   ALL = NOPASSWD: /usr/bin/nagios* -s *
CENTREON   ALL = NOPASSWD: /usr/bin/nagios -s *

Para usar Check_centreon_ping

check_centreon_ping!3!50,80%!100,50%