From 27f02e2e18b88f1ad3f415007fd2a8ee9fc9cd3e Mon Sep 17 00:00:00 2001 From: cyberjinh Date: Fri, 8 May 2020 16:54:40 +0200 Subject: [PATCH] --- Supervision-XMPP-via-icinga2.md | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Supervision-XMPP-via-icinga2.md diff --git a/Supervision-XMPP-via-icinga2.md b/Supervision-XMPP-via-icinga2.md new file mode 100644 index 0000000..7322866 --- /dev/null +++ b/Supervision-XMPP-via-icinga2.md @@ -0,0 +1,59 @@ +Pour superviser notre serveur XMPP via Icinga2 +Nous utiliserons le plugin [check_xmppng](https://github.com/jandd/check_xmppng) +1/ Pour cela nous clonons le depot sur notre serveur +``` +git clone https://git.dittberner.info/jan/check_xmppng.git +``` +2/ Nous installons les dépendances necessaires à son fonctionnement +``` +sudo yum install python3 +sudo pip3 install --user defusedxml +pip3 install --user nagiosplugin +``` +Nous copions le script dans le repertoire des plugins icinga2 +``` +sudo cp check_xmppng /usr/lib64/nagios/plugins/ +``` +Le script peut etre testé à la main +``` +/usr/lib64/nagios/plugins/check_xmppng -H im.cyberjinh.fr +XMPP OK - request took 0.973368s, certificate valid for 75 days | daysvalid=75 time=0.973368s;;;0 +``` +Nous créons ensuite la commands dans le fichier commands.conf pour Icinga2 +``` +object CheckCommand "xmppng" { + import "plugin-check-command" + command = [PluginDir + "/check_xmppng" ] + arguments = { + "-H" = "$address$" + "-p" = "$xmpp_port$" + } +} +``` +Ensuite le service dans services.conf d'icinga2 +``` +apply Service "XMPP Status" { +check_command = "xmppng" +assign where host.vars.xmpp == true && host.address +} +``` +Puis nous ajoutons notre hote dans le fichier host.conf +``` +object Host "im.cyberjinh.fr" { + address = "im.cyberjinh.fr" + check_command = "hostalive" + vars.xmpp = true +} +``` +Autoriser enfin le plugin pour selinux +``` +sudo /sbin/restorecon -v /usr/lib64/nagios/plugins/check_xmppng +``` +Verifier si tout est ok dans notre configuration Icinga2 +``` +sudo icinga2 daemon -C +``` +Si tout est ok on recharge/reload le service Icinga2 +``` + sudo systemctl restart icinga2.service +``` \ No newline at end of file