Zabbix v.4.2.1
Hello!
I'm trying to automate routine work, so I decided to use API.
My installation: 1 Zabbix server and 2 Zabbix proxies (active).
I'm going to monitor a lot of websites, and all these checks must be done from Proxy #2. And for each website will be separate host attached to Proxy #2. So:
1. I've created a template with 1 web scenario, which will use User Macro
2. I've written a script for adding host to Zabbix.
When I run a script, everything works, new host with correct macro appears in Zabbix Server, BUT it doesn't won't to be attached to proxy. It appears like I've added it directly to server.
Please see my json that is sent to the server for creating new host:
It attaches to correct group, template (IDs are getting above in the same script). But it doesn't want to be monitored by proxy. ID of Proxy is correct, as it is received by request in the same script.
Please see attached image - on it you'll find the result of the script.
P.S. ID of proxy is correct: When I open "Administration -> Proxies -> click on my proxy" - it shows me this URL: https://some-zabbix.url/zabbix.php?a...&proxyid=10583
Much appreciated for your help
Hello!
I'm trying to automate routine work, so I decided to use API.
My installation: 1 Zabbix server and 2 Zabbix proxies (active).
I'm going to monitor a lot of websites, and all these checks must be done from Proxy #2. And for each website will be separate host attached to Proxy #2. So:
1. I've created a template with 1 web scenario, which will use User Macro
2. I've written a script for adding host to Zabbix.
When I run a script, everything works, new host with correct macro appears in Zabbix Server, BUT it doesn't won't to be attached to proxy. It appears like I've added it directly to server.
Please see my json that is sent to the server for creating new host:
Code:
{
"jsonrpc":"2.0",
"method":"host.create",
"params":{
"host":"Domain-example.com",
"interfaces":[
{
"type":1,
"main":1,
"useip":1,
"ip":"127.0.0.1",
"dns":"",
"port":"10050"
}
],
"groups":[
{
"groupid":"17"
}
],
"templates":[
{
"templateid":"10586"
}
],
"macros":[
{
"macro":"{$REAL_DOMAIN_NAME}",
"value":"example.com"
}
]
},
"proxy_hostid":"10583",
"auth":"some auth",
"id":1
}
Please see attached image - on it you'll find the result of the script.
P.S. ID of proxy is correct: When I open "Administration -> Proxies -> click on my proxy" - it shows me this URL: https://some-zabbix.url/zabbix.php?a...&proxyid=10583
Much appreciated for your help
Comment