How to scrape all metrics from a federate endpoint?

tex picture tex · Aug 31, 2016 · Viewed 9.6k times · Source

We have a hierachical prometheus setup with some server scraping others. We'd like to have some servers scrape all metrics from others.

Currently we try to use match[]="{__name__=~".*"}" as a metric selector, but this gives the error parse error at char 16: vector selector must contain at least one non-empty matcher.

Is there a way to scrape all metrics from a remote prometheus without listing each (prefix) as a match selector?

Answer

Julius picture Julius · Aug 31, 2016

Yes, you can do: match[]="{__name__=~".+"}" (note the + instead of * to not match the empty string).

Prometheus requires at least one matcher in a label matcher set that doesn't match everything.