Zabbix Queries and variable manipulation

Hi Guys,

I have a dashboard with 2 datasources used (zabbix and cloudwatch).

I’m looking for a way to parse the metrics from zabbix depending on the values i get from cloudwatch queries.

For instance, i have a CW query returning 3 instances_ids.
Then i have a panel which will list all the hosts objects belonging to a host group (directly mapped to the cloudwatch datasource by naming convention).

The thing is, when i select one instance id on the dashboard (templating suggests to pick one or multiple instance id’s), i cant manage to correctly parse the metrics from zabbix where the instance_id value is in the host name.

The most i can do, is to graph all hosts belonging to a host group.

But i cant query the host metrics knowing the instance-id value is in the middle of the host name… it is actually : [[aws_datasource]]_[[instance_id]]_[[instance_name]].

When i write the query for the zabbix panel, it knows how to query /[[aws_datasource]]/ but not /[[aws_datasource]]_[[instance_id]].*/

Someone knows if this supported ?
I also checked if i could manipulate a query to concat aws_datasource and instance_id variables, but no luck.

Many thanks.

A followup, i managed to make it work, but it’s not working for repeated rows or panels.

The purpose was to join cloudwatch metrics with zabbix metrics using the cloudwatch instance id as a var to get the metrics from zabbix.

It just does not work with the All Option or multi select.

image

For the panel with zabbix metrics, i have a variable switch called zbx_instance_ids:

the instance_ids is a classic i-0123456789abcdef
the zba instance id, is a [[aws_datasource]][[instance_ids|UPPER_CASE]][[servername]]

The zbx_instance_id gets populated when there’s only on instance_id set. I was hoping the zbx_instance_id would switch between instance_ids when multiple values are selected so i can print as many instance i get using template filters.

Per row, there can only be one value zbx_instance_id per instance_ids used.

image

But i cant manage to make it work this way, any idea ?

Hi again,

The nested variable zbx_instance_id, just gets broken as soon as i select more than one instance_id.

On the variables setup panel, if there’s more than one instance_id selected, the query behaves like the zbx_instance_ids is “*”, it matches everything.

On the panel, the var zbx_instance_ids gets the first value and does not iterate over instance_ids.

When one instance_ids selected :


The zbx_instance_ids is matched and prints correct graph.

When more than one instance_id is selected :


The zbx_instance_ids variable query gets broken.