Anael G 2020-05-08 16:54:40 +02:00
parent 04058bc3f9
commit 27f02e2e18
1 changed files with 59 additions and 0 deletions

@ -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
```