Score:0

zabbix - passing result of one item into the URL for a second item

us flag

I'm currently using Zabbix 5.0. I have a monitoring item of type HTTP Agent set up that calls a REST API to retieve an item of data.

Is there a way to pass the result of that first item into the string for a second item?

e.g.

item 1 + pre-processing:
http://{username}:{password}@10.1.2.3:8443/api/metadata/

retrieves the value 12345 with a name of Server_ID

can I then use that Server_ID value in the second one?

e.g.

item2
http://{username}:{password}@10.1.2.3:8443/api/metadata/{Server_ID}/status

These would both be part of the same template.

I've seen there are type:dependent items but that seems to be for retrieving multiple pieces of data from the first item only. I've also seen there is something about type:scripts in 5.4 that may be what I want, but I don't know how long it will be before we upgrade to that version.

Score:1
in flag

No, it doesn't.

There are only some macros you can use in the URL field:

Supported macros: {HOST.IP}, {HOST.CONN}, {HOST.DNS}, {HOST.HOST}, {HOST.NAME}, {ITEM.ID}, {ITEM.KEY}, user macros, low-level discovery macros.

That's it.

I haven't tried it, but the low-level discovery macros sound interesting. If the server ID you get with your first check is constant for the server, you could turn your check into a discovery rule that creates the actual check. You can use the same prepocessing steps there and it should allow you to use the ID in the actual check.

IGGt avatar
us flag
The Discovery Rules looks like it could work, if only I could actually make it work. So far it has led to more questions and much head scratching.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.