9 Configuration Centreon
Votre supervision étant installée, nous allons passer à la configuration. La première partie de cet article est axé sur l’installation des extensions, ensuite nous partirons de zéro pour installer une nouvelle configuration basée sur la maquette Duchmol à l’aide des commandes Clapi. Le but de cet article est de vous donner des outils pour ensuite configurer votre propre supervision. Nous n’aborderons pas les notifications, les cal et les widgets. Lisez l’article sur la maquette duchmol pour obtenir des informations complémentaires.
9.1 Installation des extensions
9.1a Centreon-Clapi
Ce module nous permettra de réaliser notre configuration en ligne de commande plus rapidement qu'avec l'interface Web. Continuez la lecture de cet article pour l’installation de Centreon-Clapi.
9.1b Les widgets
Profitez-en pour installer les widgets que vous trouverez sur cette page Les Widgets.
9.2 Suppression de la configuration de base
Pour supprimer toute la configuration par défaut, nous utiliserons un script bash utilisant les fonctionnalités de Centreon-Clapi. Nous l’appellerons delete_config.sh
#!/bin/bash # delete_config.sh # delete conf centreon VERT="\\033[1;32m" NORMAL="\\033[0;39m" ROUGE="\\033[1;31m" ROSE="\\033[1;35m" BLEU="\\033[1;34m" BLANC="\\033[0;02m" BLANCLAIR="\\033[1;08m" JAUNE="\\033[1;33m" CYAN="\\033[1;36m" # Parameter CLAPI_DIR=/usr/local/centreon/www/modules/centreon-clapi/core USER_CENTREON=admin PWD_CENTREON=password #***************************************************************** #* Delete Host Groups #***************************************************************** $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o HG -a show -v | while read line do ID_NAME=`echo $line | cut -d";" -f2 ` if [ "$ID_NAME" != "name" ] then echo "delete Host Group : "$ID_NAME $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o HG -a del -v "$ID_NAME" fi done #***************************************************************** #* Delete Hosts #***************************************************************** $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o HOST -a show -v | while read line do ID_NAME=`echo $line | cut -d";" -f2 ` if [ "$ID_NAME" != "name" ] then echo "delete host : "$ID_NAME $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o HOST -a del -v "$ID_NAME" fi done #***************************************************************** #* Delete Hosts Templates #***************************************************************** $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o HTPL -a show -v | while read line do ID_NAME=`echo $line | cut -d";" -f2 ` if [ "$ID_NAME" != "name" ] then echo "delete Host template : "$ID_NAME $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o HTPL -a del -v "$ID_NAME" fi done #***************************************************************** #* Delete Services Templates #***************************************************************** $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o STPL -a show -v | while read line do ID_NAME=`echo $line | cut -d";" -f2 ` if [ "$ID_NAME" != "description" ] then echo "delete Service Template : "$ID_NAME $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o STPL -a del -v "$ID_NAME" fi done #***************************************************************** #* Delete Services Categories #***************************************************************** $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o SC -a show -v | while read line do ID_NAME=`echo $line | cut -d";" -f2 ` if [ "$ID_NAME" != "name" ] then echo "delete Service categories : "$ID_NAME $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o SC -a del -v "$ID_NAME" fi done #***************************************************************** #* Delete Checks Command #***************************************************************** $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o CMD -a show -v | while read line do ID_NAME=`echo $line | cut -d";" -f2 ` ID_TYPE=`echo $line | cut -d";" -f3 ` if [[ "$ID_NAME" != "name" && "$ID_TYPE" == "check" ]] then echo "delete check command : "$ID_NAME $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o CMD -a del -v "$ID_NAME" fi done #***************************************************************** #* Delete Resource #***************************************************************** $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o RESOURCECFG -a show -v "$NAME" | while read line do ID=`echo $line | cut -d";" -f1 ` echo "delete custom macro : "$ID $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o RESOURCECFG -a del -v "$ID" done
N’oubliez pas de rendre le script exécutable, attention ce script est irréversible. Il supprime toute la configuration des macros personnalisées, des commandes, des hôtes et services.
9.3 Application de la nouvelle configuration
Nous utiliserons la maquette de base Duchmol pour appliquer notre configuration. Elle est composée de notre serveur de supervision, d’un serveur Lamp sous Debian et d’un serveur DNS-LDAP-MAIL sous Debian. le serveur weblamp utilise le SNMP V3 pour communiquer avec la supervision.
Pour gérer le SNMP V3 nous utiliserons les macros personnalisées dans les modèles d’hôtes. Il faut s’assurer que toutes les commandes utilisées soient compatibles avec le SNMP V3 avec la macro OPTIONV3.
9.3a Script chargement de la configuration
Je vous propose un script qui vous permettra de charger une configuration Centreon en paramétrant un fichier texte. Celui-ci contiendra les commandes clapi à la manière du fichier d’exportation créé par l’option -e de Centreon-Clapi. Voici le script que vous nommerez create_conf.sh
#!/bin/bash # create_conf.sh # create conf centreon # version 1.01 # Date 27/01/2015 # Eric Coquard # parameter $1 : file conf VERT="\\033[1;32m" NORMAL="\\033[0;39m" ROUGE="\\033[1;31m" ROSE="\\033[1;35m" BLEU="\\033[1;34m" BLANC="\\033[0;02m" BLANCLAIR="\\033[1;08m" JAUNE="\\033[1;33m" CYAN="\\033[1;36m" # Parameter CLAPI_DIR=/usr/local/centreon/www/modules/centreon-clapi/core USER_CENTREON=admin PWD_CENTREON=password STATE_OK=0 while read LINE do # comments if [ `expr index "$LINE" "#"` == 1 ] then continue fi OIFS=$IFS IFS=';' LINE_BLANK=$LINE unset PARAM for X in $LINE_BLANK do PARAM=("${PARAM[@]}" "$X") done #${PARAM[0]} OBJECT #${PARAM[1]} ACTION #${PARAM[2]} name #${PARAM[3]} PARAM1 #${PARAM[4]} PARAM2 #${PARAM[5]} PARAM3 #${PARAM[6]} PARAM4 #${PARAM[7]} PARAM5 # parameter ligne end if [ "${LINE: -1}" == ";" ] then PARAM=("${PARAM[@]}" "") fi IFS=$OIFS if [ $((${#PARAM[@]}-3)) == "0" ] then echo "Command Clapi ${PARAM[0]} : ${PARAM[1]} name : ${PARAM[2]} " RESULT=`$CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a ${PARAM[1]} -v "${PARAM[2]}"` elif [ $((${#PARAM[@]}-3)) == "1" ] then echo "Command Clapi ${PARAM[0]} : ${PARAM[1]} name : ${PARAM[2]} 1: ${PARAM[3]} " RESULT=`$CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a ${PARAM[1]} -v "${PARAM[2]};${PARAM[3]}"` elif [ $((${#PARAM[@]}-3)) == "2" ] then if [ ${PARAM[0]} == "RESOURCECFG" ] then $CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a show -v "${PARAM[2]}" | while read LINE_ID do ID=`echo $LINE_ID | cut -d";" -f1 ` #echo $ID if [ "$ID" != "id" ] then echo "Command Clapi ${PARAM[0]} : ${PARAM[1]} name : $ID 1: ${PARAM[3]} 2: ${PARAM[4]}" RESULT=`$CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a ${PARAM[1]} -v "$ID;${PARAM[3]};${PARAM[4]}"` fi done else echo "Command Clapi ${PARAM[0]} : ${PARAM[1]} name : ${PARAM[2]} 1: ${PARAM[3]} 2: ${PARAM[4]}" RESULT=`$CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a ${PARAM[1]} -v "${PARAM[2]};${PARAM[3]};${PARAM[4]}"` fi elif [ $((${#PARAM[@]}-3)) == "3" ] then echo "Command Clapi ${PARAM[0]} : ${PARAM[1]} name : ${PARAM[2]} 1: ${PARAM[3]} 2: ${PARAM[4]} 3: ${PARAM[5]}" RESULT=`$CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a ${PARAM[1]} -v "${PARAM[2]};${PARAM[3]};${PARAM[4]};${PARAM[5]}"` elif [ $((${#PARAM[@]}-3)) == "4" ] then echo "Command Clapi ${PARAM[0]} : ${PARAM[1]} name : ${PARAM[2]} 1: ${PARAM[3]} 2: ${PARAM[4]} 3: ${PARAM[5]} 4: ${PARAM[6]}" RESULT=`$CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a ${PARAM[1]} -v "${PARAM[2]};${PARAM[3]};${PARAM[4]};${PARAM[5]};${PARAM[6]}"` else echo "Command Clapi ${PARAM[0]} : ${PARAM[1]} name : ${PARAM[2]} 1: ${PARAM[3]} 2: ${PARAM[4]} 3: ${PARAM[5]} 4: ${PARAM[6]} 5: ${PARAM[7]}" RESULT=`$CLAPI_DIR/centreon -u $USER_CENTREON -p $PWD_CENTREON -o ${PARAM[0]} -a ${PARAM[1]} -v "${PARAM[2]};${PARAM[3]};${PARAM[4]};${PARAM[5]};${PARAM[6]};${PARAM[7]}"` fi STATE=$? if [ "$STATE" != "$STATE_OK" ] then echo -e "* ""$ROUGE""Erreur: "$RESULT"$NORMAL" fi done < $1
N’oubliez pas de rendre le script exécutable. A l’exécution, nous passerons le fichier de configuration en paramètre.
9.3b le fichier de configuration
Le fichier de configuration est composé d’une série de commandes Clapi et ses paramètres associés. Les commentaires sont précédés par la touche dièse ou hashtag. Attention le script n’aime pas les lignes vides. Voici un exemple de configuration que vous nommerez centreon.conf.
# Resources Macro # PATH Plugins RESOURCECFG;ADD;USER1;/usr/local/plugins/libexec;Central;path to the plugins # HOST Macro # SNMP VERSION RESOURCECFG;ADD;_HOSTSNMPVERSION;2c;Central;Custom Macro RESOURCECFG;setparam;_HOSTSNMPVERSION;activate;0 # SNMP COMMUNITY RESOURCECFG;ADD;_HOSTSNMPCOMMUNITY;duchmol72;Central;Custom Macro RESOURCECFG;setparam;_HOSTSNMPCOMMUNITY;activate;0 # SNMP V3 RESOURCECFG;ADD;_HOSTOPTIONV3;0;Central;Custom Macro RESOURCECFG;setparam;_HOSTOPTIONV3;activate;0 # THRESHOLD RESOURCECFG;ADD;_SERVICEWARNING;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEWARNING;activate;0 RESOURCECFG;ADD;_SERVICECRITICAL;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICECRITICAL;activate;0 # SPEED (networks) RESOURCECFG;ADD;_SERVICESPEED;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICESPEED;activate;0 # Number PACKET (icmp) RESOURCECFG;ADD;_SERVICEPACKETNUMBER;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEPACKETNUMBER;activate;0 # Process RESOURCECFG;ADD;_SERVICEPROCESS;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEPROCESS;activate;0 # Interface RESOURCECFG;ADD;_SERVICEINTERFACE;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEINTERFACE;activate;0 # Username / Password RESOURCECFG;ADD;_SERVICEPASSWORD;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEPASSWORD;activate;0 RESOURCECFG;ADD;_SERVICEUSERNAME;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEUSERNAME;activate;0 # Mysql RESOURCECFG;ADD;_SERVICEMODE_MYSQL;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEMODE_MYSQL;activate;0 # Port RESOURCECFG;ADD;_SERVICEPORT;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEPORT;activate;0 # Disk RESOURCECFG;ADD;_SERVICEDISK;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEDISK;activate;0 # Plugin centreon RESOURCECFG;ADD;_SERVICEMODE;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEMODE;activate;0 RESOURCECFG;ADD;_SERVICEPLUGIN;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEPLUGIN;activate;0 RESOURCECFG;ADD;_SERVICEOPTION;0;Central;Custom Macro RESOURCECFG;setparam;_SERVICEOPTION;activate;0 # Commands CMD;ADD;check_host_alive;check;$USER1$/check_icmp -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1 CMD;setparam;check_host_alive;enable_shell;0 CMD;ADD;check_ping;check;$USER1$/check_icmp -H $HOSTADDRESS$ -w $_SERVICEWARNING$ -c $_SERVICECRITICAL$ -p $_SERVICEPACKETNUMBER$ CMD;setparam;check_ping;enable_shell;0 #Dummy CMD;ADD;check_centreon_dummy;check;$USER1$/check_centreon_dummy -s $ARG1$ -o $ARG2$ # Services Templates # active STPL;ADD;Model-service-active;Model-service-active; STPL;setparam;Model-service-active;check_period;24x7 STPL;setparam;Model-service-active;notification_period;24x7 STPL;setparam;Model-service-active;is_volatile;0 STPL;setparam;Model-service-active;max_check_attempts;3 STPL;setparam;Model-service-active;normal_check_interval;5 STPL;setparam;Model-service-active;retry_check_interval;2 STPL;setparam;Model-service-active;active_checks_enabled;1 STPL;setparam;Model-service-active;passive_checks_enabled;0 STPL;setparam;Model-service-active;notification_interval;0 STPL;setparam;Model-service-active;notification_options;w,c,r,f,s STPL;setparam;Model-service-active;notifications_enabled;1 STPL;setparam;Model-service-active;first_notification_delay;0 STPL;addcontactgroup;Model-service-active;Supervisors # passif STPL;ADD;Model-service-passif;Model-service-passif; STPL;setparam;Model-service-passif;check_period;24x7 STPL;setparam;Model-service-passif;check_command;check_centreon_dummy STPL;setparam;Model-service-passif;check_command_arguments;!0!OK STPL;setparam;Model-service-passif;notification_period;24x7 STPL;setparam;Model-service-passif;is_volatile;0 STPL;setparam;Model-service-passif;max_check_attempts;1 STPL;setparam;Model-service-passif;normal_check_interval;1 STPL;setparam;Model-service-passif;retry_check_interval;1 STPL;setparam;Model-service-passif;active_checks_enabled;0 STPL;setparam;Model-service-passif;passive_checks_enabled;1 STPL;setparam;Model-service-passif;notification_interval;0 STPL;setparam;Model-service-passif;notification_options;w,c,r,f,s STPL;setparam;Model-service-passif;notifications_enabled;1 STPL;setparam;Model-service-passif;first_notification_delay;0 STPL;setparam;Model-service-passif;service_check_freshness;1 STPL;setparam;Model-service-passif;service_freshness_threshold;300 STPL;addcontactgroup;Model-service-passif;Supervisors # Service PING STPL;ADD;Ping-Model-Service;Ping-Model-Service;Model-service-active; STPL;setparam;Ping-Model-Service;check_command;check_ping STPL;setmacro;Ping-Model-Service;PACKETNUMBER;3 STPL;ADD;Ping-Lan-Model-Service;Ping-Lan;Ping-Model-Service; STPL;setmacro;Ping-Lan-Model-Service;WARNING;200,20% STPL;setmacro;Ping-Lan-Model-Service;CRITICAL;400,50% STPL;ADD;Ping-Wan-Model-Service;Ping-Wan;Ping-Model-Service; STPL;setmacro;Ping-Wan-Model-Service;WARNING;400,20% STPL;setmacro;Ping-Wan-Model-Service;CRITICAL;600,50% # Hosts Templates HTPL;ADD;generic-host;generic-host;;;; HTPL;setparam;generic-host;check_command;check_host_alive HTPL;setparam;generic-host;check_period;24x7 HTPL;setparam;generic-host;notification_period;24x7 HTPL;setparam;generic-host;host_max_check_attempts;5 HTPL;setparam;generic-host;host_active_checks_enabled;1 HTPL;setparam;generic-host;host_passive_checks_enabled;0 HTPL;setparam;generic-host;host_checks_enabled;2 HTPL;setparam;generic-host;host_obsess_over_host;2 HTPL;setparam;generic-host;host_check_freshness;2 HTPL;setparam;generic-host;host_event_handler_enabled;2 HTPL;setparam;generic-host;host_flap_detection_enabled;2 HTPL;setparam;generic-host;host_process_perf_data;2 HTPL;setparam;generic-host;host_retain_status_information;2 HTPL;setparam;generic-host;host_retain_nonstatus_information;2 HTPL;setparam;generic-host;host_notification_interval;0 HTPL;setparam;generic-host;host_notification_options;d,r HTPL;setparam;generic-host;host_notifications_enabled;0 HTPL;setparam;generic-host;host_snmp_community;public HTPL;setparam;generic-host;host_snmp_version;2c HTPL;setparam;generic-host;host_location;0 HTPL;setparam;generic-host;host_register;0 HTPL;setparam;generic-host;host_activate;1 STPL;addhost;Ping-Lan-Model-Service;generic-host # Commands Plugins # Plugin local Linux # Disk CMD;ADD;check_disk_SNMP;check;$USER1$/check_centreon_snmp_remote_storage -H $HOSTADDRESS$ -n -d $_SERVICEDISK$ -w $_SERVICEWARNING$ -c $_SERVICECRITICAL$ $_HOSTOPTIONV3$ -v $_HOSTSNMPVERSION$ -C $_HOSTSNMPCOMMUNITY$ CMD;setparam;check_disk_SNMP;graph;Storage #Load CMD;ADD;check_snmp_load;check;$USER1$/check_centreon_snmp_loadaverage -H $HOSTADDRESS$ $_HOSTOPTIONV3$ -v $_HOSTSNMPVERSION$ -C $_HOSTSNMPCOMMUNITY$ -w $_SERVICEWARNING$ -c $_SERVICECRITICAL$ CMD;setparam;check_snmp_load;graph;Load_Average #Cpu CMD;ADD;check_snmp_cpu;check;$USER1$/check_centreon_snmp_cpu -H $HOSTADDRESS$ -w $_SERVICEWARNING$ -c $_SERVICECRITICAL$ $_HOSTOPTIONV3$ -v $_HOSTSNMPVERSION$ -C $_HOSTSNMPCOMMUNITY$ CMD;setparam;check_snmp_cpu;graph;CPU #Process CMD;ADD;check_snmp_process;check;$USER1$/check_centreon_snmp_process -H $HOSTADDRESS$ $_HOSTOPTIONV3$ -C $_HOSTSNMPCOMMUNITY$ -v $_HOSTSNMPVERSION$ -p $_SERVICEPROCESS$ #Process multiple CMD;ADD;check_snmp_process_multiple;check;$USER1$/check_centreon_snmp_process -H $HOSTADDRESS$ $_HOSTOPTIONV3$ -v $_HOSTSNMPVERSION$ -C $_HOSTSNMPCOMMUNITY$ -n -p $_SERVICEPROCESS$ -w $_SERVICECRITICAL$ -c $_SERVICECRITICAL$ #Traffic CMD;ADD;check_traffic;check;$USER1$/check_centreon_snmp_traffic -H $HOSTADDRESS$ -n -i $_SERVICEINTERFACE$ -w $_SERVICEWARNING$ -c $_SERVICECRITICAL$ $_HOSTOPTIONV3$ -v $_HOSTSNMPVERSION$ -C $_HOSTSNMPCOMMUNITY$ CMD;setparam;check_traffic;graph;Traffic #Tcp CMD;ADD;check_tcp;check;$USER1$/check_tcp -H $HOSTADDRESS$ -p $_SERVICEPORT$ -w $_SERVICEWARNING$ -c $_SERVICECRITICAL$ CMD;setparam;check_tcp;graph;Latency # Services Templates Linux-Local # TRAP STPL;ADD;Modele_Trap_Linux;TRAP_LINUX;Model-service-passif STPL;addtrap;Modele_Trap_Linux;linkDown STPL;addtrap;Modele_Trap_Linux;linkUp STPL;addtrap;Modele_Trap_Linux;warmStart STPL;addtrap;Modele_Trap_Linux;coldStart # CPU STPL;ADD;modele cpu snmp;CPU_snmp;Model-service-active STPL;setparam;modele cpu snmp;check_command;check_snmp_cpu STPL;setmacro;modele cpu snmp;WARNING;80 STPL;setmacro;modele cpu snmp;CRITICAL;90 # LOAD STPL;ADD;modele load snmp;LOAD_snmp;Model-service-active STPL;setparam;modele load snmp;check_command;check_snmp_load STPL;setmacro;modele load snmp;WARNING;4,3,2 STPL;setmacro;modele load snmp;CRITICAL;6,5,4 # TRAFFIC STPL;ADD;modele Traffic;Traffic;Model-service-active STPL;setparam;modele Traffic;check_command;check_traffic STPL;setmacro;modele Traffic;WARNING;80 STPL;setmacro;modele Traffic;CRITICAL;90 STPL;ADD;modele Traffic eth0;Traffic eth0;modele Traffic STPL;setmacro;modele Traffic eth0;INTERFACE;eth0 #DISK STPL;ADD;modele disque SNMP;Disk_SNMP;Model-service-active STPL;setparam;modele disque SNMP;check_command;check_disk_SNMP STPL;setmacro;modele disque SNMP;WARNING;80 STPL;setmacro;modele disque SNMP;CRITICAL;90 STPL;ADD;modele disque SNMP root;Disk_SNMP_root;modele disque SNMP STPL;setmacro;modele disque SNMP root;DISK;/ STPL;ADD;modele disque SNMP boot;Disk_SNMP_boot;modele disque SNMP STPL;setmacro;modele disque SNMP boot;DISK;/boot STPL;ADD;modele disque SNMP var;Disk_SNMP_var;modele disque SNMP STPL;setmacro;modele disque SNMP var;DISK;/var STPL;ADD;modele disque SNMP tmp;Disk_SNMP_tmp;modele disque SNMP STPL;setmacro;modele disque SNMP tmp;DISK;/tmp STPL;ADD;modele disque SNMP usr;Disk_SNMP_usr;modele disque SNMP STPL;setmacro;modele disque SNMP usr;DISK;/usr STPL;ADD;modele disque SNMP home;Disk_SNMP_home;modele disque SNMP STPL;setmacro;modele disque SNMP home;DISK;/home STPL;setmacro;modele disque SNMP home;WARNING;80 STPL;setmacro;modele disque SNMP home;CRITICAL;90 # Model TCP STPL;ADD;modele TCP;TCP;Model-service-active STPL;setparam;modele TCP;check_command;check_tcp STPL;setmacro;modele TCP;WARNING;0,5 STPL;setmacro;modele TCP;CRITICAL;1 STPL;ADD;modele TCP apache 80;TCP Apache 80;modele TCP STPL;setmacro;modele TCP apache 80;PORT;80 STPL;ADD;modele TCP MYSQL;TCP MYSQL;modele TCP STPL;setmacro;modele TCP MYSQL;PORT;3306 STPL;ADD;modele TCP DNS;TCP DNS;modele TCP STPL;setmacro;modele TCP DNS;PORT;53 STPL;ADD;modele TCP LDAP;TCP LDAP;modele TCP STPL;setmacro;modele TCP LDAP;PORT;389 STPL;ADD;modele TCP SMTP;TCP SMTP;modele TCP STPL;setmacro;modele TCP SMTP;PORT;25 STPL;ADD;modele TCP POP3;TCP POP3;modele TCP STPL;setmacro;modele TCP POP3;PORT;110 STPL;ADD;modele TCP IMAP;TCP IMAP;modele TCP STPL;setmacro;modele TCP IMAP;PORT;143 # MODEL PROCESS STPL;ADD;modele Process SNMP;Process SNMP;Model-service-active STPL;setparam;modele Process SNMP;check_command;check_snmp_process STPL;ADD;modele Process SNMP multiple;Process SNMP multiple;Model-service-active STPL;setparam;modele Process SNMP multiple;check_command;check_snmp_process_multiple STPL;setmacro;modele Process SNMP multiple;WARNING;10 STPL;setmacro;modele Process SNMP multiple;CRITICAL;20 STPL;ADD;modele Process DNS;Process DNS;modele Process SNMP STPL;setmacro;modele Process DNS;PROCESS;named STPL;ADD;modele Process MYSQL;Process MYSQL;modele Process SNMP STPL;setmacro;modele Process MYSQL;PROCESS;mysqld STPL;ADD;modele Process Apache2;Process Apache2;modele Process SNMP multiple STPL;setmacro;modele Process Apache2;PROCESS;apache2 # HOSTS MODEL OS-Linux-Debian7-SNMPV2 HTPL;ADD;OS-Linux-Debian7;Modele OS Linux Debian 7;;;Central; HTPL;setparam;OS-Linux-Debian7;host_snmp_version;2c STPL;addhost;Modele_Trap_Linux;OS-Linux-Debian7 STPL;addhost;modele disque SNMP boot;OS-Linux-Debian7 STPL;addhost;modele disque SNMP home;OS-Linux-Debian7 STPL;addhost;modele disque SNMP root;OS-Linux-Debian7 STPL;addhost;modele disque SNMP usr;OS-Linux-Debian7 STPL;addhost;modele disque SNMP var;OS-Linux-Debian7 STPL;addhost;modele cpu snmp;OS-Linux-Debian7 STPL;addhost;modele load snmp;OS-Linux-Debian7 STPL;addhost;modele Traffic eth0;OS-Linux-Debian7 # HOSTS MODEL OS-Linux-Debian7-SNMPV3 HTPL;ADD;OS-Linux-Debian7-V3;Modele OS Linux Debian 7 V3;;;Central; HTPL;setparam;OS-Linux-Debian7-V3;host_snmp_version;3 HTPL;setmacro;OS-Linux-Debian7-V3;OPTIONV3;--username netadmin --password azerty98 --privpassword duchmol72 --authprotocol MD5 --privprotocol DES STPL;addhost;Modele_Trap_Linux;OS-Linux-Debian7-V3 STPL;addhost;modele disque SNMP boot;OS-Linux-Debian7-V3 STPL;addhost;modele disque SNMP home;OS-Linux-Debian7-V3 STPL;addhost;modele disque SNMP root;OS-Linux-Debian7-V3 STPL;addhost;modele disque SNMP usr;OS-Linux-Debian7-V3 STPL;addhost;modele disque SNMP var;OS-Linux-Debian7-V3 STPL;addhost;modele cpu snmp;OS-Linux-Debian7-V3 STPL;addhost;modele load snmp;OS-Linux-Debian7-V3 STPL;addhost;modele Traffic eth0;OS-Linux-Debian7-V3 # HOSTS MODEL OS-Linux-vagrant-V2 HTPL;ADD;OS-Linux-vagrant;Modele OS Linux vagrant;;;Central; HTPL;setparam;OS-Linux-vagrant;host_snmp_version;2c STPL;addhost;Modele_Trap_Linux;OS-Linux-vagrant STPL;addhost;modele disque SNMP boot;OS-Linux-vagrant STPL;addhost;modele disque SNMP root;OS-Linux-vagrant STPL;addhost;modele cpu snmp;OS-Linux-vagrant STPL;addhost;modele load snmp;OS-Linux-vagrant STPL;addhost;modele Traffic eth0;OS-Linux-vagrant # HOSTS MODEL application HTPL;ADD;Linux-WEB;Modele Web Linux;;;Central; STPL;addhost;modele Process Apache2;Linux-WEB STPL;addhost;modele TCP apache 80;Linux-WEB HTPL;ADD;Linux-MySQL;Modele MySQL;;;Central; STPL;addhost;modele Process MYSQL;Linux-MySQL STPL;addhost;modele TCP MYSQL;Linux-MySQL HTPL;ADD;Linux-DNS;Modele Linux DNS;;;Central; STPL;addhost;modele Process DNS;Linux-DNS STPL;addhost;modele TCP DNS;Linux-DNS HTPL;ADD;Linux-LDAP;Modele Linux LDAP;;;Central; STPL;addhost;modele TCP LDAP;Linux-LDAP HTPL;ADD;Linux-MAIL;Modele Linux MAIL;;;Central; STPL;addhost;modele TCP SMTP;Linux-MAIL STPL;addhost;modele TCP POP3;Linux-MAIL STPL;addhost;modele TCP IMAP;Linux-MAIL # HOSTS GROUP HG;ADD;Linux-Servers;All linux servers HG;setparam;Linux-Servers;hg_activate;1 # HOSTS # supervision HOST;ADD;supervision;serveur supervision;127.0.0.1;generic-host;Central;Linux-servers HOST;addtemplate;supervision;OS-Linux-vagrant|Linux-WEB|Linux-MySQL HOST;setparam;supervision;host_snmp_community;duchmol72 HOST;setparam;supervision;host_snmp_version;2c HOST;applytpl;supervision # debdns HOST;ADD;debdns;serveur DNS-LDAP-MAIL;10.0.0.10;generic-host;Central;Linux-servers HOST;addtemplate;debdns;OS-Linux-vagrant|Linux-DNS|Linux-LDAP|Linux-MAIL HOST;setparam;debdns;host_snmp_community;duchmol72 HOST;setparam;debdns;host_snmp_version;2c HOST;applytpl;debdns # weblamp HOST;ADD;weblamp;serveur Web;10.0.0.51;generic-host;Central;Linux-servers HOST;addtemplate;weblamp;OS-Linux-Debian7-V3|Linux-WEB|Linux-MySQL HOST;setparam;weblamp;host_snmp_community;duchmol72 HOST;setparam;weblamp;host_snmp_version;3 HOST;applytpl;weblamp #activate Trap TRAP;setparam;linkDown;traps_submit_result_enable;1 TRAP;setparam;linkUp;traps_submit_result_enable;1 TRAP;setparam;warmStart;traps_submit_result_enable;1 TRAP;setparam;coldStart;traps_submit_result_enable;1
Appliquez la nouvelle configuration
./create_conf.sh centreon.conf
Les éventuelles erreurs seront affichées en rouge. Ensuite chargez la nouvelle configuration dans notre supervision. Utilisez l’alias clapi vu dans l’article de Centreon-Clapi.
clapi -a POLLERGENERATE -v 1
clapi -a CFGMOVE -v 1
Si Engine est démarré, privilégiez la commande POLLERRELOAD.
clapi -a POLLERRESTART -v 1
9.4 Vérification de notre configuration
Maintenant il reste à vérifier notre supervision en se connectant à l’interface Web.
Au bout de quelques minutes, vous devriez avoir tous vos services au vert comme l’image ci-dessous.