Search code examples
prometheusgrafanaprometheus-node-exporter

How to query in grafana dynamically for prometheus scrape configs?


The provided grafana dashboard for node-exporter automatically retrieves the node-exporter scrape configs vor the variable job by this query: label_values(node_uname_info, job).

Is it possible to query for job variable values for my own prometheus scrape configs (for example by a pattern like prom-scrape-*)?

At the moment I'm using prometheus and grafana with docker. A kubernetes solution would be also nice.


Solution

    1. You configure a query in the grafana variable configuration which will return the required values.
    2. You extract the value by a regular expression.

    This example will extract all solr prometheus scrape jobs:

    Variable Configuration