How to display graph by group and instance?

I have a stack of Grafana, prometheus and Node executor. In prometheus I have labels instance and group.
Where my instance query all ip and my group segragate this IP’s to their respective environments(projects).

Now here is the trivial question. When i try to create a template in grafana - datasource:prometheus
query: label_values(node_boot_time,instance) => it displays IP only in preview.

How will i display only ip’s that are member of the group I label?

If I use create a template in grafana - datasource:prometheus
query: label_values(node_boot_time,group) => it displays group only and no IP in preview.

Please advise.

Hi,

I assume that you want to be able to filter on template variable group and the result should filter your template variable instance accordingly together with your panels with graphs/data.

If you create the template variable for group and set the Name=group and Query=label_values(node_boot_time,group). Then you create the template variable for instance and set the Name=insance Query=label_values(node_boot_time{group=~"^$group"},instance). Then in your panels/queries you’ll use the `{instance=~"^$instance"} filter.

Please checkout the templating documentation and the Prometheus templating documentation for more information.

Hope this helps

Marcus

1 Like

are there video tutorials that you mention?
Thanks.