Server version 4.4.10
Agent version 4.4.10
On the Zabbix server I created a template with a discovery rule:
(pwsh is PowerShell 7)
The PowerShell script:
1944:20220117:162431.318 EXECUTE_STR() command:'pwsh -NoProfile -ExecutionPolicy Bypass -File "C:\path\to\file.ps1"' len:387 cmd_result:'[
{
"{#ITEMN'
1944:20220117:162431.319 Sending back [[
{
"{#ITEMNAME}": "client1"
},
{
"{#ITEMNAME}": "client2"
}
]]
The items are indeed created in Zabbix.
When I execute
as a stand-alone line in Powershell, this is the output:
zabbix_sender.exe [8208]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 9; total: 9; seconds spent: 0.000065"}]
Response from "xxx.xxx.xxx.xxx:10051": "processed: 0; failed: 9; total: 9; seconds spent: 0.000065"
sent: 9; skipped: 0; total: 9
What am I doing wrong?
Any help is appreciated.
Agent version 4.4.10
On the Zabbix server I created a template with a discovery rule:
- Create a Template "Template test" and add that to the "Templates" group.
- For this template create a Discovery rule "Discover assets" of type "Zabbix agent" and key "assets.discovery".
- Create an Item prototype with name "Assets of {#ITEMNAME}" of type "Agent trapper", key "assets[{#ITEMNAME}]" of information type "numeric(unsigned)".
- Create a host "Test" in group "Templates", with the correct IP address and port and link this host to "Template test".
Code:
UserParameter=assets.discovery,pwsh -NoProfile -ExecutionPolicy Bypass -File "C:\path\to\file.ps1"
The PowerShell script:
- Outputs a JSON:
[
{"{#ITEMNAME}": "client1"},
{"{#ITEMNAME}": "client2"}
] - Creates a UTF8 text file file.txt containing:
MYHOSTNAME assets[client1] 123123123
MYHOSTNAME assets[client2] 456456456 - Calls zabbix_sender to send this text file to the server:
Code:zabbix_sender -vv -z xxx.xxx.xxx.xxx -i C:\path\to\file.txt
1944:20220117:162431.318 EXECUTE_STR() command:'pwsh -NoProfile -ExecutionPolicy Bypass -File "C:\path\to\file.ps1"' len:387 cmd_result:'[
{
"{#ITEMN'
1944:20220117:162431.319 Sending back [[
{
"{#ITEMNAME}": "client1"
},
{
"{#ITEMNAME}": "client2"
}
]]
The items are indeed created in Zabbix.
When I execute
Code:
zabbix_sender -vv -z xxx.xxx.xxx.xxx -i C:\path\to\file.txt
zabbix_sender.exe [8208]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 9; total: 9; seconds spent: 0.000065"}]
Response from "xxx.xxx.xxx.xxx:10051": "processed: 0; failed: 9; total: 9; seconds spent: 0.000065"
sent: 9; skipped: 0; total: 9
What am I doing wrong?
Any help is appreciated.

Comment