Nous continuons notre découverte des plugins avec le module os::windows::snmp::plugin pour les environnement Windows. Nous utiliserons les commandes clapi pour réaliser notre configuration. En effet, il vous suffira de copier-coller mes commandes pour réaliser la configuration. Cette méthode est vraiment plus efficace que l'utilisation de l'interface graphique.
Dans notre exemple nous verrons la configuration du SNMP V2 pour un serveur Wk 2003. Même si ce protocole n'est plus préconisé par MicroSoft, il est tout de même intéressant de voir sa configuration avec Centreon.
Dans notre exemple nous verrons la configuration du SNMP V2 pour un serveur Wk 2003. Même si ce protocole n'est plus préconisé par MicroSoft, il est tout de même intéressant de voir sa configuration avec Centreon.
1 Le module os::windows::snmp::plugin
Voici les principaux mode de supervision de ce plugin.
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --list-mode
....
Modes Available:
cpu
interfaces
list-interfaces
list-storages
memory
processcount
service
storage
swap
time
uptime
-
cpu
- Vérification de la charge cpu, moyenne sur la dernière minute.
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=cpu --hostname=192.168.0.175 --snmp-community=public --snmp-version=2
résultatOK: 2 CPU(s) average usage is: 2.50% | 'cpu0'=2.00%;;;0;100 'cpu1'=3.00%;;;0;100 'total_cpu_avg'=2.50%;;;0;100
-
list-interfaces
- Lister les interfaces réseaux.
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=list-interfaces --hostname=192.168.0.175 --snmp-community=public --snmp-version=2 --oid-filter ifDesc --oid-display ifDesc
résultatList interfaces:
'Software Loopback Interface 1' [speed = 1073, status = up, id = 1]
'WAN Miniport (IKEv2)' [speed = 4294, status = down, id = 10]
'Realtek PCIe GBE Family Controller' [speed = 10, status = up, id = 11]
'Carte Microsoft ISATAP' [speed = 0.1, status = down, id = 12]
'Carte Microsoft 6to4' [speed = 0.1, status = down, id = 13]
'Realtek PCIe GBE Family Controller-QoS Packet Scheduler-0000' [speed = 10, status = up, id = 14]
'Realtek PCIe GBE Family Controller-WFP LightWeight Filter-0000' [speed = 10, status = up, id = 15]
'WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000' [speed = 1073, status = up, id = 16]
'WAN Miniport (IP)-QoS Packet Scheduler-0000' [speed = 1073, status = up, id = 17]
'WAN Miniport (IPv6)-QoS Packet Scheduler-0000' [speed = 1073, status = up, id = 18]
'WAN Miniport (SSTP)' [speed = 1073, status = up, id = 2]
'WAN Miniport (L2TP)' [speed = 1073, status = up, id = 3]
'WAN Miniport (PPTP)' [speed = 1073, status = up, id = 4]
'WAN Miniport (PPPOE)' [speed = 1073, status = up, id = 5]
'WAN Miniport (IPv6)' [speed = 1073, status = up, id = 6]
'WAN Miniport (Network Monitor)' [speed = 1073, status = up, id = 7]
'WAN Miniport (IP)' [speed = 1073, status = up, id = 8]
'RAS Async Adapter' [speed = , status = notPresent, id = 9] -
interfaces
- Superviser une interface réseau, attention le faire en user centreon-engine à cause de la création d'un fichier cache dans /var/lib/centreon/centplugins. L'id 11 correspond à la découverte précédente (list-interfaces)
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=interfaces --hostname=192.168.0.175 --snmp-community=maison72 --snmp-version=2 --interface=11 --add-traffic
résultatOK: Interface 'ethernet_5' Traffic In : 1.28Kb/s (0.01%), Traffic Out : 1.43Kb/s (0.01%) | 'traffic_in'=1275.75b/s;;;0;10000000 'traffic_out'=1431.45b/s;;;0;10000000
-
list-storages
- Lister les disques d'un serveur
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=list-storages --hostname=192.168.0.175 --snmp-community=public --snmp-version=2
résultatList storage:
'C:\ Label: Serial Number 3cb3c66e' [size = 215212879872B] [id = 1]
'D:\ Label: Serial Number 52781efa' [size = 104752738304B] [id = 2]
Skipping storage 'E:\': no type or no matching filter type
Skipping storage 'F:\': no type or no matching filter type
Skipping storage 'Virtual Memory': no type or no matching filter type
Skipping storage 'Physical Memory': no type or no matching filter type -
storage
- Superviser un disque avec l'id
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=storage --hostname=192.168.0.175 --snmp-community=public --snmp-version=2 --storage=1
résultatOK: Storage 'C:\ Label: Serial Number 3cb3c66e' Usage Total: 200.43 GB Used: 24.91 GB (12.43%) Free: 175.52 GB (87.57%) | 'used'=26749784064B;;;0;215212879872
-
memory
- Superviser la mémoire du serveur
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=memory --hostname=192.168.0.175 --snmp-community=public --snmp-version=2
résultatOK: RAM Total: 3.89GB Used: 1.38GB (35.53%) Free: 2.51GB (64.47%) | 'used'=1482227712B;;;0;4172283904
-
processcount
- Ce mode permet de lister les processus lancés sur le serveur. Attention, lorsque vous faites vos tests, il y a un delta de quelques secondes pour obtenir le bon résultat. Voici un premier exemple pour le fonctionnement du service balloon pour la gestion d'une infra Proxmox.
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=processcount --hostname=192.168.0.19 --snmp-community=public --snmp-version=2 --memory --process-name='blnsvr.exe' --regexp-name --warning=1:1
résultat okOK: Number of current processes running: 1 - Total memory usage: 7.70 MB - Average memory usage: 7.70 MB | 'nbproc'=1;1:1;;0; 'mem_total'=8069120B;;;0; 'mem_avg'=8069120.00B;;;0;
résultat ko en mode warning car l'arrêt de ce service n'est pas critique.WARNING: Number of current processes running: 0 | 'nbproc'=0;1:1;;0;
Voici un autre exemple, pour retrouver un service ayant un nom identique à d'autre service comme svchost. Nous pouvons lister tous les services ayant un argument et un path avec les options suivantes et surtout l'option verbose très utile./usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=processcount --hostname=192.168.0.19 --snmp-community=public --snmp-version=2 --memory --process-name='svchost' --regexp-name --process-args=. --regexp-args --process-path=. --regexp-path --verbose
Voici la liste des processusOK: Number of current processes running: 14 - Total memory usage: 277.43 MB - Average memory usage: 19.82 MB | 'nbproc'=14;;;0; 'mem_total'=290902016B;;;0; 'mem_avg'=20778715.43B;;;0;
Process '1820' [name: svchost.exe] [status: running] [args: -k smbsvcs] [memory: 7.98 MB] [path: C:\Windows\System32\]
Process '920' [path: C:\Windows\system32\] [status: running] [name: svchost.exe] [args: -k appmodel] [memory: 18.75 MB]
Process '1420' [memory: 6.71 MB] [args: -k LocalServiceNetworkRestricted] [name: svchost.exe] [status: running] [path: C:\Windows\system32\]
Process '960' [path: C:\Windows\system32\] [name: svchost.exe] [status: running] [memory: 27.11 MB] [args: -k LocalService]
Process '684' [memory: 24.55 MB] [args: -k NetworkService] [status: running] [name: svchost.exe] [path: C:\Windows\system32\]
Process '3448' [path: C:\Windows\system32\] [status: running] [name: svchost.exe] [args: -k LocalServiceAndNoImpersonation] [memory: 8.83 MB]
Process '872' [args: -k LocalServiceNoNetwork] [memory: 17.05 MB] [name: svchost.exe] [status: running] [path: C:\Windows\system32\]
Process '688' [name: svchost.exe] [status: running] [args: -k RPCSS] [memory: 11.00 MB] [path: C:\Windows\system32\]
Process '640' [memory: 19.27 MB] [args: -k DcomLaunch] [name: svchost.exe] [status: running] [path: C:\Windows\system32\]
Process '824' [name: svchost.exe] [status: running] [args: -k netsvcs] [memory: 46.77 MB] [path: C:\Windows\System32\]
Process '2360' [path: C:\Windows\system32\] [args: -k UnistackSvcGroup] [memory: 20.74 MB] [status: running] [name: svchost.exe]
Process '1800' [path: C:\Windows\System32\] [args: -k utcsvc] [memory: 24.11 MB] [status: running] [name: svchost.exe]
Process '768' [path: C:\Windows\System32\] [status: running] [name: svchost.exe] [memory: 22.66 MB] [args: -k LocalServiceNetworkRestricted]
Process '1240' [path: C:\Windows\System32\] [memory: 21.90 MB] [args: -k LocalSystemNetworkRestricted] [name: svchost.exe] [status: running]
On pourra sélectionner finement le service voulu, comme le service DHCP ClientVoici l'exemple suivant/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=processcount --hostname=192.168.0.19 --snmp-community=public --snmp-version=2 --memory --process-name='svchost' --regexp-name --process-args='LocalServiceNetworkRestricted' --regexp-args --process-path=. --regexp-path
Nous aurons deux processus liés à ce service.OK: Number of current processes running: 2 - Total memory usage: 30.73 MB - Average memory usage: 15.37 MB | 'nbproc'=2;;;0; 'mem_total'=32223232B;;;0; 'mem_avg'=16111616.00B;;;0;
-
service
- Ce mode liste les services installés. Pour obtenir la liste des services installés, nous utiliserons la commandes suivantes
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=service --hostname=192.168.0.19 --snmp-community=public --snmp-version=2 --service=. --regexp --verbose
résultatOK: All service states are ok |
Service 'DNS Client' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Tile Data model server' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Sync Host_3bf35' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Network Store Interface Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Server' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Time' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Base Filtering Engine' match (pattern: '.') [operating state = active, installed state = installed]
Service 'User Access Logging Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Distributed Transaction Coordinator' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Time Broker' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Cryptographic Services' match (pattern: '.') [operating state = active, installed state = installed]
Service 'SNMP Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'User Manager' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Licensing Monitoring Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Management Instrumentation' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Program Compatibility Assistant Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'System Event Notification Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Remote Procedure Call (RPC)' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Local Session Manager' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Power' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Connected Devices Platform Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Network Location Awareness' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Connection Manager' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Remote Management (WS-Management)' match (pattern: '.') [operating state = active, installed state = installed]
Service 'QEMU Guest Agent' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Shell Hardware Detection' match (pattern: '.') [operating state = active, installed state = installed]
Service 'WinHTTP Web Proxy Auto-Discovery Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Font Cache Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'CDPUserSvc_3bf35' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Security Accounts Manager' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Diagnostic Policy Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'User Profile Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'RPC Endpoint Mapper' match (pattern: '.') [operating state = active, installed state = installed]
Service 'SSDP Discovery' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Update' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Task Scheduler' match (pattern: '.') [operating state = active, installed state = installed]
Service 'IP Helper' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Event Log' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Workstation' match (pattern: '.') [operating state = active, installed state = installed]
Service 'State Repository Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'TCP/IP NetBIOS Helper' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Network List Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Themes' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Background Tasks Infrastructure Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'DCOM Server Process Launcher' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Defender Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'System Events Broker' match (pattern: '.') [operating state = active, installed state = installed]
Service 'CNG Key Isolation' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Push Notifications System Service' match (pattern: '.') [operating state = active, installed state = installed]
Service 'COM+ Event System' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Connected User Experiences and Telemetry' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Windows Firewall' match (pattern: '.') [operating state = active, installed state = installed]
Service 'CoreMessaging' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Network Connection Broker' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Group Policy Client' match (pattern: '.') [operating state = active, installed state = installed]
Service 'DHCP Client' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Credential Manager' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Print Spooler' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Plug and Play' match (pattern: '.') [operating state = active, installed state = installed]
Service 'Distributed Link Tracking Client' match (pattern: '.') [operating state = active, installed state = installed]
Service pattern '.': service list DNS Client, Tile Data model server, Sync Host_3bf35, Network Store Interface Service, Server, Windows Time, Base Filtering Engine, User Access Logging Service, Distributed Transaction Coordinator, Time Broker, Cryptographic Services, SNMP Service, User Manager, Windows Licensing Monitoring Service, Windows Management Instrumentation, Program Compatibility Assistant Service, System Event Notification Service, Remote Procedure Call (RPC), Local Session Manager, Power, Connected Devices Platform Service, Network Location Awareness, Windows Connection Manager, Windows Remote Management (WS-Management), QEMU Guest Agent, Shell Hardware Detection, WinHTTP Web Proxy Auto-Discovery Service, Windows Font Cache Service, CDPUserSvc_3bf35, Security Accounts Manager, Diagnostic Policy Service, User Profile Service, RPC Endpoint Mapper, SSDP Discovery, Windows Update, Task Scheduler, IP Helper, Windows Event Log, Workstation, State Repository Service, TCP/IP NetBIOS Helper, Network List Service, Themes, Background Tasks Infrastructure Service, DCOM Server Process Launcher, Windows Defender Service, System Events Broker, CNG Key Isolation, Windows Push Notifications System Service, COM+ Event System, Connected User Experiences and Telemetry, Windows Firewall, CoreMessaging, Network Connection Broker, Group Policy Client, DHCP Client, Credential Manager, Print Spooler, Plug and Play, Distributed Link Tracking Client
Voici un autre exemple permettant de vérifier la présence du service Ballon pour Proxmox/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=service --hostname=192.168.0.19 --snmp-community=public --snmp-version=2 --service='Balloon Service' --state=active --critical=1:1
résultat OKOK: All service states are ok |
résultat service désinstalléCRITICAL: Service problem 'Balloon Service' |
-
swap
- Superviser le swap du serveur
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=swap --hostname=192.168.0.175 --snmp-community=public --snmp-version=2
résultatOK: Swap Total: 7.77 GB Used: 1.55 GB (19.93%) Free: 6.22 GB (80.07%) | 'used'=1662582784B;;;0;8342601728
-
time
- Vérification du décalage de l'heure du serveur par rapport à une base de temps (serveur ntp). Si le paramètre ntp-hostname est omis, on prendra le temps du poller qui supervise. Attention, par défaut c'est l'heure UTC qui est prise en compte. Pour un serveur Windows, le décalage ne doit pas être supérieure à 5 minutes pour le protocole kerberos mais nous allons être plus exigeant pour permettre un meilleur suivi des logs par exemple. J'ai fixé un seuil warning à 10 s et un seuil critique à 20 s pour éviter les faux positifs. Donc, pour un serveur se trouvant sur le fuseau horaire Europe/Paris
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=time --hostname=192.168.0.19 --snmp-community=public --snmp-version=2 --warning=-10:10 --critical=-20:20 --timezone='Europe/Paris' --ntp-hostname=0.europe.pool.ntp.org
résultatOK: Time offset 0 second(s) : 2018-07-03T19:49:15 (Europe/Paris) | 'offset'=0s;-10:10;-20:20;;
autre exemple en prenant le temps par défaut d'un poller ayant un problème de synchronisation horaire :/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=time --hostname=192.168.0.19 --snmp-community=public --snmp-version=2 --warning=-10:10 --critical=-20:20 --timezone='Europe/Paris'
le résultat est critiqueCRITICAL: Time offset 50 second(s) : 2018-07-03T19:51:09 (Europe/Paris) | 'offset'=50s;-10:10;-20:20;;
-
uptime
- Vérifie le temps de fonctionnement système
/usr/lib/centreon/plugins/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=uptime --hostname=192.168.0.175 --snmp-community=public --snmp-version=2
résultatOK: System uptime is: 41d 22h 29m 3s | 'uptime'=3623343s;;;0;
Notre exemple sera basé sur la supervision d'un serveur Wk 2003 nommé windows_server. Nous utiliserons le protocole SNMP V2 mais la configuration est identique pour le protocole SNMP V3, seul les paramètres d'authentification changerons. Nous utiliserons les modes cpu, memory, swap et storage. Notre configuration sera réalisée avec des templates et les macros personnalisées seront utilisées pour les paramètres.
1.1 Schéma global de la configuration
Voici la configuration de notre serveur de supervision. Nous utiliserons les préconisations Centreon à savoir une commande associé à un template de service. Nous aurons donc quatre commandes utilisant le plugin os::windows::snmp::plugin. Ces commandes seront associées à un template de service, la seule différence est pour le template des disques. Nous aurons un template de service générique décliné en deux templates.
windows_server
SNMP communauté : public
2 Création de la configuration avec clapi
Voici les relations entre les commandes et les modèle de services et d'hôtes.
2.2 La commande check-os-windows-snmp-cpu
Voici la configuration de la commande dans l'interface web.
Ci-dessous le champ Command Line de la commande check-os-windows-snmp-cpu.
$USER1$/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=cpu --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_HOSTOPTIONV3$ $_SERVICEOPTION$ --host=$HOSTADDRESS$ --snmp-version=$_HOSTSNMPVERSION$ --snmp-community=$_HOSTSNMPCOMMUNITY$
On construira les autres commandes avec les commandes clapi.
Centreon-Clapi
commande check-os-windows-snmp-cpu
commande check-os-windows-snmp-memory
commande check-os-windows-snmp-swap
commande check-os-windows-snmp-storage
commande check-os-windows-snmp-cpu
centreon -u admin -p password -o CMD -a ADD -v 'check-os-windows-snmp-cpu;check;$USER1$/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=cpu --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_HOSTOPTIONV3$ $_SERVICEOPTION$ --host=$HOSTADDRESS$ --snmp-version=$_HOSTSNMPVERSION$ --snmp-community=$_HOSTSNMPCOMMUNITY$'
commande check-os-windows-snmp-memory
centreon -u admin -p password -o CMD -a ADD -v 'check-os-windows-snmp-memory;check;$USER1$/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=memory --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_HOSTOPTIONV3$ $_SERVICEOPTION$ --host=$HOSTADDRESS$ --snmp-version=$_HOSTSNMPVERSION$ --snmp-community=$_HOSTSNMPCOMMUNITY$'
commande check-os-windows-snmp-swap
centreon -u admin -p password -o CMD -a ADD -v 'check-os-windows-snmp-swap;check;$USER1$/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=swap --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_HOSTOPTIONV3$ $_SERVICEOPTION$ --host=$HOSTADDRESS$ --snmp-version=$_HOSTSNMPVERSION$ --snmp-community=$_HOSTSNMPCOMMUNITY$'
commande check-os-windows-snmp-storage
centreon -u admin -p password -o CMD -a ADD -v 'check-os-windows-snmp-storage;check;$USER1$/centreon_plugins.pl --plugin=os::windows::snmp::plugin --mode=storage --storage=$_SERVICEDISKNAME$ --name --regexp --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_HOSTOPTIONV3$ $_SERVICEOPTION$ --host=$HOSTADDRESS$ --snmp-version=$_HOSTSNMPVERSION$ --snmp-community=$_HOSTSNMPCOMMUNITY$'
2.3 Les templates de service
Maintenant, il s'agit de créer les templates de services pour les modes que l'on a défini en début de chapitre.
Les templates de service se baseront sur le template générique de service generic-service. Voici les commandes clapi pour créer ces modèles de service.
Centreon-clapi
# CPU
# DISK
# Model Disk
# DISK
# Disk C:
# DISK
# Disk D:
# MEMORY
# SWAP
# CPU
centreon -u admin -p password -o STPL -a add -v "stpl-os-windows-snmp-cpu;cpu;generic-service"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-cpu;check_command;check-os-windows-snmp-cpu"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-cpu;WARNING;70"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-cpu;CRITICAL;90"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-cpu;graphtemplate;CPU"
# DISK
# Model Disk
centreon -u admin -p password -o STPL -a add -v "stpl-os-windows-snmp-storage;disk;generic-service"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-storage;check_command;check-os-windows-snmp-storage"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-storage;WARNING;80"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-storage;CRITICAL;90"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-storage;graphtemplate;Storage"
# DISK
# Disk C:
centreon -u admin -p password -o STPL -a add -v "stpl-os-windows-snmp-storage-C;Disk-C;stpl-os-windows-snmp-storage"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-storage-C;DISKNAME;'^C'"
# DISK
# Disk D:
centreon -u admin -p password -o STPL -a add -v "stpl-os-windows-snmp-storage-D;Disk-D;stpl-os-windows-snmp-storage"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-storage-D;DISKNAME;'^D'"
# MEMORY
centreon -u admin -p password -o STPL -a add -v "stpl-os-windows-snmp-memory;memory;generic-service"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-memory;check_command;check-os-windows-snmp-memory"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-memory;WARNING;70"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-memory;CRITICAL;90"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-memory;graphtemplate;Memory"
# SWAP
centreon -u admin -p password -o STPL -a add -v "stpl-os-windows-snmp-swap;swap;generic-service"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-swap;check_command;check-os-windows-snmp-swap"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-swap;WARNING;70"
centreon -u admin -p password -o STPL -a setmacro -v "stpl-os-windows-snmp-swap;CRITICAL;90"
centreon -u admin -p password -o STPL -a setparam -v "stpl-os-windows-snmp-swap;graphtemplate;Memory"
Vous obtiendrez, par exemple, le template stpl-os-windows-snmp-storage-D.
2.4 Le template d'hôte htpl-os-windows-server
Nous regrouperons les services dans le template d'hôte nommé htpl-os-windows-server.
Centreon-clapi
# htpl-os-windows-server
# htpl-os-windows-server
centreon -u admin -p password -o HTPL -a add -v "htpl-os-windows-server;htpl-os-windows-server;;;;"
centreon -u admin -p password -o STPL -a addhost -v "stpl-os-windows-snmp-cpu;htpl-os-windows-server"
centreon -u admin -p password -o STPL -a addhost -v "stpl-os-windows-snmp-storage-C;htpl-os-windows-server"
centreon -u admin -p password -o STPL -a addhost -v "stpl-os-windows-snmp-storage-D;htpl-os-windows-server"
centreon -u admin -p password -o STPL -a addhost -v "stpl-os-windows-snmp-memory;htpl-os-windows-server"
centreon -u admin -p password -o STPL -a addhost -v "stpl-os-windows-snmp-swap;htpl-os-windows-server"
2.5 Création de l'hôte Windows
Centreon-clapi
# CREATE HOST win2008srv
centreon -u admin -p password -o HOST -a add -v "win2008srv;serveur Wk2008 snmp V2;172.16.209.214;generic-host;Central;Windows-servers"
centreon -u admin -p password -o HTPL -a setparam -v "win2008srv;host_snmp_version;2c"
centreon -u admin -p password -o HTPL -a setparam -v "win2008srv;host_snmp_community;public"
centreon -u admin -p password -o HOST -a addtemplate -v "win2008srv;htpl-os-windows-server"
centreon -u admin -p password -o HOST -a applytpl -v "win2008srv"
# CREATE HOST win2008srv
centreon -u admin -p password -o HOST -a add -v "win2008srv;serveur Wk2008 snmp V2;172.16.209.214;generic-host;Central;Windows-servers"
centreon -u admin -p password -o HTPL -a setparam -v "win2008srv;host_snmp_version;2c"
centreon -u admin -p password -o HTPL -a setparam -v "win2008srv;host_snmp_community;public"
centreon -u admin -p password -o HOST -a addtemplate -v "win2008srv;htpl-os-windows-server"
centreon -u admin -p password -o HOST -a applytpl -v "win2008srv"
3 Vérification de la configuration
Appliquez la configuration. Vous devriez avoir cette vue pour les services après quelques minutes de fonctionnement.