[ZBXNEXT-2546] Allow the use of inventory macros in item keys Created: 2014 Oct 27  Updated: 2025 Feb 21

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 2.2.7, 2.4.1
Fix Version/s: None

Type: New Feature Request Priority: Trivial
Reporter: Raymond Kuiper Assignee: Unassigned
Resolution: Unresolved Votes: 24
Labels: inventory, macros
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBXNEXT-4177 Allow usage of Inventory items as ite... Closed

 Description   

I'd like to be able to pass the data in the various inventory fields to external checks or userparameters so I can use that information in my check scripts.

For instance, we have populated the address, city and postal code fields in the inventory and we would like to use an external script to resolve this to coordinates. That way we can use the automatic inventory feature to update these fields. In order to use this information in the external check script, we need to pass the inventory macro's to the check script.



 Comments   
Comment by João Sena Ribeiro [ 2016 Mar 18 ]

Second this.

We populate the inventory fields automatically with some network information and would like to make some checks with those parameters (eg. test the network to the default gateway, which is in the "Host router" inventory field).

Comment by Vitaly Zhuravlev [ 2016 Nov 11 ]

INVENTORY.LAT and INVENTORY.LON and also INVENTORY.LOCATION can be used in external checks to some location based checks. (like current weather near site).
In my weather script I had to resort to usermacros and duplicate coordinates there so I can use coordinates in item key:
https://github.com/v-zhuravlev/zabbix-weather

What if most of the macros would be allowed to expand everywhere in the system? What are the risks?

There are many many nice use cases with different MACROSes used somewhere (use in URLs in external checks , in Scripts , etc) and those cases are hard to predict while developing.
Just check here if you don't believe me:
https://support.zabbix.com/issues/?jql=text%20~%20%22allow%20macro%22

Comment by Kirill H [ 2017 Sep 16 ]

Aaand I hit this issue today...
I have several virtual routers "in the cloud", and in addition to monitoring them directly, I wanted to set up additional monitoring using REST API that is provided by my host.
Luckily, Zabbix 3.4 supports JSON preprocessing now, so I cleared that headache.
However, to get data about specific KVM, I need to know its ID, and I can get that ID with another API call.
The idea was to store that ID in inventory as a "Tag" and then to call it as

{INVENTORY.ASSET.TAG}

in another item, to query a specific KVM instance.
I'm sure that I'll find a workaround, but this feature would be so much easier for me and less stressful for the CPU...

Comment by Tyron [ 2017 Oct 16 ]

This affects 3.4.2 as well

Comment by James Kirsop [ 2018 Nov 13 ]

This would be incredibly useful in the monitoring of discovered VM's where I need to query a (in my context) a HyperV FOCM server/domain controller for information about VMs in the cluster. To do that I need pass the node/physical host the VM lives on (which we're storing as an inventory item) in the key.

Comment by Raymond Kuiper [ 2019 Mar 18 ]

See also ZBXNEXT-5121

Comment by LivreAcesso.Pro [ 2023 Jun 24 ]

+1

Comment by LivreAcesso.Pro [ 2023 Jun 24 ]

I have many ONUs in the network. Some of then have a specific type I need to trigger if offline. I was obliged to create a user macro {$VIP} to use in the trigger. If I was able to use the {INVENTORY.*} as host item key it can make me avoid complex JavaScript preprocess do create a discovery macro to get a user macro.

Comment by LivreAcesso.Pro [ 2023 Oct 31 ]

Nothing yet?

Generated at Mon Mar 31 11:25:06 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.