Grafana内置参数
$__dashboard
当前dashboard的名称
$__from $__to
时间范围的毫秒值
可自定义格式,比如:{$__from: date :YYYY-MM-DD HH:mm:ss} {$__from: date :seconds}
$__interval
查询的时间间隔,包含单位,比如:30s,2m
$__interval_ms
查询的时间间隔,毫秒值
$__range
查询的时间区间大小,包含单位,比如:2d
$__range_s $__range_ms
查询的时间区间大小,分别是秒数和毫秒数
$__timeFilter
返回当前选择的时间范围表达式,比如:time > now() -7d,常用于数据库作为datasource的时候。
Query variable of Prometheus
Name | Description |
---|---|
label_names() | Returns a list of label names. |
label_values(label) | Returns a list of label values for the label in every metric. |
label_values(metric{condiation}, label) | Returns a list of label values for the label in the specified metric. 也可以设置label为metric限定范围,且grafana中设置多个参数时支持联动。 |
metrics(metric) | Returns a list of metrics matching the specified metric regex. |
query_result(query) | Returns a list of Prometheus query result for the query. |