[ZBXNEXT-2896] Support macros {HOST.PORT} in item key parameters Created: 2015 Jul 30  Updated: 2021 Oct 11

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

Type: Change Request Priority: Minor
Reporter: amg1127 Assignee: Unassigned
Resolution: Unresolved Votes: 11
Labels: items, lld, macros
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I intend to create a low-level discovery rule, whose JSON data is going to be returned by an external check script. In order to discover objects from each monitored server, the script is going to call the zabbix_get utility.

In discovery settings, I may supply {HOST.CONN} as a key parameter and my script can use this data as the argument for --host . However, {HOST.PORT} is not supported there. I may create a user macro that holds the agent port number, however I wish I could get this data from the host configuration.

Could Zabbix support the macros {HOST.PORT} in item key parameters?



 Comments   
Comment by Aleksandrs Saveljevs [ 2015 Jul 31 ]

ZBX-5521 complains about the same for active Zabbix agent items - active items, similar to external checks, are not assigned to an interface.

Comment by Oleksii Zagorskyi [ 2015 Aug 21 ]

Similar request is ZBXNEXT-2913, but for ODBC items - SQL query field.

Comment by Raymond Kuiper [ 2016 Aug 22 ]

I'm trying to make my items more dynamic and would like to pass this macro to the net.tcp.service item as the port value. Now I have to work around this issue by supplying an extra macro just to register a port Zabbix already knows internally.

Not ideal as I have to adjust the port in multiple locations if I want to change it.
(Interface properties and host macros)

As the OP mentioned, this could be useful for external items or possibly userparameter items as well.

Comment by Tao Zhou [ 2019 Dec 04 ]
{HOST.PORT}

is not support in lots of places including web scenario, http agent URL, which means you can't monitor websites or services with non standard ports.

Comment by Gavin Hill [ 2020 Jan 23 ]

We have a lot of devices behind a PAT firewall, so the ability to put agents on different ports is critical.  Being unable to use the macro {HOST.PORT} in an item key means we can't use templates at all for thousands of hosts.

Comment by Richard Ostrochovský [ 2021 Oct 11 ]

This would be definitely useful, as absence of this creates kind of duplicity in configurations, by having configured {HOST.PORT} in host infterface (whatever agent it is), and then also user macro wit the same value, and item then seems e.g. like this:

net.tcp.service[tcp,{HOST.CONN},{$XYZ.TCP.PORT}]

This would be not just more elegant:

net.tcp.service[tcp,{HOST.CONN},{HOST.PORT}]
Generated at Tue Apr 23 13:34:34 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.