Supervision Exchange avec Centreon (NRPE/NSClient) Part 2

Dans la première partie, nous avons configuré NSClient++ ainsi que le module NRPE sur le serveur Exchange 2016. Dans ce chapitre, nous allons mettre en place la supervision d’un serveur Exchange 2016 via le protocole NRPE. Pour cela, nous allons utiliser Centreon ainsi que les plugins Centreon (Centreon Plugin Packs)…

Ce qu’il vous faut :

Exchange PowerShell Monitoring :

Quelques sources github sympa :

Télécharger Scripts PowerShell

Voici les scripts que nous allons utiliser pour supervision Exchange. Vous pouvez renommer les scripts à votre guise !

Placez les scripts dans un répertoire de votre choix. Dans mon cas, j’ai placé les scripts dans C:\Scripts\

Supervision Exchange 2016

Commençons par la supervision des bases de données Exchange.

Ouvrir le fichier de configuration NSClient++ (C:\Program Files\NSClient++\nsclient.ini) et ajoutez sous le module [/settings/external scripts/scripts] la ligne suivante :

[/settings/external scripts/scripts]
check_exchange_mailboxhealth=cmd /c echo C:\Scripts\Centreon_MailboxHealth.ps1 | powershell.exe -command -
  • check_exchange_mailboxhealth : C’est le nom de la commande, mettez ce que vous voulez.
  • C:\Centreon\Check_MailboxHealth.ps1 : Chemin des scripts PowerShell

Remarque : n’oubliez surtout pas de redémarrer le service NSClient++ après chaque modification dans le fichier nsclient.ini (Allez dans les services Windows)

Nous allons maintenant utiliser le plugin Centreon pour vérifier les bases de données.

Check-MailboxHealth

Depuis le serveur Centreon, placez-vous dans le répertoire des plugins Centreon :

[root@centreon ~]# cd /usr/lib/centreon/plugins

Lancez la commande suivante :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=check_exchange_mailboxhealth
Ok : Toutes les bases de donnees de boites aux lettres sont montees et en bonne sante.
[root@centreon plugins]#

Maintenant que ça fonctionne. On peut mettre en place les autres scripts.

Remarque : sur ce script,  vous pouvez modifier le message « Ok : toutes les bases de donnees de boites aux lettres sont OK« . Ouvrir le script avec Notepad++ et allez tout en bas. Mettez ce que vous voulez à la place pour avoir quelque chose de propre sur l’interface Centreon (évitez les accents et les caractères spéciaux, le message est en anglais à l’origine).

Check-ReplicationHealth

Retournez dans le fichier de configuration NSClient++ (C:\Program Files\NSClient++\nsclient.ini) et toujours sous le module [/settings/external scripts/scripts] ajoutez la ligne suivante :

[/settings/external scripts/scripts]
check_exchange_mailboxhealth=cmd /c echo C:\Centreon\Check_MailboxHealth.ps1 | powershell.exe -command -
check_exchange_replication=cmd /c echo C:\Centreon\Check_ReplicationHealth.ps1 | powershell.exe -command -

Redémarrer le service NSClient++

Depuis le serveur Centreon :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=check_exchange_replication
Ok : Replication DAG OK
[root@centreon plugins]#

Check-EXCHServices

Supervision des services Exchanges. Ajoutez la ligne suivante :

[/settings/external scripts/scripts]
check_exchange_mailboxhealth=cmd /c echo C:\Centreon\Check_MailboxHealth.ps1 | powershell.exe -command -
check_exchange_replication=cmd /c echo C:\Centreon\Check_ReplicationHealth.ps1 | powershell.exe -command -
check_exchange_services=cmd /c echo C:\Centreon\Check_ExchangeServices.ps1 | powershell.exe -command -

Redémarrer le service NSClient++

Depuis le serveur Centreon :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=check_exchange_services
Ok : Les services Exchange demarres
[root@centreon plugins]#

Check-DAGHealth

Ajoutez la ligne suivante :

[/settings/external scripts/scripts]
check_exchange_mailboxhealth=cmd /c echo C:\Centreon\Check_MailboxHealth.ps1 | powershell.exe -command -
check_exchange_replication=cmd /c echo C:\Centreon\Check_ReplicationHealth.ps1 | powershell.exe -command -
check_exchange_services=cmd /c echo C:\Centreon\Check_ExchangeServices.ps1 | powershell.exe -command -
check_exchange_daghealth=cmd /c echo C:\Centreon\Check_DAGhealth.ps1 | powershell.exe -command -

Redémarrer le service NSClient++

Depuis le serveur Centreon :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange--command=check_exchange_daghealth
BDD1: Mounted - BDD2: Healthy - BDD3: Mounted - BDD4: Healthy
[root@centreon plugins]#

Check-FailOverDB

Ajoutez la ligne suivante :

[/settings/external scripts/scripts]
check_exchange_mailboxhealth=cmd /c echo C:\Centreon\Check_MailboxHealth.ps1 | powershell.exe -command -
check_exchange_replication=cmd /c echo C:\Centreon\Check_ReplicationHealth.ps1 | powershell.exe -command -
check_exchange_services=cmd /c echo C:\Centreon\Check_ExchangeServices.ps1 | powershell.exe -command -
check_exchange_daghealth=cmd /c echo C:\Centreon\Check_DAGhealth.ps1 | powershell.exe -command -
check_exchange_failoverdb=cmd /c echo C:\Centreon\Check_FailoverDB.ps1 | powershell.exe -command -

Redémarrer le service NSClient++

Depuis le serveur Centreon :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=check_exchange_failover
Ok : Position des bases optimale
[root@centreon plugins]#

Si les bases de données ne sont pas correctement réparties, le script affiche la position des bases de données (Alerte Warning). Il faut donc redistribuer vos bases de données entre les serveurs Exchange.

Check-QueueHealth

Ajoutez la ligne suivante :

[/settings/external scripts/scripts]
check_exchange_mailboxhealth=cmd /c echo C:\Centreon\Check_MailboxHealth.ps1 | powershell.exe -command -
check_exchange_replication=cmd /c echo C:\Centreon\Check_ReplicationHealth.ps1 | powershell.exe -command -
check_exchange_services=cmd /c echo C:\Centreon\Check_ExchangeServices.ps1 | powershell.exe -command -
check_exchange_daghealth=cmd /c echo C:\Centreon\Check_DAGhealth.ps1 | powershell.exe -command -
check_exchange_failoverdb=cmd /c echo C:\Centreon\Check_FailoverDB.ps1 | powershell.exe -command -
check_exchange_queuehealth=cmd /c echo C:\Centreon\Check_QueueHealth.ps1 | powershell.exe -command -

Redémarrer le service NSClient++

Depuis le serveur Centreon :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=check_exchange_queuehealth
Ok : Toutes les files d'attentes Ok
[root@centreon plugins]#

Check-IndexStateHealth

Ajoutez la ligne suivante :

[/settings/external scripts/scripts]
check_exchange_mailboxhealth=cmd /c echo C:\Centreon\Check_MailboxHealth.ps1 | powershell.exe -command -
check_exchange_replication=cmd /c echo C:\Centreon\Check_ReplicationHealth.ps1 | powershell.exe -command -
check_exchange_services=cmd /c echo C:\Centreon\Check_ExchangeServices.ps1 | powershell.exe -command -
check_exchange_daghealth=cmd /c echo C:\Centreon\Check_DAGhealth.ps1 | powershell.exe -command -
check_exchange_failoverdb=cmd /c echo C:\Centreon\Check_FailoverDB.ps1 | powershell.exe -command -
check_exchange_queuehealth=cmd /c echo C:\Centreon\Check_QueueHealth.ps1 | powershell.exe -command -
check_exchange_indexhealth=cmd /c echo C:\Centreon\Check_IndexStateHealth.ps1 | powershell.exe -command -

Redémarrer le service NSClient++

Depuis le serveur Centreon :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=check_exchange_indexhealth
OK: All content index states are healthy!
[root@centreon plugins]#

Je m’arrête ici les amis. Nous verrons dans la 3eme partie (et la dernière), comment créer les commandes et les services sous Centreon web.

Bonne journée et à bientôt.

Supervision Systèmes & Réseaux

Voir également mes projets sur la supervision : /supervision

3 Responses

  1. yas dit :

    Bonjpur,
    quand j’ajoute la ligne
    check_ISAD10125000 = cmd /c echo C:\Program Files\Centreon NSClient++\scripts\check_ISAD10125000.ps1 | powershell.exe -command -
    sur le fichier .ini je ne retrouve pas mon script dans le chemin définie donc pas de check_ISAD10125000.ps1

  2. sysadmin dit :

    Mise à jour majeur 🙂
    Supervision avec Centreon Plugin Packs.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *