In the Grafana documentation, I found that I should be able to query my Prometheus server for all instances delivering monitoring data using the label_values
query.
The query I'm using in Grafana is:
label_values(up, instance)
Unfortunately, Prometheus tells me that it is not aware of label_values:
Error executing query: parse error at char 13: unknown function with name "label_values"
I am using Prometheus 2.0.0 and Grafana 5.
What am I doing wrong?
To create a variable in Grafana that contains all values of a specific label in a specific metric you can use label_values(metric, label) .
To create a new variable, go to your Grafana dashboard settings, navigate to the Variable option in the side-menu, and then click the Add variable button. In this case, we use the Query type, where our variable will be defined as the result of an SQL query. Under the General section, we name our variable route .
Template variables enable users to create dashboards that change dynamically based on user input. Since variables have been around in Grafana for a long time, many users expect them to be supported for any data sources they install.
label_values()
is only a valid function within templating. You can use it to populate a template dropdown with e.g. a list of available instances or available metrics but you can't use it within a dashboard or when querying Prometheus directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With