Supervision Exchange avec Centreon (NRPE/NSClient) Part 1

Dans ce chapitre, nous allons voir comment mettre en la supervision Exchange Server 2016 via le protocole NRPE. Nous allons commencer par installer et configurer NSClient++ sur notre serveur Exchange, puis nous verrons comment superviser fonctionne la supervision via le protocole NRPE depuis Centreon…

Ce qu’il vous faut :

Mais aussi :

Quelques sources Github sympa :

N’oubliez pas de superviser le serveur Windows lui même : supervision-exchange-server-2016-mode-actif/

Voir également mes projets sur la supervision : /supervision

Supervision Exchange via NRPE

NSClient++ est un agent de supervision multiplateforme pour Windows. Conçu à l’origine pour Nagios, depuis, il a beaucoup évolué en un agent de monitoring complet qui peut être utilisé avec de nombreux outils de monitoring (Centreon, Icinga, Naemon, OP5, NetEye, Shinken…etc). Il supporte de nombreux protocoles de supervision :

  • NRPE : Nagios Remote plugin Executor : est un protocole centré Nagios pour collecter les métriques distantes.
  • NSCA : Nagios Service Check Acceptor : est un protocole centré Nagios pour la soumission des résultats.
  • REST est le protocole natif NSClient++ qui vous permet d’interagir avec NSClient++ sur le protocole http(s).
  • NRDP est un remplacement php pour NSCA développé par Nagios.
  • SMTP : permet d’envoyer des e-mails directement depuis NSClient+++.

source : https://docs.nsclient.org/

Installation NSClient++

Lancer l’installation de NSClient++ sur votre serveur Exchange.

Installation NSClient++ Exchange Server

  • Cliquez sur next
  • Choisir Generic
  • Choisir Typical
  • Allowed hosts : 127.0.0.1,172.16.1.6 Ajouter à la suite l’adresse IP de votre serveur Centreon
  • Choisir un mot de passe : Pour l’accès à l’interface Web NSClient.
  • Cochez les cases comme sur l’image ci-dessous :
    • Enable common check plugin
    • Enable nsclient server
    • Enable NRPE server
      • Safe mode
    • Enable NSCA client
    • Enable Web server

Remarque : il est possible de modifier ces informations après l’installation !

  • Cliquez sur next
  • Cliquez sur install
  • Cliquez sur finish
  • Redémarrer s’il le demande.

Configuration NSClient++

Le fichier de configuration se trouve dans : C:\Program Files\NSClient++\nsclient.ini. Voici les paramètres par défaut, j’ai supprimé les commentaires et les lignes vides pour y avoir clair :

Configuration file NSClient++ Exchange

Remarque : après chaque modification, vous devez redémarrer le service NSClient++

Interface Web NSClient++

Il est super simple de gérer les modules NSClient depuis l’interface Web. Pour se connecter à l’interface Web NSClient++ :

https://localhost:8443/
  • Sous Firefox:
    • Cliquez sur Avancé
    • Cliquez sur Ajouter une exception et confirmer
  • Sous IE :
    • Cliquez sur Poursuivre…
  • Mot de passe : PiXelabs c’est le mot de passe renseigné lors de l’installation.

 –  désinstaller le module  –    +  installer le module

Interface Web NSClient++

Remarque : à la première connexion, il se peut qu’une alerte (icône rouge) s’afficher à côté du menu Settings : il faut appliquer la configuration la première fois, suivre simplement l’icône rouge.

  • Cliquez sur Settings
  • Cliquez en suite sur Unsaved Changes ) droite puis sur Save Changes (save file)

Une fois la configuration appliquée, d’autres modules seront donc ajoutés dans le fichier de configuration nsclient.ini :

  • [/settings/external scripts/scripts]
  • [/settings/external scripts/alias]
  • [/settings/external scripts/wrappings]
  • [/settings/eventlog/real-time/filters]
  • [/settings/WEB/server]

Si vous avez déjà NSClient installé, mais sans l’interface Web, vous pouvez activer simplement le mode web :

  • Lancer une invite de commande (CMD)
  • Se positionner dans le répertoire NSClient++ et activer le mode web
C:\Users\Administrateur.PIXELABS#> cd "\Program Files\NSClient++"
...
C:\Program Files\NSClient++#> nscp web install
Enabling WEB from (currently not supported): 127.0.0.1,172.16.1.6
HTTP(s) is enabled using C:\Program Files\NSClient++/security/certificate.pem.
Point your browser to: 8443
...
...
C:\Program Files\NSClient++#> net stop nscp
Le service NSClient++ (x64) s’arrête..
Le service NSClient++ (x64) a été arrêté.
...
...
C:\Program Files\NSClient++#> net start nscp
Le service NSClient++ (x64) démarre.
Le service NSClient++ (x64) a démarré.
...
...
C:\Program Files\NSClient++>

Configuration Module NRPE

Nous allons maintenant passer à la configuration du module NRPE. Lancez une invite de commande (CMD) :

Se positionner sur le dossier NSClient++ :

C:\Users\Administrateur.PIXELABS#> cd "\Program Files\NSClient++"

Lancez les commandes suivantes l’une après l’autre :

C:\Program Files\NSClient++#> nscp settings --path /settings/NRPE/server --key insecure --set true
C:\Program Files\NSClient++>
C:\Program Files\NSClient++#> nscp settings --path /settings/NRPE/server --key "use ssl" --set true
C:\Program Files\NSClient++>
C:\Program Files\NSClient++#> nscp settings --path /settings/NRPE/server --key "ssl options" --set ""
C:\Program Files\NSClient++>
C:\Program Files\NSClient++#> nscp settings --path /settings/NRPE/server --key "verify mode" --set ""
C:\Program Files\NSClient++>

Vous pouvez maintenant visualiser/modifier ses paramètres depuis le fichier nsclient.ini :

Edit : changer le paramètre suivant à la ligne 22 : use ssl = false

Configuration NRPE NSClient Exchange Server

Voici l’état de mon fichier nsclient.ini : Télécharger. J’ai rien modifié d’autres dans ce fichier à part NRPE, le reste a été rajouté automatiquement après la première connexion à l’interface Web.

Remarque : Vous pouvez remplacer votre fichier nsclient.ini par le mien sans problème (modifier l’adresse IP et le mot de passe) puis redémarrer le service NSClient++.

Centreon Plugin NRPE

Nous allons utiliser le plugin Centreon suivant :

apps::protocols::nrpe::plugin

Pour tester la supervision, nous allons nous servir des alias déjà configurés automatiquement par NSClient dans le fichier nscNSClient.ini sous [/settings/external scripts/alias]

Alias et Scripts PowerShell NSClient Exchange 2016

Check-CPU

Supervision du CPU via le protocole NRPE :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=alias_cpu
OK CPU Load ok.|'5m'=3%;80;90 '1m'=2%;80;90 '30s'=3%;80;90
[root@centreon plugins]#

Check-Memory

Supervision de la mémoire RAM :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=alias_mem
OK: physical memory: Total: 63.9G - Used: 34.4G (53%) - Free: 29.5G (47%), virtual memory: Total: 128T - Used: 89.9M (0%) - Free: 128T (100%), paged bytes: Total: 73.4G - Used: 40.5G (55%) - Free: 32.9G (45%), page file: Total: 73.4G - Used: 40.5G (55%) - Free: 32.9G (45%)|'physical memory %'=53%;80;90 'physical memory'=34.36GB;51.12;57.52;0;63.91 'virtual memory %'=0%;80;90 'virtual memory'=89.91MB;107374182.3;120795955.09;0;134217727.88 'paged bytes %'=55%;80;90 'paged bytes'=40.47GB;58.72;66.07;0;73.41 'page file %'=55%;80;90 'page file'=40.47GB;58.72;66.07;0;73.41
[root@centreon plugins]#

Check-UpTime

Supervision du temps de fonctionnement du serveur :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=alias_up
OK all counters within bounds.|'uptime'=213319000;3600000;0
[root@centreon plugins]#

Check-Disk

Supervision des disques :

[root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serv-exchange --command=alias_disk
OK: All drives within bounds.|'C:\ %'=30%;10;5 'C:\'=194.45GB;27.68;13.84;0;276.83 'E:\ %'=44%;10;5 'E:\'=1189.59GB;208.89;104.44;0;2088.87 'F:\ %'=49%;10;5 'F:\'=1072.69GB;208.89;104.44;0;2088.87 'G:\ %'=52%;10;5 'G:\'=1012.53GB;208.89;104.44;0;2088.87 'H:\ %'=44%;10;5 'H:\'=1190.13GB;208.89;104.44;0;2088.87 'N:\ %'=93%;10;5 'N:\'=155.8GB;208.89;104.44;0;2088.87 'O:\ %'=81%;10;5 'O:\'=414.55GB;208.89;104.44;0;2088.87 'P:\ %'=100%;10;5 'P:\'=184.44MB;213900.59;106950.3;0;2139005.94 'Q:\ %'=100%;10;5 'Q:\'=184.25MB;213900.59;106950.3;0;2139005.94
[root@centreon plugins]#

Allez, je m’arrête ici les amis, je pensais terminer ce projet en une seule partie, mais c’est raté…

Nous verrons dans le prochain chapitre, la configuration des scripts PowerShell dans le fichier de configuration NSClient++

Bonne journée et à bientôt.

Supervision Systèmes & Réseaux

Voir également mes projets sur la supervision : /supervision

35 Responses

  1. twicsy.com dit :

    Bel article, je l’ai partagé avec mes amis.

  2. Twicsy dit :

    Bel article, je l’ai partagé avec mes amis.

  3. Acid_Zenox dit :

    Bonjour,

    Il est possible de remonter en séparer les disques par exemple que le disque C: ou le disque D: ?

    Merci

  4. Acid_Zenox dit :

    J’ai essayer avec la modification, ça fonctionne.

    Merci beaucou !

  5. Acid_Zenox dit :

    J’ai redémarrer le service NSclient et là j’ai l’erreur

    UNKNOWN: No response from remote host.
    • sysadmin dit :

      Tu as un problème de configuration SNClient++
      Tu as également désactivé le firewall Windows ?

      Dans le fichier de conf NSClient, change ce paramètre :

      ; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
      use ssl = false

      Si ça ne fonctionne pas, je peux y jeter un coup d’œil à distance si tu veux.

  6. Acid_Zenox dit :
    ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=srv-exchange1 --command=check_cpu

    UNKNOWN: Failed to create socket: Connexion refusée

    J’ai ce message

  7. Acid_Zenox dit :
    ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=srv-exchange1 --command=alias_cpu

    Par contre la j’ai une autre erreur UNKNOWN: Failed to create socket: Connexion refusée

    • sysadmin dit :

      Essaies plutôt comme ça :

      ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=srv-exchange1 --command=check_cpu
  8. Acid_Zenox dit :

    Bonjour, j’ai une réponse en UNKNOW: No response from remote hosts.

    De quoi ça peut venir ?

    • sysadmin dit :

      Bonjour,
      Peux-tu me montrer la configuration NSClient ? Le fichier NSClient.ini
      Tu ping bien ton serveur via Centreon ?

      • Acid_Zenox dit :

        Bonjour,
        Oui je ping bien.
        Mon fichier nsclient:

        # If you want to fill this file with all avalible 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 <MODULE NAME> --add-defaults
        # For details run: nscp settings --help
        
        
        ; Undocumented section
        [/settings/default]
        
        ; Undocumented key
        allowed hosts = 127.0.0.1,x.x.x.x (ip du serveur centreon)
        
        ; Undocumented key
        password = password
        
        ; Undocumented section
        [/settings/NRPE/server]
        
        ; ALLOW INSECURE CHIPHERS and ENCRYPTION - Only enable this if you are using legacy check_nrpe client.
        insecure = true
        
        ; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
        use ssl = true
        
        ; VERIFY MODE - Comma separated list of verification flags to set on the SSL socket. default-workarounds	Various workarounds for what I understand to be broken ssl implementations no-sslv2	Do not use the SSLv2 protocol. no-sslv3	Do not use the SSLv3 protocol. no-tlsv1	Do not use the TLSv1 protocol. single-dh-use	Always create a new key when using temporary/ephemeral DH parameters. This option must be used to prevent small subgroup attacks, when the DH parameters were not generated using "strong" primes (e.g. when using DSA-parameters).  
        ssl options = 
        
        ; VERIFY MODE - Comma separated list of verification flags to set on the SSL socket. none	The server will not send a client certificate request to the client, so the client will not send a certificate. peer	The server sends a client certificate request to the client and the certificate returned (if any) is checked. fail-if-no-cert	if the client did not return a certificate, the TLS/SSL handshake is immediately terminated. This flag must be used together with peer. peer-cert	Alias for peer and fail-if-no-cert. workarounds	Various bug workarounds. single	Always create a new key when using tmp_dh parameters. client-once	Only request a client certificate on the initial TLS/SSL handshake. This flag must be used together with verify-peer  
        verify mode = 
        
        
        ; Undocumented section
        [/modules]
        
        ; Undocumented key
        CheckExternalScripts = 1
        
        ; Undocumented key
        CheckHelpers = 1
        
        ; Undocumented key
        CheckEventLog = 1
        
        ; Undocumented key
        CheckNSCP = 1
        
        ; Undocumented key
        CheckDisk = 1
        
        ; Undocumented key
        CheckSystem = 1
        
        ; Undocumented key
        NSClientServer = 1
        
        ; Undocumented key
        NRPEServer = 1
        
        ; WEBServer - A server that listens for incoming HTTP connection and processes incoming requests. It provides both a WEB UI as well as a REST API in addition to simplifying configuration of WEB Server module.
        WEBServer = enabled
        
        
        ; Section for WEB (WEBServer.dll) (check_WEB) protocol options.
        [/settings/WEB/server]
        
        ; PORT NUMBER - Port to use for WEB server.
        port = 8443s
        
        ; CERTIFICATE - Ssl certificate to use for the ssl server
        certificate = ${certificate-path}/certificate.pem
        
        
        ; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
        [/settings/external scripts/scripts]
        
        
        ; A list of aliases available.
        ;An alias is an internal command that has been predefined to provide a single command without arguments. Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
        [/settings/external scripts/alias]
        
        ; alias_sched_all - Alias for alias_sched_all. To configure this item add a section called: /settings/external scripts/alias/alias_sched_all
        alias_sched_all = check_tasksched show-all "syntax=${title}: ${exit_code}" "crit=exit_code ne 0"
        
        ; alias_file_size - Alias for alias_file_size. To configure this item add a section called: /settings/external scripts/alias/alias_file_size
        alias_file_size = check_files "path=$ARG1$" "crit=size > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${size}" max-dir-depth=10
        
        ; alias_process_hung - Alias for alias_process_hung. To configure this item add a section called: /settings/external scripts/alias/alias_process_hung
        alias_process_hung = check_process "filter=is_hung" "crit=count>0"
        
        ; alias_process - Alias for alias_process. To configure this item add a section called: /settings/external scripts/alias/alias_process
        alias_process = check_process "process=$ARG1$" "crit=state != 'started'"
        
        ; alias_service_ex - Alias for alias_service_ex. To configure this item add a section called: /settings/external scripts/alias/alias_service_ex
        alias_service_ex = check_service "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc
        
        ; alias_event_log - Alias for alias_event_log. To configure this item add a section called: /settings/external scripts/alias/alias_event_log
        alias_event_log = check_eventlog
        
        ; alias_volumes_loose - Alias for alias_volumes_loose. To configure this item add a section called: /settings/external scripts/alias/alias_volumes_loose
        alias_volumes_loose = check_drivesize
        
        ; alias_volumes - Alias for alias_volumes. To configure this item add a section called: /settings/external scripts/alias/alias_volumes
        alias_volumes = check_drivesize
        
        ; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
        alias_disk = check_drivesize
        
        ; alias_up - Alias for alias_up. To configure this item add a section called: /settings/external scripts/alias/alias_up
        alias_up = check_uptime
        
        ; alias_cpu_ex - Alias for alias_cpu_ex. To configure this item add a section called: /settings/external scripts/alias/alias_cpu_ex
        alias_cpu_ex = check_cpu "warn=load > $ARG1$" "crit=load > $ARG2$" time=5m time=1m time=30s
        
        ; alias_file_age - Alias for alias_file_age. To configure this item add a section called: /settings/external scripts/alias/alias_file_age
        alias_file_age = check_files "path=$ARG1$" "crit=written > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${written}" max-dir-depth=10
        
        ; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
        alias_cpu = check_cpu
        
        ; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
        alias_mem = check_memory
        
        ; alias_process_count - Alias for alias_process_count. To configure this item add a section called: /settings/external scripts/alias/alias_process_count
        alias_process_count = check_process "process=$ARG1$" "warn=count > $ARG2$" "crit=count > $ARG3$"
        
        ; alias_service - Alias for alias_service. To configure this item add a section called: /settings/external scripts/alias/alias_service
        alias_service = check_service
        
        ; alias_process_stopped - Alias for alias_process_stopped. To configure this item add a section called: /settings/external scripts/alias/alias_process_stopped
        alias_process_stopped = check_process "process=$ARG1$" "crit=state != 'stopped'"
        
        ; alias_sched_task - Alias for alias_sched_task. To configure this item add a section called: /settings/external scripts/alias/alias_sched_task
        alias_sched_task = check_tasksched show-all "filter=title eq '$ARG1$'" "detail-syntax=${title} (${exit_code})" "crit=exit_code ne 0"
        
        ; alias_disk_loose - Alias for alias_disk_loose. To configure this item add a section called: /settings/external scripts/alias/alias_disk_loose
        alias_disk_loose = check_drivesize
        
        ; alias_sched_long - Alias for alias_sched_long. To configure this item add a section called: /settings/external scripts/alias/alias_sched_long
        alias_sched_long = check_tasksched "filter=status = 'running'" "detail-syntax=${title} (${most_recent_run_time})" "crit=most_recent_run_time < -$ARG1$"
        
        
        ; A list of templates for wrapped scripts.
        ;%SCRIPT% will be replaced by the actual script an %ARGS% will be replaced by any given arguments.
        [/settings/external scripts/wrappings]
        
        ; BATCH FILE WRAPPING - 
        bat = scripts\\%SCRIPT% %ARGS%
        
        ; VISUAL BASIC WRAPPING - 
        vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
        
        ; POWERSHELL WRAPPING - 
        ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
        
        
        ; A set of filters to use in real-time mode
        [/settings/eventlog/real-time/filters]

        Bien cordialement,

  9. Thor8onebis dit :

    Bonjour, j’ai mis un message et j’ai eu une réponse de votre part, mais je ne voit plus ce message…

    Ma question était que lorsque j’interrogeais mon centreon avec cette requête :

    ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=serveurmsg1 --command=alias_mem

    j’avais cette réponse :
    UNKNOWN: Failed to create socket: Argument invalide

    Mon fichier nsclient.ini est le suivant :

    # If you want to fill this file with all avalible 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
    
    # Exchange Server Monitoring By pixelabs.fr
    
    ; Undocumented section
    [/settings/default]
    
    ; Undocumented key
    password =pwd
    
    ; Undocumented key
    allowed hosts = 127.0.0.1,10.x.x.x (adresse de mon centreon)
    
    ; Undocumented section
    [/settings/NRPE/server]
    
    ; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
    use ssl = true
    
    ; VERIFY MODE - Comma separated list of verification flags to set on the SSL socket.  default-workarounds	Various workarounds for what I understand to be broken ssl implementations no-sslv2	Do not use the SSLv2 protocol. no-sslv3	Do not use the SSLv3 protocol. no-tlsv1	Do not use the TLSv1 protocol. single-dh-use	Always create a new key when using temporary/ephemeral DH parameters. This option must be used to prevent small subgroup attacks, when the DH parameters were not generated using "strong" primes (e.g. when using DSA-parameters).   
    ssl options = 
    
    ; VERIFY MODE - Comma separated list of verification flags to set on the SSL socket.  none	The server will not send a client certificate request to the client, so the client will not send a certificate. peer	The server sends a client certificate request to the client and the certificate returned (if any) is checked. fail-if-no-cert	if the client did not return a certificate, the TLS/SSL handshake is immediately terminated. This flag must be used together with peer. peer-cert	Alias for peer and fail-if-no-cert. workarounds	Various bug workarounds. single	Always create a new key when using tmp_dh parameters. client-once	Only request a client certificate on the initial TLS/SSL handshake. This flag must be used together with verify-peer   
    verify mode = 
    
    ; ALLOW INSECURE CHIPHERS and ENCRYPTION - Only enable this if you are using legacy check_nrpe client.
    insecure = true
    
    
    ; Undocumented section
    [/modules]
    
    ; Undocumented key
    CheckExternalScripts = 1
    
    ; Undocumented key
    CheckHelpers = 1
    
    ; Undocumented key
    CheckNSCP = 1
    
    ; Undocumented key
    CheckDisk = 1
    
    ; Undocumented key
    CheckSystem = 1
    
    ; Undocumented key
    NSClientServer = 1
    
    ; Undocumented key
    CheckEventLog = 1
    
    ; Undocumented key
    NSCAClient = 1
    
    ; Undocumented key
    NRPEServer = 1
    
    ; WEBServer - A server that listens for incoming HTTP connection and processes incoming requests. It provides both a WEB UI as well as a REST API in addition to simplifying configuration of WEB Server module.
    WEBServer = enabled
    
    
    ; A list of scripts available to run from the CheckExternalScripts module. Syntax is: = 
    [/settings/external scripts/scripts]
    check_exchange_mailboxhealth=cmd /c echo D:\Scripts\Centreon\Centreon_MailboxHealth.ps1 | powershell.exe -command -
    check_exchange_mailboxhealth=cmd /c echo D:\Scripts\Centreon\Check_MailboxHealth.ps1 | powershell.exe -command -
    check_exchange_replication=cmd /c echo D:\Scripts\Centreon\Check_ReplicationHealth.ps1 | powershell.exe -command -
    
    ; A list of aliases available.
    ;An alias is an internal command that has been predefined to provide a single command without arguments. Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
    [/settings/external scripts/alias]
    
    ; alias_sched_all - Alias for alias_sched_all. To configure this item add a section called: /settings/external scripts/alias/alias_sched_all
    alias_sched_all = check_tasksched show-all "syntax=${title}: ${exit_code}" "crit=exit_code ne 0"
    
    ; alias_file_size - Alias for alias_file_size. To configure this item add a section called: /settings/external scripts/alias/alias_file_size
    alias_file_size = check_files "path=$ARG1$" "crit=size > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${size}" max-dir-depth=10
    
    ; alias_process_hung - Alias for alias_process_hung. To configure this item add a section called: /settings/external scripts/alias/alias_process_hung
    alias_process_hung = check_process "filter=is_hung" "crit=count>0"
    
    ; alias_process - Alias for alias_process. To configure this item add a section called: /settings/external scripts/alias/alias_process
    alias_process = check_process "process=$ARG1$" "crit=state != 'started'"
    
    ; alias_service_ex - Alias for alias_service_ex. To configure this item add a section called: /settings/external scripts/alias/alias_service_ex
    alias_service_ex = check_service "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc
    
    ; alias_event_log - Alias for alias_event_log. To configure this item add a section called: /settings/external scripts/alias/alias_event_log
    alias_event_log = check_eventlog
    
    ; alias_volumes_loose - Alias for alias_volumes_loose. To configure this item add a section called: /settings/external scripts/alias/alias_volumes_loose
    alias_volumes_loose = check_drivesize
    
    ; alias_volumes - Alias for alias_volumes. To configure this item add a section called: /settings/external scripts/alias/alias_volumes
    alias_volumes = check_drivesize
    
    ; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
    alias_disk = check_drivesize
    
    ; alias_up - Alias for alias_up. To configure this item add a section called: /settings/external scripts/alias/alias_up
    alias_up = check_uptime
    
    ; alias_cpu_ex - Alias for alias_cpu_ex. To configure this item add a section called: /settings/external scripts/alias/alias_cpu_ex
    alias_cpu_ex = check_cpu "warn=load > $ARG1$" "crit=load > $ARG2$" time=5m time=1m time=30s
    
    ; alias_file_age - Alias for alias_file_age. To configure this item add a section called: /settings/external scripts/alias/alias_file_age
    alias_file_age = check_files "path=$ARG1$" "crit=written > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${written}" max-dir-depth=10
    
    ; alias_service - Alias for alias_service. To configure this item add a section called: /settings/external scripts/alias/alias_service
    alias_service = check_service
    
    ; alias_process_stopped - Alias for alias_process_stopped. To configure this item add a section called: /settings/external scripts/alias/alias_process_stopped
    alias_process_stopped = check_process "process=$ARG1$" "crit=state != 'stopped'"
    
    ; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
    alias_cpu = check_cpu
    
    ; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
    alias_mem = check_memory
    
    ; alias_process_count - Alias for alias_process_count. To configure this item add a section called: /settings/external scripts/alias/alias_process_count
    alias_process_count = check_process "process=$ARG1$" "warn=count > $ARG2$" "crit=count > $ARG3$"
    
    ; alias_sched_task - Alias for alias_sched_task. To configure this item add a section called: /settings/external scripts/alias/alias_sched_task
    alias_sched_task = check_tasksched show-all "filter=title eq '$ARG1$'" "detail-syntax=${title} (${exit_code})" "crit=exit_code ne 0"
    
    ; alias_disk_loose - Alias for alias_disk_loose. To configure this item add a section called: /settings/external scripts/alias/alias_disk_loose
    alias_disk_loose = check_drivesize
    
    ; alias_sched_long - Alias for alias_sched_long. To configure this item add a section called: /settings/external scripts/alias/alias_sched_long
    alias_sched_long = check_tasksched "filter=status = 'running'" "detail-syntax=${title} (${most_recent_run_time})" "crit=most_recent_run_time < -$ARG1$"
    
    
    ; A list of templates for wrapped scripts.
    ;%SCRIPT% will be replaced by the actual script an %ARGS% will be replaced by any given arguments.
    [/settings/external scripts/wrappings]
    
    ; BATCH FILE WRAPPING - 
    bat = scripts\\%SCRIPT% %ARGS%
    
    ; VISUAL BASIC WRAPPING - 
    vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
    
    ; POWERSHELL WRAPPING - 
    ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
    
    
    ; A set of filters to use in real-time mode
    [/settings/eventlog/real-time/filters]
    
    
    ; Section for WEB (WEBServer.dll) (check_WEB) protocol options.
    [/settings/WEB/server]
    
    ; PORT NUMBER - Port to use for WEB server.
    port = 8443s
    
    ; CERTIFICATE - Ssl certificate to use for the ssl server
    certificate = ${certificate-path}/certificate.pem
    • sysadmin dit :

      Voici mon fichier, il fonction très bien :

      [root@centreon plugins]# ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --hostname=192.168.1.2 --custommode=nrpe --command=alias_mem
      OK: physical: Total: 63.906GB - Used: 42.383GB (66%) - Free: 21.523GB (33%)...
      [root@centreon plugins]#

      Un autre exemple via script powershell :

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

      Voici le fichier, tu peux remplacer le tiens et n’oublie pas de redémarrer le service NSCLIENT++ après modification.

      # 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
      
      # Exchanger Server Monitoring by Pixelabs.fr
      
      [/settings/default]
      
      password = PiXel4bs
      allowed hosts = 127.0.0.1,192.168.1.2
      
      [/settings/NRPE/server]
      
      insecure = true
      use ssl = 
      ssl options = 
      verify mode = false
      allow arguments = true
      allow nasty characters = true
      
      [/modules]
      
      CheckNSCP = enabled
      WEBServer = enabled
      CheckSystem = enabled
      NSClientServer = enabled
      NSCAClient = enabled
      NRPEServer = enabled
      CheckExternalScripts = enabled
      CheckHelpers = enabled
      CheckEventLog = enabled
      CheckDisk = enabled
      
      [/settings/external scripts/wrappings]
      allow arguments = true
      allow nasty characters = true
      
      bat = scripts\\%SCRIPT% %ARGS%
      vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
      ps1 = cmd /c echo If (-Not (Test-Path "scripts\%SCRIPT%") ) { Write-Host "UNKNOWN: Script `"%SCRIPT%`" not found."; exit(3) }; scripts\%SCRIPT% $ARGS$; exit($lastexitcode) | powershell.exe /noprofile -command -
      
      [/settings/external scripts/alias]
      
      allow arguments = true
      allow nasty characters = true
      
      alias_cpu=checkCPU warn=95 crit=90 time=5m time=1m time=30s
      alias_cpu_ex=checkCPU warn=$ARG1$ crit=$ARG2$ time=5m time=1m time=30s
      alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical type=virtual type=paged type=page
      alias_up=checkUpTime MinWarn=1d MinWarn=1h
      
      alias_disk=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED
      alias_disk_loose=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED ignore-unreadable
      alias_volumes=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED
      alias_volumes_loose=CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED ignore-unreadable 
      
      alias_service=checkServiceState CheckAll
      alias_service_ex=checkServiceState CheckAll "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc
      alias_process=checkProcState "$ARG1$=started"
      alias_process_stopped=checkProcState "$ARG1$=stopped"
      alias_process_count=checkProcState MaxWarnCount=$ARG2$ MaxCritCount=$ARG3$ "$ARG1$=started"
      alias_process_hung=checkProcState MaxWarnCount=1 MaxCritCount=1 "$ARG1$=hung"
      
      alias_event_log=CheckEventLog file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated gt -2d AND severity NOT IN ('success', 'informational') AND source != 'SideBySide'" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"
      
      alias_file_size=CheckFiles "filter=size > $ARG2$" "path=$ARG1$" MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" max-dir-depth=10
      alias_file_age=checkFile2 filter=out "file=$ARG1$" filter-written=>1d MaxWarn=1 MaxCrit=1 "syntax=%filename% %write%"
      
      alias_sched_all=CheckTaskSched "filter=exit_code ne 0" "syntax=%title%: %exit_code%" warn=>0
      alias_sched_long=CheckTaskSched "filter=status = 'running' AND most_recent_run_time < -$ARG1$" "syntax=%title% (%most_recent_run_time%)" warn=>0
      alias_sched_task=CheckTaskSched "filter=title eq '$ARG1$' AND exit_code ne 0" "syntax=%title% (%most_recent_run_time%)" warn=>0
      
      alias_updates=check_updates -warning 0 -critical 0
      
      check_ok=CheckOK Everything is fine!
      
      [/settings/external scripts/scripts]
      
      allow arguments = true
      allow nasty characters = true
      
      check_test=cmd /c echo C:\Scripts\test.ps1 | powershell.exe -command -
      check_updates=C:\Windows\System32\cscript.exe //NoLogo //T:40 C:\Scripts\Centreon_Windows_Updates.wsf
      check_exchange_component=cmd /c echo C:\Scripts\Centreon_ComponentStates.ps1 | powershell.exe -command -
      check_exchange_failover=cmd /c echo C:\Scripts\Centreon_CheckFailoverDB.ps1 | powershell.exe -command -
      check_exchange_mounted=cmd /c echo C:\Scripts\Centreon_CheckMountedDB.ps1 | powershell.exe -command -
      check_exchange_replication=cmd /c echo C:\Scripts\Centreon_CheckReplicationDAG.ps1 | powershell.exe -command -
      check_exchange_services=cmd /c echo C:\Scripts\Centreon_Services.ps1 | powershell.exe -command -
      check_exchange_mailboxhealth=cmd /c echo C:\Scripts\Centreon_MailboxHealth.ps1 | powershell.exe -command -
      check_exchange_replicationhealth=cmd /c echo C:\Scripts\Centreon_ReplicationHealth.ps1 | powershell.exe -command -
      check_exchange_queuehealth=cmd /c echo C:\Scripts\Centreon_QueueHealth.ps1 | powershell.exe -command -
      check_exchange_mapi=cmd /c echo C:\Scripts\Centreon_CheckMapi.ps1 | powershell.exe -command -
      check_smart=C:\Windows\System32\cscript.exe //nologo //T:60 C:\Scripts\Centreon_SmartPFA.vbs
      
      [/settings/external scripts/wrapped scripts]
      
      allow arguments = true
      allow nasty characters = true
      
      check_updates=check_updates.vbs $ARG1$ $ARG2$
      
      
  10. Thor8one dit :

    Bonjour,
    J’ai un soucis lorsque je fait la commande :

    ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --mode=query --custommode=nrpe --hostname=MonServeurDeMessagerie --command=check_cpu

    j’ai le résultat suivant :

    UNKNOWN: Failed to create socket: Argument invalide
    • sysadmin dit :

      Salut Thor8one,
      C’est un problème de configuration NRPE sur ton serveur Exchange (NSClient++).
      Peux-tu me montrer le fichier de configuration NSClient ?

  11. nicolas dit :

    Bonjour ,

    Moi je n’est aucune donnée 🙁

    [root@localhost ~]# cpanm –uninstall Convert::Binary::C
    ! Convert::Binary::C is not found in the following directories and can’t be uninstalled.

    /root/perl5/lib/perl5/x86_64-linux-thread-multi
    /root/perl5/lib/perl5

    • sysadmin dit :

      Salut,
      ça donne quoi depuis Centreon Web ? toujours le message ?

      • nicolas dit :

        Salut,

        Je ne l’ai pas tester depuis Centreon Web car impossible d’allez plus loin je ne peu pas utilisé le plugin NRPE, j’ai le même probléme que Jerome ci dessous mais en suivant les infos je ne peu pas allez plus loin 🙁

        • sysadmin dit :

          Salut, je peux tenter de t’aider à distance si tu veux.
          Si c’est possible, envoie moi un mail : sysadmin[at]pixelabs.fr
          -sysadmin

          • sysadmin dit :

            Problème résolu à distance : Installation des modules perl suivant :

            cpan -i Convert::Binary::C
            cpan -i Digest::CRC
            cpan -i IO::Socket::INET6

            J’ai ensuite copié les modules au bon endroit.
            -sysadmin.

  12. Jerome dit :

    Bonjour,
    j’ai le message d’erreur suivant quand je veux utiliser les nouveau plugins nrpe

    ./centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin, 
    
    UNKNOWN: Cannot load module --custommode.
    Can't locate Convert/Binary/C.pm in @INC (@INC contains: /usr/lib/centreon/plugins /root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /root/perl5/lib/perl5/5.16.3 /root/perl5/lib/perl5/x86_64-linux-thread-multi /root/perl5/lib/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/lib/centreon/plugins/centreon/plugins/nrpe.pm line 25.
    BEGIN failed--compilation aborted at /usr/lib/centreon/plugins/centreon/plugins/nrpe.pm line 25.
    Compilation failed in require at /usr/lib/centreon/plugins/apps/protocols/nrpe/custom/nrpe.pm line 27.
    BEGIN failed--compilation aborted at /usr/lib/centreon/plugins/apps/protocols/nrpe/custom/nrpe.pm line 27.
    Compilation failed in require at /usr/lib/centreon/plugins/centreon/plugins/misc.pm line 217.

    j’ai bien tout les répertoires mais seul l’utilisateur à les droits , comment faut-il les ajouter pour l’utilisateur centreon-engine

    Merci de votre aide.

    • sysadmin dit :

      Salut,
      Il te manque des plugins perl, commence par installer celui la :

      cpan -i Convert::Binary::C

      Bonne journée,
      sysadmin.

      • Jerome dit :

        Merci de la réponse
        j’ai déjà installé le convert::binarry::c

        j’ai lu qu’il fallait désactive l’environnement perl au profil root?
        You need to unset perl environment variable for your root user –> https://github.com/centreon/centreon-plugins/issues/1637

        • sysadmin dit :

          Salut Jerome,
          Tu as eu le même problème que moi. J’ai tout essayé et je n’ai pas pu malheureusement.
          Alors, j’ai copié les fichiers de ce module la ou centreon les voulait…
          C’est chiant mais ça marche, faut juste copier les fichiers respectivement dans les bon répertoire…
          Je n’ai pas centreon sous la main, si tu n’y arrives pas tu me le dis, je te montrerais ou tu dois copier les fichiers de ce module dès que possible.
          bonne journée.
          sysadmin

          • Jerome dit :

            Bonjour,

            je veux bien , car je n’ai pas trouvé ou copier les fichiers du module , et cela n’a pas marché en désactivant l’environnement perl du compte root.

          • sysadmin dit :

            Salut,
            Commence par installer CPANM :

            [root@centreon ~]# perl -MCPAN -e shell
            cpan[1]> install App::cpanminus

            Une fois installé, affiche le répertoire d’installation du module :
            C’est ici que le module doit être installé. Du coup, tu dois avoir les chemins différents du mien.

            [root@centreon ~]# cpanm --uninstall Convert::Binary::C
            Convert::Binary::C contains the following files:
            
              /usr/local/bin/ccconfig
              /usr/local/lib64/perl5/Convert/Binary/C.pm
              /usr/local/lib64/perl5/Convert/Binary/C/Cached.pm
              /usr/local/lib64/perl5/auto/Convert/Binary/C/C.so
              /usr/local/share/man/man1/ccconfig.1
              /usr/local/share/man/man3/Convert::Binary::C.3pm
              /usr/local/share/man/man3/Convert::Binary::C::Cached.3pm
            
            Are you sure you want to uninstall Convert::Binary::C? [y] CTRL + C pour annuler

            Il faut maintenant copier les fichiers de ce module vers l’emplacement ci-dessus. Si un répertoire n’existe pas, tu peux le créer.

            Exemple : pour copier le fichier C.pm :

            cp /root/le_chemin_d'installation_chez_toi/Convert/Binary/C.pm /usr/local/lib64/perl5/Convert/Binary/

            Une fois terminé, Centreon risque de te demander un autre module : Digest::CRC
            tu dois faire de même.

            Bon courage.
            -sysadmin.

  13. sysadmin dit :

    Mise à jour majeur 🙂
    Supervision avec Centreon Plugin Packs

    • jerome dit :

      Bonjour,

      merci pour ton retour .

      j’ai copié les fichiers, il me semble ne pas les avoir copié au bon endroit

      # cpanm –uninstall Convert::Binary::C
      Convert::Binary::C contains the following files:

      /root/perl5/bin/ccconfig
      /root/perl5/lib/perl5/x86_64-linux-thread-multi/Convert/Binary/C.pm
      /root/perl5/lib/perl5/x86_64-linux-thread-multi/Convert/Binary/C/Cached.pm
      /root/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Convert/Binary/C/C.so
      /root/perl5/man/man1/ccconfig.1
      /root/perl5/man/man3/Convert::Binary::C.3pm
      /root/perl5/man/man3/Convert::Binary::C::Cached.3pm

      j’ai copié les fichiers comme ceci
      # cp /root/perl5/lib/perl5/x86_64-linux-thread-multi/Convert/Binary/C/Cached.pm /usr/local/lib64/perl5/Convert/Binary/
      # cp /root/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Convert/Binary/C/C.so /usr/local/lib64/perl5/Convert/Binary/
      # cp /root/perl5/man/man1/ccconfig.1 /usr/local/lib64/perl5/Convert/Binary/
      # cp /root/perl5/man/man3/Convert::Binary::C.3pm /usr/local/lib64/perl5/Convert/Binary/
      # cp /root/perl5/man/man3/Convert::Binary::C::Cached.3pm /usr/local/lib64/perl5/Convert/Binary/

      # ll
      total 1992
      -r–r–r– 1 root root 10622 Oct 3 16:05 Cached.pm
      -r–r–r– 1 root root 13786 Oct 3 16:06 ccconfig.1
      -r–r–r– 1 root root 184774 Oct 3 16:06 Convert::Binary::C.3pm
      -r–r–r– 1 root root 6954 Oct 3 16:07 Convert::Binary::C::Cached.3pm
      -r–r–r– 1 root root 147620 Oct 3 16:04 C.pm
      -r-xr-xr-x 1 root root 1660776 Oct 3 16:05 C.so

      il me semble cependant qu’il doit me manquer quelque chose car j’ai voulu tester un autre plugin ./centreon_plugins.pl –plugin=database::mongodb::plugin et j’ai le même message
      Can’t locate MongoDB.pm in @INC

      Merci encore de votre aide.

      • sysadmin dit :

        Salut,
        C’est très bien mais, attention, il te manque le dossier « C » et le reste ce n’est pas bon :

        # cp /root/perl5/lib/perl5/x86_64-linux-thread-multi/Convert/Binary/C/Cached.pm /usr/local/lib64/perl5/Convert/Binary/ /usr/local/lib64/perl5/Convert/Binary/C/

        # cp /root/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Convert/Binary/C/C.so /usr/local/lib64/perl5/Convert/Binary/ /usr/local/lib64/perl5/auto/Convert/Binary/C/

        # cp /root/perl5/man/man1/ccconfig.1 /usr/local/lib64/perl5/Convert/Binary/ /usr/local/lib64/perl5/man/man1/

        # cp /root/perl5/man/man3/Convert::Binary::C.3pm /usr/local/lib64/perl5/Convert/Binary/ /usr/local/lib64/perl5/man/man3/

        # cp /root/perl5/man/man3/Convert::Binary::C::Cached.3pm /usr/local/lib64/perl5/Convert/Binary/ /usr/local/lib64/perl5/man/man3/

        Il te manque le module perl pour MongoDB :

        cpan -i MongoDB

        Bonne journée,
        -sysadmin.

Laisser un commentaire

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