Hello!
I use an "HTTP Agent" item type to query Zabbix API successfully.
The first step in obtaining API internal data is running the "user.login" method and obtaining an ID and access token from localhost. This item does just that, and feeds two dependent items that store the ID and result (token).
At this point, I have a host with two dependent itens storing the resulting ID and the token successfully. Until this point everything is fine.
On the next step, I need to query Zabbix API for a list of proxies in the system. For this, I created an discovery rule (HTTP Agent) that queries the API object "proxy.get" to obtain a list of proxies, in order to feed a LLD macro with the proxy names, so I can create an item for each proxy. My environment have almost 300 proxies, so I need to automate that discovery in order to generate alerts when a proxy delay is too high, and to keep the proxy list updated as I add and remove proxies.
My problem is: how I insert the data from "ID" and "Token" items obtained on the master items inside the "proxy.get" request body? I tought about using macros, but I couldn“t find a way to feed the data obtained from the items into two macros. so I don't know if it's a good approach.
Another possibility is to reference the data from the items directly inside the request body (that looks more elegant), but I have tried in many ways and had no luck with that.
What I am missing on this problem? Is there a third approach that I don't know or something I'm doing wrong?
Thanks in advance for any help.
I use an "HTTP Agent" item type to query Zabbix API successfully.
The first step in obtaining API internal data is running the "user.login" method and obtaining an ID and access token from localhost. This item does just that, and feeds two dependent items that store the ID and result (token).
At this point, I have a host with two dependent itens storing the resulting ID and the token successfully. Until this point everything is fine.
On the next step, I need to query Zabbix API for a list of proxies in the system. For this, I created an discovery rule (HTTP Agent) that queries the API object "proxy.get" to obtain a list of proxies, in order to feed a LLD macro with the proxy names, so I can create an item for each proxy. My environment have almost 300 proxies, so I need to automate that discovery in order to generate alerts when a proxy delay is too high, and to keep the proxy list updated as I add and remove proxies.
My problem is: how I insert the data from "ID" and "Token" items obtained on the master items inside the "proxy.get" request body? I tought about using macros, but I couldn“t find a way to feed the data obtained from the items into two macros. so I don't know if it's a good approach.
Another possibility is to reference the data from the items directly inside the request body (that looks more elegant), but I have tried in many ways and had no luck with that.
What I am missing on this problem? Is there a third approach that I don't know or something I'm doing wrong?
Thanks in advance for any help.
Comment