Custom Discovery PowerShell-Script: Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
Zeile 19: Zeile 19:
Create a new Zabbix Discovery:<br>
Create a new Zabbix Discovery:<br>
With following filter rules:<br>

Version vom 3. Dezember 2019, 12:02 Uhr

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+'}')

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 following filter rules:

Zabbix Items Prototypes

Create new Zabbiy Item Prototypes:

Zabbix Triggers Prototypes

Create new Zabbix Trigger Prototypes:

-> Done, have fun! :)