Prometheus 查询所有的 metrics,limit 限制查询的数量, querying-metric-metadata:
$ curl "127.0.0.1:9090/api/v1/metadata?limit=2" |jq
{
"status": "success",
"data": {
"prometheus_tsdb_head_min_time": [
{
"type": "gauge",
"help": "Minimum time bound of the head block. The unit is decided by the library consumer.",
"unit": ""
}
],
"prometheus_tsdb_vertical_compactions_total": [
{
"type": "counter",
"help": "Total number of compactions done on overlapping blocks.",
"unit": ""
}
]
}
}
VictoriaMetrics 当前不支持。
Prometehus 查询 Series Value,注意这个方法只是查询满足条件的时间序列,没有数值:
$ curl -g 'http://127.0.0.1:9090/api/v1/series' --data-urlencode 'match[]=vm_rows{}' --data-urlencode 'start=2020-03-02T00:00:00Z|jq
{
"status": "success",
"data": [
{
"__name__": "vm_rows",
"instance": "vmstorage:8482",
"job": "victoria",
"type": "indexdb"
},
{
"__name__": "vm_rows",
"instance": "vmstorage:8482",
"job": "victoria",
"type": "storage/big"
},
{
"__name__": "vm_rows",
"instance": "vmstorage:8482",
"job": "victoria",
"type": "storage/small"
}
]
}
VictoriaMetrics 支持:
$ curl 'http://127.0.0.1:8481/select/0/prometheus/api/v1/series' --data-urlencode 'match[]=vm_rows{}' |jq
Prometeus:
$ curl 127.0.0.1:9090/api/v1/labels |jq
{
"status": "success",
"data": [
"GOARCH",
"GOOS",
"GOROOT",
"__name__",
"accountID",
"action",
...
$ curl 127.0.0.1:9090/api/v1/label/job/values | jq
{
"status": "success",
"data": [
"prometheus",
"victoria"
]
}
VictoriaMetrics 支持:
$ curl 127.0.0.1:8481/select/0/prometheus/api/v1/labels |jq
$ curl 127.0.0.1:8481/select/0/prometheus/api/v1/label/job/values | jq
Prometheus 当前值查询:
$ curl 'http://localhost:9090/api/v1/query?query=vm_rows' |jq
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "vm_rows",
"instance": "vmstorage:8482",
"job": "victoria",
"type": "indexdb"
},
"value": [
1583123606.056,
"14398"
]
},
...
VictoriaMetrics 支持。
$ curl 'http://localhost:8481/select/0/prometheus/api/v1/query?query=vm_rows' |jq