label_values multi column

37 views
Skip to first unread message

Danny de Waard

unread,
Sep 16, 2021, 1:05:58 AM9/16/21
to Grafana Developers
Is there a way to create a dashbord label_vlue which shows 2 columns?

For a dashboard i have a label_value like so:
label_values(node_exporter_build_info{job="node_exporter_metrics"}, instance)

Which shows a list of ip:port in the dashboard to choose from.
What i would like is that it also would show the host label.
Like ip:port - host.

Just because hostnames are easy to recognizxe and ip numbers are not....

Marcus Efraimsson

unread,
Sep 20, 2021, 5:15:11 AM9/20/21
to Grafana Developers
I don't think that's possible using label_values() at least. Have you considered using two variables, one for hostname and one for ip:port, filtering the ip:port by selected hostname(s)?

Danny de Waard

unread,
Sep 24, 2021, 7:58:29 AM9/24/21
to Grafana Developers
The variables now defined in my dashboard are:

Variable                Definition
datasource          prometheus
instance               label_values(node_exporter_build_info{job="node_exporter_metrics"}, instance)
host                      label_values(node_exporter_build_info{instance=~"$instance"}, host)

So they show up as 3 selctions in my dashboard.
What i would love is that i could combine a dropdownlist with ip:port_host so i know which host i'm choosing.

You could say, just change the selection method from instance to host, but this dashboard is called from another dashboard on instance... :)
Op maandag 20 september 2021 om 11:15:11 UTC+2 schreef mefra...@grafana.com:

Mohammad Khoschnasar

unread,
Nov 30, 2021, 9:24:19 AM11/30/21
to Grafana Developers
Hi,
I have almost the same problem.

I have two Traefik instances. The metrics of those two are going to one prometheus instance. In prometheus.yml, I have defined two jobs under the scrape_config and now in grafana I want to separate the services that coming from Traefik-A from the services coming from Traefik-B.I tried to use dependent variables as below:

label_values(up, instance)
label_values(up{instance="$instance"}, service)

But it doesn't show the proper values but "none"! I tried other combinations but no luck.
You guys have any idea?

Thanks
Reply all
Reply to author
Forward
0 new messages