Custom Discovery PowerShell-Script: Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== Example Monitor Windows Storage Mountpoints == === PowerShell-Script on the target System === Write a PowerShell-Script "Get-CSVsForDiscovery.ps1" with the…“) |
Admin (Diskussion | Beiträge) |
||
(5 dazwischenliegende Versionen des gleichen Benutzers werden nicht angezeigt) | |||
Zeile 7: | Zeile 7: | ||
$final | $final | ||
</source> | </source> | ||
+ | ''The PowerShell-Script searches items in the Location "C:\ClusterStorage\". If the location of your mountpoints in another location, then you have to change this.'' | ||
+ | ''For each mountpoint it creates a Key-Value pair and converts this in JSON. After that it added some characters to make it zabbix compatible'' | ||
Zeile 15: | Zeile 17: | ||
=== Zabbix Discovery === | === Zabbix Discovery === | ||
+ | Create a new Zabbix Discovery:<br> | ||
+ | [[Datei:01-zabbix-custom-discovery-mountpoints.png]] | ||
+ | |||
+ | With filter rules that matches your Naming:<br> | ||
+ | [[Datei:01-01-zabbix-custom-discovery-mountpoints.png]] | ||
=== Zabbix Items Prototypes === | === Zabbix Items Prototypes === | ||
+ | Create new Zabbiy Item Prototypes:<br> | ||
+ | [[Datei:02-zabbix-custom-discovery-mountpoints.png]] | ||
=== Zabbix Triggers Prototypes === | === Zabbix Triggers Prototypes === | ||
+ | Create new Zabbix Trigger Prototypes:<br> | ||
+ | [[Datei:03-zabbix-custom-discovery-mountpoints.png]] | ||
+ | '''After all this steps, restart the Zabbix Agent on your target system.''' | ||
− | + | -> Done, have fun! :) | |
[[Kategorie:Zabbix]] | [[Kategorie:Zabbix]] |
Aktuelle Version vom 3. Dezember 2019, 11:25 Uhr
Inhaltsverzeichnis
Example Monitor Windows Storage Mountpoints
PowerShell-Script on the target System
Write a PowerShell-Script "Get-CSVsForDiscovery.ps1" with the following content and save this in "C:\Program Files\Zabbix Agent":
$json = (Get-ChildItem "C:\ClusterStorage\" | Select @{Name='{#CSVNAME}';Expression={$_.Name}} | ConvertTo-Json) $final = ('{"data":'+$json+'}') $final
The PowerShell-Script searches items in the Location "C:\ClusterStorage\". If the location of your mountpoints in another location, then you have to change this. For each mountpoint it creates a Key-Value pair and converts this in JSON. After that it added some characters to make it zabbix compatible
Zabbix Agent Configuration (zabbix_agentd.conf)
Add the following line:
UserParameter=custom.discovery.csvnames,powershell -File "C:\Program Files\Zabbix Agent\Get-CSVsForDiscovery.ps1"
Zabbix Discovery
Create a new Zabbix Discovery:
With filter rules that matches your Naming:
Zabbix Items Prototypes
Create new Zabbiy Item Prototypes:
Zabbix Triggers Prototypes
Create new Zabbix Trigger Prototypes:
After all this steps, restart the Zabbix Agent on your target system.
-> Done, have fun! :)