Le plugin check_mysql_health
Installation du plugin
Installation pour Nagios
tar xvzf check_mysql_health-2.1.8.2.tar.gz cd /usr/local/plugins/check_mysql_health-2.1.8.2 ./configurerésultat de la configuration
configure: creating ./config.status config.status: creating Makefile config.status: creating plugins-scripts/Makefile config.status: creating plugins-scripts/subst config.status: creating t/Makefile --with-perl: /usr/bin/perl --with-statefiles-dir: /var/tmp/check_mysql_health --with-nagios-user: nagios --with-nagios-group: nagios --with-mymodules-dir: /usr/local/nagios/libexec --with-mymodules-dyn-dir: /usr/local/nagios/libexeccompilation
make make install
Installation pour Centreon-engine
tar xvzf check_mysql_health-2.1.8.2.tar.gz cd /usr/local/plugins/check_mysql_health-2.1.8.2
./configure --prefix=/usr/local/plugins --with-statefiles-dir=/var/lib/centreon/centplugins --with-nagios-user=centreon-engine --with-nagios-group=centreon-engine --with-mymodules-dir=/usr/local/plugins --with-mymodules-dyn-dir=/usr/local/plugins
résultat de la configurationconfigure: creating ./config.status config.status: creating Makefile config.status: creating plugins-scripts/Makefile config.status: creating plugins-scripts/subst config.status: creating t/Makefile --with-perl: /usr/bin/perl --with-statefiles-dir: /var/lib/centreon/centplugins --with-nagios-user: centreon-engine --with-nagios-group: centreon-engine --with-mymodules-dir: /usr/local/plugins/libexec --with-mymodules-dyn-dir: /usr/local/plugins/libexeccompilation
make make install
Un utilisateur pour la base de données
root@supervision:~# mysql -u root -p mysql
mysql> grant usage on *.* to 'supervision'@'localhost' IDENTIFIED BY 'centreon'; Query OK, 0 rows affected (0.00 sec)
root@supervision:~# mysql -u supervision -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 62434 Server version: 5.5.35-0+wheezy1 (Debian) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
Configuration du plugin dans Centreon
Macros Personnalisées
Création des macros personnalisées avec mon script que vous trouverez ici.
./create_macrocustom.sh _HOSTSNMPCOMMUNITY 0 Central "Custom Macro"
./create_macrocustom.sh _SERVICEUSERNAME 0 Central "Custom Macro"
./create_macrocustom.sh _SERVICEPASSWORD 0 Central "Custom Macro"
./create_macrocustom.sh _SERVICEWARNING 0 Central "Custom Macro"
./create_macrocustom.sh _SERVICECRITICAL 0 Central "Custom Macro"
./create_macrocustom.sh _SERVICEMODE 0 Central "Custom Macro"
./create_macrocustom.sh _SERVICEOPTION 0 Central "Custom Macro"
La commande check_mysql_health
$USER1$//check_mysql_health --host=$HOSTADDRESS$ --mode=$_SERVICEMODE$ --username=$_SERVICEUSERNAME$ --password=$_SERVICEPASSWORD$ --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_SERVICEOPTION$
./centreon -u admin -p password -o CMD -a ADD -v 'check_mysql_health;check;$USER1$/check_mysql_health --host=$HOSTADDRESS$ --mode=$_SERVICEMODE$ --username=$_SERVICEUSERNAME$ --password=$_SERVICEPASSWORD$ --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_SERVICEOPTION$'
Le template de service de base pour MySQL
./centreon -u admin -p password -o STPL -a add -v "Modele_Srv_MySQL_HEALTH;Srv_MySQL_HEALTH;service-generique-actif"
./centreon -u admin -p password -o STPL -a setparam -v "Modele_Srv_MySQL_HEALTH;check_command;check_mysql_health"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH;USERNAME;supervision"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH;PASSWORD;centreon"
Les templates de service pour MySQL basés sur le modèle.
./centreon -u admin -p password -o STPL -a add -v "Modele_Srv_MySQL_HEALTH_connection-time;MySQL_HEALTH_connection-time;Modele_Srv_MySQL_HEALTH"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;MODE;connection-time"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;WARNING;0.5"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;CRITICAL;1"
./centreon -u admin -p password -o STPL -a add -v "Modele_Srv_MySQL_HEALTH_qcache-hitrate;MySQL_HEALTH_qcache-hitrate;Modele_Srv_MySQL_HEALTH"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;MODE;qcache-hitrate"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;WARNING;40:"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;CRITICAL;20:"
./centreon -u admin -p password -o STPL -a add -v "Modele_Srv_MySQL_HEALTH_threads_connected;MySQL_HEALTH_threads_connected;Modele_Srv_MySQL_HEALTH"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;MODE;threads-connected"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;WARNING;10"
./centreon -u admin -p password -o STPL -a setmacro -v "Modele_Srv_MySQL_HEALTH_connection-time;CRITICAL;20"
Le template d'hôte pour les templates MySQL
./centreon -u admin -p password -o HTPL -a add -v "Apps_MySQL_HEALTH;Modele_Apps_MySQL_HEALTH;;;Central;"
./centreon -u admin -p password -o STPL -a addhost -v "Modele_Srv_MySQL_HEALTH_connection-time;Apps_MySQL_HEALTH"
./centreon -u admin -p password -o STPL -a addhost -v "Modele_Srv_MySQL_HEALTH_threads-connected;Apps_MySQL_HEALTH"
./centreon -u admin -p password -o STPL -a addhost -v "Modele_Srv_MySQL_HEALTH_qcache-hitrate;Apps_MySQL_HEALTH"