Всех приветствую, недавно познакомился с zabbix и начал с версии 6.0. Столкнулся со следующей проблемой.
Я нашел скрипт
$items = Get-WmiObject Win32_PerfFormattedData_PerfOS_Processor | select name |where-object {$_.name -ne '_Total'}
write-host -NoNewline "{"
write-host -NoNewline "`"data`":["
$line = "{`"{#PROCNUM}`":`"" + $items[0].Name + "`"}"
write-host -NoNewline $line
for($c = 1; $c -lt $items.Count; ++$c) {
$line = ",{`"{#PROCNUM}`":`"" + $items[$c].Name + "`"}"
write-host -NoNewline $line
}
write-host -NoNewline "]"
write-host -NoNewline "}"
Скрипт этот добавил в конфиг
UserParameter=PSScript[*],powershell -File C:\zabbix\scripts\PROCNUM.ps1 $1
Далее на host создал discovery rule
Type zabbix agent
Key PSScript[proc.ps1]
В item prototypes создал item
type Zabbix_agent
Key perf_counter[\238({#PROCNUM})\6,60]
Type of information numeric float
И собственно сама проблема, zabbix на меня ругается, говорит, что в discovery rule "status not supported" а info "Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: '?????????? ????㧨?? 䠩? C:\zabbix\scripts\PROCNUM.ps1, ⠪ ??? ?믮?????? ?業?ਥ? ?⪫?祭? ? ?⮩ ??⥬?. ??? ???
?祭?? ???????⥫??? ᢥ????? ?"
Я нашел скрипт
$items = Get-WmiObject Win32_PerfFormattedData_PerfOS_Processor | select name |where-object {$_.name -ne '_Total'}
write-host -NoNewline "{"
write-host -NoNewline "`"data`":["
$line = "{`"{#PROCNUM}`":`"" + $items[0].Name + "`"}"
write-host -NoNewline $line
for($c = 1; $c -lt $items.Count; ++$c) {
$line = ",{`"{#PROCNUM}`":`"" + $items[$c].Name + "`"}"
write-host -NoNewline $line
}
write-host -NoNewline "]"
write-host -NoNewline "}"
Скрипт этот добавил в конфиг
UserParameter=PSScript[*],powershell -File C:\zabbix\scripts\PROCNUM.ps1 $1
Далее на host создал discovery rule
Type zabbix agent
Key PSScript[proc.ps1]
В item prototypes создал item
type Zabbix_agent
Key perf_counter[\238({#PROCNUM})\6,60]
Type of information numeric float
И собственно сама проблема, zabbix на меня ругается, говорит, что в discovery rule "status not supported" а info "Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: '?????????? ????㧨?? 䠩? C:\zabbix\scripts\PROCNUM.ps1, ⠪ ??? ?믮?????? ?業?ਥ? ?⪫?祭? ? ?⮩ ??⥬?. ??? ???
?祭?? ???????⥫??? ᢥ????? ?"
Comment