1
0
Форк 0
7 Supervision XMPP via icinga2
cyberjinh редагував цю сторінку 2020-05-08 17:43:13 +02:00

Pour superviser notre serveur XMPP via Icinga2 sur CentOS 8

Nous utiliserons le plugin 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 defusedxml 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$" 
    "--warn-days" = "$warndays$"
    "--crit-days" = "$critdays$"
    }
}

Ensuite le service dans services.conf d'icinga2

apply Service "XMPP Status" {
check_command = "xmppng"
vars.warndays = "7"
vars.critdays = "3"
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