Hi Team,
I'm on Zabbix 8.0.0rc2 collecting OTEL gauge metrics via TELEMETRY_QUERY items. My ClickHouse has data from multiple devices, and I need each host to filter for its own device at the query level., where my hosts would be created dynamically from discovery.
What I tried:
Adding ResourceAttributes.device.name as a filter condition with a macro:
filter: conditions:
- column: MetricName
value: my.metric.name
- column: ResourceAttributes
attribute_key: device.name
value: '{$MY.DEVICE}'
The macro {$MY.DEVICE} is correctly set on the host (value = mydevice01.example.com).
I also tried {HOST.HOST}.
Both return no data.
It appears the filter condition value field treats macros as literal strings — it's querying ClickHouse for ResourceAttributes['device.name'] = '{$MY.DEVICE}' instead of resolving it to mydevice01.example.com. So the query matches nothing.
What works:
If I remove the ResourceAttributes filter and instead filter in a JavaScript preprocessing step, the same macro resolves fine and returns data:
var c = JSON.parse(value).columns;
if (c['ResourceAttributes.device.name'] === '{$MY.DEVICE}')
{ return c.value;}
return '';
So the macro resolves in preprocessing but not in the TELEMETRY_QUERY filter.
Why this matters:
Without query-level filtering, the TELEMETRY_QUERY returns data for all devices and preprocessing has to discard non-matching rows. This works but is inefficient — especially with many devices.
Questions:
1.Are macros supported in TELEMETRY_QUERY filter condition values, or are they treated as literal strings by design?
2.If not currently supported, is this planned for a future release?
3.Is there a recommended way to filter by a per-host dynamic value at the query level?
Thanks
I'm on Zabbix 8.0.0rc2 collecting OTEL gauge metrics via TELEMETRY_QUERY items. My ClickHouse has data from multiple devices, and I need each host to filter for its own device at the query level., where my hosts would be created dynamically from discovery.
What I tried:
Adding ResourceAttributes.device.name as a filter condition with a macro:
filter: conditions:
- column: MetricName
value: my.metric.name
- column: ResourceAttributes
attribute_key: device.name
value: '{$MY.DEVICE}'
The macro {$MY.DEVICE} is correctly set on the host (value = mydevice01.example.com).
I also tried {HOST.HOST}.
Both return no data.
It appears the filter condition value field treats macros as literal strings — it's querying ClickHouse for ResourceAttributes['device.name'] = '{$MY.DEVICE}' instead of resolving it to mydevice01.example.com. So the query matches nothing.
What works:
If I remove the ResourceAttributes filter and instead filter in a JavaScript preprocessing step, the same macro resolves fine and returns data:
var c = JSON.parse(value).columns;
if (c['ResourceAttributes.device.name'] === '{$MY.DEVICE}')
{ return c.value;}
return '';
So the macro resolves in preprocessing but not in the TELEMETRY_QUERY filter.
Why this matters:
Without query-level filtering, the TELEMETRY_QUERY returns data for all devices and preprocessing has to discard non-matching rows. This works but is inefficient — especially with many devices.
Questions:
1.Are macros supported in TELEMETRY_QUERY filter condition values, or are they treated as literal strings by design?
2.If not currently supported, is this planned for a future release?
3.Is there a recommended way to filter by a per-host dynamic value at the query level?
Thanks