Zabbix version 5.0
Hello,
I am trying to create a discovery rule to find folders and list their size.
This is what I have setup already but it isn't working
1. I have a powershell script to list all the folders and display it in JSON format:
2. I have added a UserParameter to run the powershell script
3. I have verified the script runs using:
I get the following output format:
4. This is what I have applied in Zabbix but I am getting no data. The server being monitored is showing no errors in the log file.


Help is greatly appreciated. Thanks
Hello,
I am trying to create a discovery rule to find folders and list their size.
This is what I have setup already but it isn't working

1. I have a powershell script to list all the folders and display it in JSON format:
Code:
WRITE-HOST "{"
WRITE-HOST "`"data`":["
$items = Get-ChildItem D:\Shares\OSTs\
$count = 0
ForEach ($item in $items) {
$n = $item.FullName -replace('\\','/')
WRITE-HOST "`{ `"`{`#FOLDERNAME`}`":`"$n`"`}"
$count++
if ($count -lt $items.Count) {
WRITE-HOST ","
}
}
WRITE-HOST "]"
WRITE-HOST "}"
Code:
UserParameter=folder.discovery,powershell -File "C:\zabbix\scripts\FolderSize.ps1"
Code:
zabbix_get -s SERVERNAME -k folder.discovery
Code:
{
"data":[
{ "{#FOLDERNAME}":"D:/Shares/OSTs/USERA"}
,
{ "{#FOLDERNAME}":"D:/Shares/OSTs/USERB"}
.....
]
}
Help is greatly appreciated. Thanks
Comment