Vous êtes ici:

Menu

Trouvez vos commandes check envoyées par Centreon-Engine

logo pluginLors de mes installations, je me suis confronté au manque d'interface pour rechercher un dysfonctionnement de mes plugins. En effet, l'interface de Centreon n'offre pas beaucoup de choix pour l'affichage des logs. Nagios, quant à lui, offre une interface efficace comme le montre l'image ci-dessous :

log_nagios

Nous allons voir que malgré une absence d'interface sur Centreon, le Broker de celui-ci nous offre beaucoup plus de renseignements. D'ailleurs, ce qui nous intéresse, c'est d'obtenir les commandes de plugins exécutés par le moteur engine. Celles-ci sont envoyées dans la base Centreon_Storage par l'intermédiaire du broker. Il suffit donc d'intercepter les logs du central. Pour l'exemple, nous partirons d'un serveur central configuré comme celui-ci. Pour être plus efficaces, nous utiliserons les commandes clapi configurées comme dans cet article.

clapi -o CENTBROKERCFG -a SETLOGGER -v "central-broker-master;1;info;yes"
clapi -o CENTBROKERCFG -a SETLOGGER -v "central-broker-master;1;level;high"
clapi -o CENTBROKERCFG -a SETLOGGER -v "central-broker-master;1;max_size;5000000"
clapi -a POLLERGENERATE -v 1
clapi -a CFGMOVE -v 1

Nous avons augmenté le niveau de verbosité des logs du central-broker-master et fixé une limite de taille. Ensuite on applique la configuration, mais comme on ne touche pas aux hôtes et services, nous ne relancerons pas engine.

service cbd reload

Nous rechargeons la configuration du broker. Sur un autre terminal, nous lançons la commande

tail -f /var/log/centreon-broker/central-broker-master.log | grep 'processing service check event'

Normalement, au bout de quelques secondes ou minutes en fonction du nombre de check à réaliser, vous obtenez un exemple de résultat comme ci-dessous :

[1423590307] info:    SQL: processing service check event (host: 41, service: 182, command: /usr/local/plugins/libexec/check_centreon_dummy -s 0 -o OK, from instance: 1)
[1423590337] info: SQL: processing service check event (host: 41, service: 193, command: /usr/local/plugins/libexec/check_tcp -H 172.16.209.51 -p 3306 -w 0,5 -c 1, from instance: 1)
[1423590337] info: SQL: processing service check event (host: 39, service: 161, command: /usr/local/plugins/libexec/check_centreon_snmp_traffic -H 127.0.0.1 -n -i eth0 -w 80 -c 90 -v 2c -C duchmol72, from instance: 1)
[1423590338] info: SQL: processing service check event (host: 40, service: 179, command: /usr/local/plugins/libexec/check_tcp -H 172.16.209.52 -p 110 -w 0,5 -c 1, from instance: 1)
[1423590338] info: SQL: processing service check event (host: 40, service: 178, command: /usr/local/plugins/libexec/check_tcp -H 172.16.209.52 -p 25 -w 0,5 -c 1, from instance: 1)
[1423590338] info: SQL: processing service check event (host: 41, service: 185, command: /usr/local/plugins/libexec/check_centreon_snmp_traffic -H 172.16.209.51 -n -i eth0 -w 80 -c 90 --username netadmin --password azerty98 --privpassword duchmol72 --authprotocol MD5 --privprotocol DES -v 3 -C duchmol72, from instance: 1)
[1423590338] info: SQL: processing service check event (host: 41, service: 183, command: /usr/local/plugins/libexec/check_centreon_snmp_cpu -H 172.16.209.51 -w 80 -c 90 --username netadmin --password azerty98 --privpassword duchmol72 --authprotocol MD5 --privprotocol DES -v 3 -C duchmol72, from instance: 1)
[1423590367] info: SQL: processing service check event (host: 39, service: 158, command: /usr/local/plugins/libexec/check_centreon_dummy -s 0 -o OK, from instance: 1)
[1423590367] info: SQL: processing service check event (host: 40, service: 169, command: /usr/local/plugins/libexec/check_centreon_dummy -s 0 -o OK, from instance: 1)
[1423590372] info: SQL: processing service check event (host: 41, service: 186, command: /usr/local/plugins/libexec/check_centreon_snmp_remote_storage -H 172.16.209.51 -n -d / -w 80 -c 90 --username netadmin --password azerty98 --privpassword duchmol72 --authprotocol MD5 --privprotocol DES -v 3 -C duchmol72, from instance: 1)
[1423590372] info: SQL: processing service check event (host: 39, service: 159, command: /usr/local/plugins/libexec/check_centreon_snmp_cpu -H 127.0.0.1 -w 80 -c 90 -v 2c -C duchmol72, from instance: 1)
[1423590372] info: SQL: processing service check event (host: 40, service: 173, command: /usr/local/plugins/libexec/check_centreon_snmp_remote_storage -H 172.16.209.52 -n -d / -w 80 -c 90 -v 2c -C duchmol72, from instance: 1)
[1423590372] info: SQL: processing service check event (host: 40, service: 174, command: /usr/local/plugins/libexec/check_centreon_snmp_remote_storage -H 172.16.209.52 -n -d /boot -w 80 -c 90 -v 2c -C duchmol72, from instance: 1)

Cette vue m'a permis de trouver une erreur dans mes configurations de macros personnalisées à cause des héritages de groupe d'hôtes. On peut aussi vérifier les données de performances avec cette commande :

tail -f /var/log/centreon-broker/central-broker-master.log | egrep 'processing service check event|metric'

Et voici le résultat :

[1423603971] info:    SQL: processing service check event (host: 39, service: 165, command: /usr/local/plugins/libexec/check_centreon_snmp_process -H 127.0.0.1  -v 2c -C duchmol72 -n -p apache2 -w 20 -c 20, from instance: 1)
[1423603975] info: storage: updating metric 115 of (100, nbproc) (unit: , warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423603980] info: SQL: processing service check event (host: 40, service: 176, command: /usr/local/plugins/libexec/check_centreon_snmp_process -H 172.16.209.52 -C duchmol72 -v 2c -p named, from instance: 1)
[1423603989] info: SQL: processing service check event (host: 41, service: 184, command: /usr/local/plugins/libexec/check_centreon_snmp_loadaverage -H 172.16.209.51 --username netadmin --password azerty98 --privpassword duchmol72 --authprotocol MD5 --privprotocol DES -v 3 -C duchmol72 -w 4,3,2 -c 6,5,4, from instance: 1)
[1423603990] info: storage: updating metric 116 of (106, load1) (unit: , warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423603990] info: storage: updating metric 117 of (106, load5) (unit: , warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423603990] info: storage: updating metric 118 of (106, load15) (unit: , warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423603997] info: SQL: processing service check event (host: 39, service: 157, command: /usr/local/plugins/libexec/check_icmp -H 127.0.0.1 -w 200,20% -c 400,50% -p 3, from instance: 1)
[1423604000] info: storage: updating metric 119 of (92, rta) (unit: ms, warning: 0.000000:200.000000, critical: 0.000000:400.000000, min: 0.000000, max: nan)
[1423604000] info: storage: updating metric 120 of (92, pl) (unit: %, warning: 0.000000:20.000000, critical: 0.000000:50.000000, min: nan, max: nan)
[1423604000] info: storage: updating metric 121 of (92, rtmax) (unit: ms, warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604000] info: storage: updating metric 122 of (92, rtmin) (unit: ms, warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604006] info: SQL: processing service check event (host: 40, service: 168, command: /usr/local/plugins/libexec/check_icmp -H 172.16.209.52 -w 200,20% -c 400,50% -p 3, from instance: 1)
[1423604010] info: storage: updating metric 123 of (79, rta) (unit: ms, warning: 0.000000:200.000000, critical: 0.000000:400.000000, min: 0.000000, max: nan)
[1423604010] info: storage: updating metric 124 of (79, pl) (unit: %, warning: 0.000000:20.000000, critical: 0.000000:50.000000, min: nan, max: nan)
[1423604010] info: storage: updating metric 125 of (79, rtmax) (unit: ms, warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604010] info: storage: updating metric 126 of (79, rtmin) (unit: ms, warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604014] info: SQL: processing service check event (host: 41, service: 188, command: /usr/local/plugins/libexec/check_centreon_snmp_remote_storage -H 172.16.209.51 -n -d /var -w 80 -c 90 --username netadmin --password azerty98 --privpassword duchmol72 --authprotocol MD5 --privprotocol DES -v 3 -C duchmol72, from instance: 1)
[1423604015] info: storage: updating metric 128 of (110, size) (unit: B, warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604015] info: storage: updating metric 129 of (110, used) (unit: B, warning: 0.000000:1122897100.000000, critical: 0.000000:1263259238.000000, min: 0.000000, max: 1403621376.000000)
[1423604023] info: SQL: processing service check event (host: 39, service: 160, command: /usr/local/plugins/libexec/check_centreon_snmp_loadaverage -H 127.0.0.1 -v 2c -C duchmol72 -w 4,3,2 -c 6,5,4, from instance: 1)
[1423604025] info: storage: updating metric 130 of (95, load1) (unit: , warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604025] info: storage: updating metric 131 of (95, load5) (unit: , warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604025] info: storage: updating metric 132 of (95, load15) (unit: , warning: nan:nan, critical: nan:nan, min: nan, max: nan)
[1423604031] info: SQL: processing service check event (host: 40, service: 171, command: /usr/local/plugins/libexec/check_centreon_snmp_loadaverage -H 172.16.209.52 -v 2c -C duchmol72 -w 4,3,2 -c 6,5,4, from instance: 1)

Pour revenir au niveau de log par défaut, appliquez de nouveau les commandes clapi.

clapi -o CENTBROKERCFG -a SETLOGGER -v "central-broker-master;1;info;no"
clapi -o CENTBROKERCFG -a SETLOGGER -v "central-broker-master;1;level;low"
clapi -a POLLERGENERATE -v 1
clapi -a CFGMOVE -v 1
service cbd reload


blog comments powered by Disqus
 Vous êtes ici: