Hello à tous. Nous allons voir dans cet article comment superviser Active Directory avec Centreon via le plugin NRPE. NSClient fournit sa propre API Rest via le module Webserver et permet d’exploiter au maximum les données de monitoring des serveurs Windows à travers une connexion HTTP sécurisée.
Ce qu’il vous faut :
- NSClient++ normal ou la version Centreon ici : centreon-nsclient-build/releases
- Le plugin Centreon pour Windows
- Le fichier Check_logfiles
Documentation Centreon :
- Installation NSClient++ : docs.centreon.com/fr
- Install détaillée ici aussi : /#Installation_NSClient
- Exemple supervision AD : docs.centreon.com/fr
Configuration NSClient++
Télécharger le plugin Centreon ainsi que le fichier check_logfiles.
Les renommer comme ci-dessous
- centreon_plugins.exe
- check_logfiles.exe
Mettez-les ensuite à l’emplacement suivant : C:\Program Files\Centreon NSClient++\scripts\centreon\
Note : Si vous installez NSClient++ normal ou s’il est déjà installé, il suffit de créer le répertoire centreon et y mettre les deux fichiers.
Edifier le fichier de configuration nsclient.ini : C:\Program Files\NSClient++\nsclient.ini
Adapter votre fichier pour avoir la même chose (ou remplacer tout).
192.168.1.5 est l’adresse IP de mon serveur Centreon.
# If you want to fill this file with all available options run the following command: # nscp settings --generate --add-defaults --load-all # If you want to activate a module and bring in all its options use: # nscp settings --activate-module --add-defaults # For details run: nscp settings --help [/settings/default] password = centreon allowed hosts = 127.0.0.1, 192.168.1.5 [/settings/log] level = info date format = %Y-%m-%d %H:%M:%S file name = ${exe-path}/nsclient.log [/modules] CheckDisk = 1 CheckEventLog = 1 CheckExternalScripts = 1 CheckHelpers = 1 CheckNSCP = 1 CheckSystem = 1 NRPEServer = 1 CheckTaskSched = 1 CheckNet = 1 WEBServer = enabled [/settings/WEB/server] allowed hosts = 127.0.0.1 cache allowed hosts = true port = 8443 password = centreon certificate = ${certificate-path}/certificate.pem insecure = true use ssl = false verify mode = none [/settings/WEB/server/roles] limited = *.get [/settings/WEB/server/users/centreon] password = centreon role = limited [/settings/NRPE/server] allow arguments = true allow nasty characters = true allowed hosts = 127.0.0.1, 192.168.1.5 port = 5666 payload length = 8192 insecure = true use ssl = false verify mode = none [/settings/external scripts] allow arguments = 1 allow nasty characters = 1 [/settings/external scripts/scripts/default] ignore perfdata = true [/settings/external scripts/scripts] check_DFSR = cscript.exe //NoLogo scripts\\DFSR.vbs $ARG1$ check_DFSBacklog = cscript.exe //NoLogo scripts\\DFS-Backlog.vbs $ARG1$ check_dfs_ns = cmd /c echo scripts\\dfs_namespace.ps1 | powershell.exe -command - check_update=cmd /c echo C:\scripts\Centreon_windows_updates.ps1; exit $LastExitCode | powershell.exe -command - restart_dns = cmd /c scripts\\restart_dns.bat check_logfiles = scripts\\centreon\\check_logfiles.exe $ARG1$ check_centreon_plugins = scripts\\centreon\\centreon_plugins.exe --plugin=$ARG1$ --mode=$ARG2$ $ARG3$
Redémarrer le service NSClient++
Note : après chaque modification dans le fichier de configuration NSClient, il faut relancer le service.
Créer un fichier XML nommé dcdiag.xml à l’emplacement de votre choix et y mettre ça :
Exemple : C:\Scripts\dcdiag.xml
<?xml version="1.0" encoding="UTF-8"?> <root> <dcdiag language="en"> <messages> <global>Starting test.*?:\s+(.*?)\n.*?(passed|warning|failed)</global> <ok>passed</ok> <warning>warning</warning> <critical>failed</critical> </messages> </dcdiag> <dcdiag language="fr"> <messages> <global>D.*?marrage du test.*?:\s+(.*?)\n.*?(a r.*?ussi|a .*?chou.|warning)</global> <ok>a r.*?ussi</ok> <warning>warning</warning> <critical>a .*?chou.</critical> </messages> </dcdiag> </root>
Ce fichier est dispo ici : https://github.com/centreon/centreon-plugins/blob/master/apps/microsoft/activedirectory/local/conf/dcdiag.xml
Déploiement de plugin
Tout est dans la doc Centreon.
Online License
yum install centreon-plugin-Operatingsystems-Windows-Restapi
Offline License
yum install centreon-plugin-Operatingsystems-Windows-Restapi
yum install centreon-pack-operatingsystems-windows-nsclient-05-restapi
Installer ensuite le Plugin-Pack Active Directory depuis la page Configuration > Plugin Packs > Manager
Supervision Active Directory
Tester la supervision depuis le serveur Centreon
centreon-engine@pixelabs~]$ /usr/lib/centreon/plugins/centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin --mode=query --hostname='192.168.1.15' --port='8443' --proto='https' --legacy-password='centreon' --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE" --timeout=30 --command=check_centreon_plugins --arg='apps::microsoft::activedirectory::local::plugin' --arg='dcdiag' --arg='--config="C:\\Scripts\\dcdiag.xml" --language="fr" --timeout=30' OK: Connectivity - Advertising - FrsEvent - SysVolCheck - KccEvent - MachineAccount - Replications - RidManager - Services - FsmoCheck
Il reste maintenant à déployer votre hôte Active Directory depuis Centreon Web et mettre le plugin NSClient RestAPI.
Au niveau de l’hôte :
Le champ : NSCPRESTAPIEXTRAOPTIONS
= --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE" --timeout=30
Au niveau du service :
Résultat :
A bientôt.
Bonjour,
Merci pour le tuto, par contre, où trouver le fichier check_logfiles.exe svp ?
impossible de mettre la main dessu ?
Merci
Salut,
Dans le lien Github que j’ai donné regarde plus bas encore :
La build du Nov 4, 2021
Merci pour tes articles, il me sont d’une grande aide dans le cadre de mon travail :).
Merci pour ton message.
Mise à jour de l’article.