qshinoの日記

Powershell関係と徒然なこと

Powershell zabbix

Powershell で書くzabbix

zabbix_agentd.confに書くらしい。

Userparameter=vm.state,powershell.exe -NoProfile -ExecutionPolicy Bypass -file “C:\test.ps1”

スクリプトの中身は

— test.ps1

$Health = "poi"
foreach($State in $Health){
  if($state.Health -match "Normal"){
    $output = 2
  }else{
    $output = 1
  }
}
write-host $output

実行@zabbix server

zabbix_get -s -k vm.state

結果

1

バグがあると ZBX_NOTSUPPORTED が戻るらしい。

参考

https://www.zabbix.com/forum/showthread.php?t=45413