Hi folks,
I was already thinking about this a couple of hours without "success" but maybe someone can help me with this.
We have a template created which is used by several hosts.
All of these hosts have a (visible) hostname of the following schema: SRV-XY-123
Now we have created an calculated item in this template which should the count of all hosts, which are in a specified group (My Group) AND have a specified tag (location_short:xy in our example; the xy is the middle part of the hostname the item "belongs to" - see host name schema).
Therefore I created the following formular for this calculated item:
Unfortunatly the result of this formula is always 0.
When I modify the formula on a single host to not use the macro in the filter, the item shows the correct count of hosts matching this search formula:
Based on the Foreach functions documentation (Item filter syntax > Conditions expression) I escaped all backslashes and double quotes in the filter/macro with an additional backslash as described in the documentation (otherwise/without escaping I cannot even save the item configuration).
The macro should be allowed in the formula and I should also be able to use macro functions here...
Has anyone an idea what I am missing?
We are using Zabbix 7.0.5
Kind regards,
Torben
I was already thinking about this a couple of hours without "success" but maybe someone can help me with this.
We have a template created which is used by several hosts.
All of these hosts have a (visible) hostname of the following schema: SRV-XY-123
Now we have created an calculated item in this template which should the count of all hosts, which are in a specified group (My Group) AND have a specified tag (location_short:xy in our example; the xy is the middle part of the hostname the item "belongs to" - see host name schema).
Therefore I created the following formular for this calculated item:
Code:
count(max_foreach(/*/zabbix[host,snmp,available]?[group="My Group" and tag="location_short:{{HOST.NAME}.iregsub(\"SRV-(\\w{,2})-\\d{3}\", \\1).lowercase()}"],1h))
When I modify the formula on a single host to not use the macro in the filter, the item shows the correct count of hosts matching this search formula:
Code:
count(max_foreach(/*/zabbix[host,snmp,available]?[group="My Group" and tag="location_short:xy"],1h))
The macro should be allowed in the formula and I should also be able to use macro functions here...
Has anyone an idea what I am missing?
We are using Zabbix 7.0.5
Kind regards,
Torben