global labels?

465 views
Skip to first unread message

jer...@doupe.com

unread,
Jul 12, 2017, 6:18:41 PM7/12/17
to Prometheus Users
I know there is `external_labels` and `labels` under static_configs. The first only applies labels to external systems (as the name implies), and the second only applies to the static targets specified.  

Is there a way to apply a global label to all scrape targets?

The desire is to have a "datacenter" label for one or more instances that will be scraped by a central instance a la /federate.  Yes, I can add datacenter as an `external_label`, but there is also a desire to write only one set of queries/dashboards.  If they are written with the datacenter label in mind via a grafana template variable, then those same dashboards won't work if/when copied to look at a localized prometheus instance.


Brian Brazil

unread,
Jul 12, 2017, 6:22:37 PM7/12/17
to jer...@doupe.com, Prometheus Users
On 12 July 2017 at 23:18, <jer...@doupe.com> wrote:
I know there is `external_labels` and `labels` under static_configs. The first only applies labels to external systems (as the name implies), and the second only applies to the static targets specified.  

Is there a way to apply a global label to all scrape targets?

This is what external_labels is designed for.
 
The desire is to have a "datacenter" label for one or more instances that will be scraped by a central instance a la /federate.  Yes, I can add datacenter as an `external_label`, but there is also a desire to write only one set of queries/dashboards.  If they are written with the datacenter label in mind via a grafana template variable, then those same dashboards won't work if/when copied to look at a localized prometheus instance.

The way to approach this is to always use the per-datacenter Prometheus instance for these dashboards, as this avoids any unreliability of the central instance affecting your main dashboards.

--

Ben Kochie

unread,
Jul 13, 2017, 3:58:14 AM7/13/17
to jer...@doupe.com, Prometheus Users
Grafana can template which Prometheus server to talk to for a dashboard, avoiding the need to federate any data to have a single dashboard for all datacenters.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/ac4a6c4e-7ea4-461d-8ee1-78943bba5149%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jer...@doupe.com

unread,
Jul 13, 2017, 3:00:45 PM7/13/17
to Prometheus Users, jer...@doupe.com
Definitely understand that, however, setting up 30+ datasources (and maintaining that) in grafana is not something I wanted to do.


On Thursday, July 13, 2017 at 2:58:14 AM UTC-5, Ben Kochie wrote:
Grafana can template which Prometheus server to talk to for a dashboard, avoiding the need to federate any data to have a single dashboard for all datacenters.
On Thu, Jul 13, 2017 at 12:18 AM, <jer...@doupe.com> wrote:
I know there is `external_labels` and `labels` under static_configs. The first only applies labels to external systems (as the name implies), and the second only applies to the static targets specified.  

Is there a way to apply a global label to all scrape targets?

The desire is to have a "datacenter" label for one or more instances that will be scraped by a central instance a la /federate.  Yes, I can add datacenter as an `external_label`, but there is also a desire to write only one set of queries/dashboards.  If they are written with the datacenter label in mind via a grafana template variable, then those same dashboards won't work if/when copied to look at a localized prometheus instance.


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.

Tobias Schmidt

unread,
Jul 13, 2017, 5:17:15 PM7/13/17
to jer...@doupe.com, Prometheus Users
You could take a look at Grafana's data source API http://docs.grafana.org/http_api/data_source/.

Reply all
Reply to author
Forward
0 new messages