Prometheus API
Run PromQL queries on Prometheus (also VictoriaMetrics, Thanos, Mimir) as rows, read series, targets, alerts and rules, and push to a Pushgateway. Typical uses: put metrics in a report, publish the metrics of a batch job.
prometheus pingprometheus infoprometheus queryprometheus queryprometheus query_rangeprometheus query_rangeprometheus seriesprometheus seriesprometheus labelsprometheus labelsprometheus label_valuesprometheus label_valuesprometheus targetsprometheus targetsprometheus alertsprometheus alertsprometheus rulesprometheus rulesprometheus metadataprometheus metadataprometheus pushprometheus pushprometheus push_deleteprometheus push_deleteprometheus requestprometheus request

prometheus ping <config>


Description

    Test the connection: the build information of Prometheus (the Pushgateway answers with its status, other servers with /-/healthy). Returns {ok, version}

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
admin
prometheus ping "{\"url\": \"http://127.0.0.1:9090\"}"
mentdb
{"ok": true, "version": "3.16.0"}
a Pushgateway (fixed result: real Pushgateway 1.11.4, scraped by Prometheus 3.16.0)
admin
prometheus ping "{\"url\": \"http://127.0.0.1:9091\"}"
mentdb
{"ok": true, "version": "1.11.4"}
Nothing listens on this port
admin
prometheus ping "{\"url\": \"http://127.0.0.1:1\", \"timeout_ms\": 2000}"
mentdb
ERROR: Sorry, an error appears (cannot connect to Prometheus at '127.0.0.1:1').

prometheus info <config>


Description

    The build and runtime information: {build: {version, revision, goVersion...}, runtime: {startTime, storageRetention...}}

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
admin
prometheus info "{\"url\": \"http://127.0.0.1:9090\"}"
mentdb
{"build": {"version": "3.16.0", "revision": "e2e28adeee2c5883d000fc82aca6008cfbf7e96d", "branch": "HEAD", "buildUser": "root@a907c793e8bc", "buildDate": "20261105-15:10:12", "goVersion": "go1.27.3"}, "runtime": {"startTime": "2026-11-17T15:49:55.874389Z", "CWD": "/opt/prometheus", "hostname": "prometheus-host", "serverTime": "2026-11-17T16:08:04.109317Z", "reloadConfigSuccess": true, "lastConfigTime": "2026-11-17T15:49:56Z", "corruptionCount": 0, "goroutineCount": 39, "GOMAXPROCS": 11, "GOMEMLIMIT": 17394617548, "GOGC": "75", "GODEBUG": "", "storageRetention": "15d"}}

prometheus query <config> <promql>


Description

    An instant PromQL query, evaluated now. Returns rows: labels, value, time

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    promql:   The PromQL expression - String - required
admin
prometheus query "{\"url\": \"http://127.0.0.1:9090\"}" "up"
mentdb
[{"__name__": "up", "instance": "127.0.0.1:9091", "job": "pushgateway", "value": 1, "time": "2026-11-17T16:08:04.876Z"}, {"__name__": "up", "instance": "127.0.0.1:9090", "job": "prometheus", "value": 1, "time": "2026-11-17T16:08:04.876Z"}]
a scalar (fixed result: real Prometheus 3.16.0)
admin
prometheus query "{\"url\": \"http://127.0.0.1:9090\"}" "scalar(sum(up))"
mentdb
[{"value": 2, "time": "2026-11-17T16:08:05.658Z"}]
a syntax error (fixed result: real Prometheus 3.16.0)
admin
prometheus query "{\"url\": \"http://127.0.0.1:9090\"}" "sum(rate("
mentdb
ERROR: Sorry, an error appears (Prometheus error HTTP 400: bad_data: invalid parameter "query": 1:10: parse error: unclosed left parenthesis).

prometheus query <config> <promql> <options_json>


Description

    An instant query with options: time (the evaluation time), timeout (a duration given to Prometheus), limit (the maximum number of rows: 10000), time_format

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    promql:   The PromQL expression - String - required
    options_json:   The options - String - required
admin
prometheus query "{\"url\": \"http://127.0.0.1:9090\"}" "sum by (job) (up)" "{\"time\": \"2026-11-17T16:00:00Z\"}"
mentdb
[{"job": "pushgateway", "value": 1, "time": "2026-11-17T16:00:00Z"}, {"job": "prometheus", "value": 1, "time": "2026-11-17T16:00:00Z"}]
a range selector gives every sample (here as unix seconds) (fixed result: real Prometheus 3.16.0)
admin
prometheus query "{\"url\": \"http://127.0.0.1:9090\"}" "up{job=\"prometheus\"}[12s]" "{\"time\": \"2026-11-17T16:00:00Z\", \"time_format\": \"unix\"}"
mentdb
[{"__name__": "up", "instance": "127.0.0.1:9090", "job": "prometheus", "value": 1, "time": 1794931190.308}, {"__name__": "up", "instance": "127.0.0.1:9090", "job": "prometheus", "value": 1, "time": 1794931195.308}]
A bad url
admin
prometheus query "{\"url\": \"ftp://127.0.0.1:9090\"}" "up" "{}"
mentdb
ERROR: Sorry, an error appears (the parameter 'url' must be a URL like http://127.0.0.1:9090).

prometheus query_range <config> <promql> <start> <end> <step>


Description

    A range query from start to end with a step. Returns rows in long format: labels, value, time

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    promql:   The PromQL expression - String - required
    start:   The start: now-1h, an ISO 8601 time or a unix time - String - required
    end:   The end - String - required
    step:   The step: 15s, 1m, 1h or seconds - String - required
admin
prometheus query_range "{\"url\": \"http://127.0.0.1:9090\"}" "sum by (job) (up)" "2026-11-17T16:00:00Z" "2026-11-17T16:02:00Z" "1m"
mentdb
[{"job": "prometheus", "value": 1, "time": "2026-11-17T16:00:00Z"}, {"job": "prometheus", "value": 1, "time": "2026-11-17T16:01:00Z"}, {"job": "prometheus", "value": 1, "time": "2026-11-17T16:02:00Z"}, {"job": "pushgateway", "value": 1, "time": "2026-11-17T16:00:00Z"}, {"job": "pushgateway", "value": 1, "time": "2026-11-17T16:01:00Z"}, {"job": "pushgateway", "value": 1, "time": "2026-11-17T16:02:00Z"}]
Too many points per series
admin
prometheus query_range "{\"url\": \"http://127.0.0.1:9090\"}" "up" "now-30d" "now" "10s"
mentdb
ERROR: Sorry, an error appears (more than 11000 points per series ((end - start) / step): raise 'step' or shorten the range).

prometheus query_range <config> <promql> <start> <end> <step> <options_json>


Description

    A range query with options: timeout, limit (100000 rows), time_format

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    promql:   The PromQL expression - String - required
    start:   The start - String - required
    end:   The end - String - required
    step:   The step - String - required
    options_json:   The options - String - required
admin
prometheus query_range "{\"url\": \"http://127.0.0.1:9090\"}" "rate(prometheus_http_requests_total{handler=\"/metrics\"}[1m])" "2026-11-17T16:00:00Z" "2026-11-17T16:01:00Z" "30s" "{\"time_format\": \"unix_ms\"}"
mentdb
[{"code": "200", "handler": "/metrics", "instance": "127.0.0.1:9090", "job": "prometheus", "value": 0.19999999999999998, "time": 1794931200000}, {"code": "200", "handler": "/metrics", "instance": "127.0.0.1:9090", "job": "prometheus", "value": 0.19999999999999998, "time": 1794931230000}, {"code": "200", "handler": "/metrics", "instance": "127.0.0.1:9090", "job": "prometheus", "value": 0.19999636370247814, "time": 1794931260000}]
more rows than the limit (fixed result: real Prometheus 3.16.0)
admin
prometheus query_range "{\"url\": \"http://127.0.0.1:9090\"}" "up" "2026-11-17T16:00:00Z" "2026-11-17T16:02:00Z" "1m" "{\"limit\": 3}"
mentdb
ERROR: Sorry, an error appears (more than 3 rows: narrow the query or raise 'limit').

prometheus series <config> <match>


Description

    The series (label sets) matching a selector. Returns rows of labels

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    match:   A series selector (up, {job="api"}, http_requests_total{code=~"5.."}) or a JSON array of selectors - String - required
admin
prometheus series "{\"url\": \"http://127.0.0.1:9090\"}" "up"
mentdb
[{"__name__": "up", "instance": "127.0.0.1:9091", "job": "pushgateway"}, {"__name__": "up", "instance": "127.0.0.1:9090", "job": "prometheus"}]

prometheus series <config> <match> <options_json>


Description

    The series with options: start, end, limit (10000)

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    match:   A series selector (up, {job="api"}, http_requests_total{code=~"5.."}) or a JSON array of selectors - String - required
    options_json:   The options - String - required
admin
prometheus series "{\"url\": \"http://127.0.0.1:9090\"}" "[\"up\", \"prometheus_build_info\"]" "{\"start\": \"now-5m\"}"
mentdb
[{"__name__": "prometheus_build_info", "branch": "HEAD", "goarch": "arm64", "goos": "darwin", "goversion": "go1.27.3", "instance": "127.0.0.1:9090", "job": "prometheus", "revision": "e2e28adeee2c5883d000fc82aca6008cfbf7e96d", "tags": "netgo,builtinassets", "version": "3.16.0"}, {"__name__": "up", "instance": "127.0.0.1:9090", "job": "prometheus"}, {"__name__": "up", "instance": "127.0.0.1:9091", "job": "pushgateway"}]

prometheus labels <config>


Description

    The label names. Returns a JSON array

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
admin
prometheus labels "{\"url\": \"http://127.0.0.1:9090\"}"
mentdb
["__name__", "alertmanager", "alertname", "alertstate", "branch", "call", "code", "compression", "config", "dialer_name", "endpoint", "event", "goarch", "goos", "goversion", "handler", "instance", "interval", "job", "le", "listener_name", "method", "name", "quantile", "reason", "revision", "role", "rule_group", "scrape_job", "severity", "slice", "tags", "type", "version"]

prometheus labels <config> <options_json>


Description

    The label names with options: match (selectors), start, end, limit (10000: more names is an error, never a silent cut)

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    options_json:   The options - String - required
admin
prometheus labels "{\"url\": \"http://127.0.0.1:9090\"}" "{\"match\": \"up\"}"
mentdb
["__name__", "instance", "job"]

prometheus label_values <config> <label>


Description

    The values of a label. Returns a JSON array

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    label:   The label name - String - required
admin
prometheus label_values "{\"url\": \"http://127.0.0.1:9090\"}" "job"
mentdb
["nightly_import", "prometheus", "pushgateway"]

prometheus label_values <config> <label> <options_json>


Description

    The values of a label with options: match, start, end, limit (10000: more values is an error, never a silent cut)

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    label:   The label name - String - required
    options_json:   The options - String - required
admin
prometheus label_values "{\"url\": \"http://127.0.0.1:9090\"}" "instance" "{\"match\": \"up{job=\\"pushgateway\\"}\"}"
mentdb
["127.0.0.1:9091"]

prometheus targets <config>


Description

    The scrape targets. Returns rows {state, pool, job, instance, url, health, last_scrape, duration_s, error, labels}

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
admin
prometheus targets "{\"url\": \"http://127.0.0.1:9090\"}"
mentdb
[{"state": "active", "pool": "prometheus", "job": "prometheus", "instance": "127.0.0.1:9090", "url": "http://127.0.0.1:9090/metrics", "health": "up", "last_scrape": "2026-11-17T16:08:15.309358Z", "duration_s": 0.0045015, "error": null, "labels": {"instance": "127.0.0.1:9090", "job": "prometheus"}}, {"state": "active", "pool": "pushgateway", "job": "pushgateway", "instance": "127.0.0.1:9091", "url": "http://127.0.0.1:9091/metrics", "health": "up", "last_scrape": "2026-11-17T16:08:13.191026Z", "duration_s": 0.00124625, "error": null, "labels": {"instance": "127.0.0.1:9091", "job": "pushgateway"}}]

prometheus targets <config> <options_json>


Description

    The scrape targets with options: state (active, dropped or any), time_format

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    options_json:   The options - String - required
admin
prometheus targets "{\"url\": \"http://127.0.0.1:9090\"}" "{\"state\": \"dropped\"}"
mentdb
[]

prometheus alerts <config>


Description

    The alerts of the alerting rules (pending and firing). Returns rows {alertname, state, active_at, value, labels, annotations}

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
admin
prometheus alerts "{\"url\": \"http://127.0.0.1:9090\"}"
mentdb
[{"alertname": "AlwaysFiring", "state": "firing", "active_at": "2026-11-17T15:50:00.270650774Z", "value": 1, "labels": {"alertname": "AlwaysFiring", "severity": "info"}, "annotations": {"summary": "Test alert that always fires"}}]

prometheus alerts <config> <options_json>


Description

    The alerts with options: time_format

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    options_json:   The options - String - required
admin
prometheus alerts "{\"url\": \"http://127.0.0.1:9090\"}" "{\"time_format\": \"unix\"}"
mentdb
[{"alertname": "AlwaysFiring", "state": "firing", "active_at": 1794930600.270650774, "value": 1, "labels": {"alertname": "AlwaysFiring", "severity": "info"}, "annotations": {"summary": "Test alert that always fires"}}]

prometheus rules <config>


Description

    The alerting and recording rules. Returns rows {group, file, type (alert or record), name, query, health, state, alerts, error, last_evaluation, labels, annotations}

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
admin
prometheus rules "{\"url\": \"http://127.0.0.1:9090\"}"
mentdb
[{"group": "mentdb_test", "file": "prom/rules.yml", "type": "record", "name": "job:up:sum", "query": "sum by (job) (up)", "health": "ok", "state": null, "alerts": null, "error": null, "last_evaluation": "2026-11-17T16:08:15.312233Z", "labels": {}, "annotations": null}, {"group": "mentdb_test", "file": "prom/rules.yml", "type": "alert", "name": "AlwaysFiring", "query": "vector(1)", "health": "ok", "state": "firing", "alerts": 1, "error": null, "last_evaluation": "2026-11-17T16:08:15.312486Z", "labels": {"severity": "info"}, "annotations": {"summary": "Test alert that always fires"}}]

prometheus rules <config> <options_json>


Description

    The rules with options: type (alert, record or any), time_format

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    options_json:   The options - String - required
admin
prometheus rules "{\"url\": \"http://127.0.0.1:9090\"}" "{\"type\": \"record\"}"
mentdb
[{"group": "mentdb_test", "file": "prom/rules.yml", "type": "record", "name": "job:up:sum", "query": "sum by (job) (up)", "health": "ok", "state": null, "alerts": null, "error": null, "last_evaluation": "2026-11-17T16:08:15.312233Z", "labels": {}, "annotations": null}]

prometheus metadata <config>


Description

    The metadata of the metrics (type, help, unit). Returns rows {metric, type, help, unit}

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
admin
prometheus metadata "{\"url\": \"http://127.0.0.1:9090\"}"
mentdb
[{"metric": "go_gc_cleanups_executed_cleanups_total", "type": "counter", "help": "Approximate total count of cleanup functions (created by runtime.AddCleanup) executed by the runtime. Subtract /gc/cleanups/queued:cleanups to approximate cleanup queue length. Useful for detecting slow cleanups holding up the queue. Sourced from /gc/cleanups/executed:cleanups.", "unit": null}, {"metric": "go_gc_cleanups_queued_cleanups_total", "type": "counter", "help": "Approximate total count of cleanup functions (created by runtime.AddCleanup) queued by the runtime for execution. Subtract from /gc/cleanups/executed:cleanups to approximate cleanup queue length. Useful for detecting slow cleanups holding up the queue. Sourced from /gc/cleanups/queued:cleanups.", "unit": null}, {"metric": "go_gc_cycles_automatic_gc_cycles_total", "type": "counter", "help": "Count of completed GC cycles generated by the Go runtime. Sourced from /gc/cycles/automatic:gc-cycles.", "unit": null}]

prometheus metadata <config> <options_json>


Description

    The metadata with options: metric (one metric), limit (10000 metrics)

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    options_json:   The options - String - required
admin
prometheus metadata "{\"url\": \"http://127.0.0.1:9090\"}" "{\"metric\": \"prometheus_http_requests_total\"}"
mentdb
[{"metric": "prometheus_http_requests_total", "type": "counter", "help": "Counter of HTTP requests.", "unit": null}]

prometheus push <config> <job> <metrics>


Description

    Push metrics to a Pushgateway for a job (mode replace: every metric of the group is replaced). Returns {pushed, path, mode, bytes}

Parameters

    config:   The Pushgateway configuration as JSON: url (http://127.0.0.1:9091), username with password (basic authentication, often a reverse proxy), or token (a bearer token), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    job:   The job name - String - required
    metrics:   The metrics: a text in the Prometheus exposition format, or the JSON of prometheus format - String - required
admin
prometheus push "{\"url\": \"http://127.0.0.1:9091\"}" "nightly_import" "[{\"name\": \"import_rows\", \"type\": \"gauge\", \"help\": \"Rows imported by the last run\", \"value\": 1200}, {\"name\": \"import_last_success_seconds\", \"type\": \"gauge\", \"value\": 1794931200}]"
mentdb
{"pushed": true, "path": "/metrics/job/nightly_import", "mode": "replace", "bytes": 171}
then Prometheus scrapes it (fixed result: real Prometheus 3.16.0)
admin
prometheus query "{\"url\": \"http://127.0.0.1:9090\"}" "import_rows"
mentdb
[{"__name__": "import_rows", "job": "nightly_import", "value": 1200, "time": "2026-11-17T16:08:22.613Z"}]
a text in the exposition format (fixed result: real Pushgateway 1.11.4, scraped by Prometheus 3.16.0)
admin
prometheus push "{\"url\": \"http://127.0.0.1:9091\"}" "backup" "backup_size_bytes{db=\"shop\"} 52428800"
mentdb
{"pushed": true, "path": "/metrics/job/backup", "mode": "replace", "bytes": 38}
a bad text (fixed result: real Pushgateway 1.11.4, scraped by Prometheus 3.16.0)
admin
prometheus push "{\"url\": \"http://127.0.0.1:9091\"}" "backup" "not a metric {"
mentdb
ERROR: Sorry, an error appears (Pushgateway error HTTP 400: text format parsing error in line 1: expected float as value, got "a").

prometheus push <config> <job> <metrics> <options_json>


Description

    Push metrics with options: grouping (more labels of the group, as a JSON object), mode (replace: PUT, or add: POST, which replaces only the metrics with the same name)

Parameters

    config:   The Pushgateway configuration as JSON: url (http://127.0.0.1:9091), username with password (basic authentication, often a reverse proxy), or token (a bearer token), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    job:   The job name - String - required
    metrics:   The metrics - String - required
    options_json:   The options - String - required
admin
prometheus push "{\"url\": \"http://127.0.0.1:9091\"}" "nightly_import" "import_errors 3" "{\"grouping\": {\"instance\": \"srv/1\", \"shop\": \"Paris\"}, \"mode\": \"add\"}"
mentdb
{"pushed": true, "path": "/metrics/job/nightly_import/instance@base64/c3J2LzE=/shop/Paris", "mode": "add", "bytes": 16}

prometheus push_delete <config> <job>


Description

    Delete a group of the Pushgateway (job only: the group without other labels). Returns {deleted}

Parameters

    config:   The Pushgateway configuration as JSON: url (http://127.0.0.1:9091), username with password (basic authentication, often a reverse proxy), or token (a bearer token), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    job:   The job name - String - required
admin
prometheus push_delete "{\"url\": \"http://127.0.0.1:9091\"}" "backup"
mentdb
{"deleted": "/metrics/job/backup"}

prometheus push_delete <config> <job> <options_json>


Description

    Delete a group with options: grouping (the other labels of the group)

Parameters

    config:   The Pushgateway configuration as JSON: url (http://127.0.0.1:9091), username with password (basic authentication, often a reverse proxy), or token (a bearer token), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    job:   The job name - String - required
    options_json:   The options - String - required
admin
prometheus push_delete "{\"url\": \"http://127.0.0.1:9091\"}" "nightly_import" "{\"grouping\": {\"instance\": \"srv/1\", \"shop\": \"Paris\"}}"
mentdb
{"deleted": "/metrics/job/nightly_import/instance@base64/c3J2LzE=/shop/Paris"}

prometheus request <config> <method> <path>


Description

    Any request to the API: method (GET, POST, PUT, PATCH, DELETE, HEAD) and path under the url (with its query string). Returns the answer text

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    method:   The HTTP method - String - required
    path:   The path, starting with / - String - required
admin
prometheus request "{\"url\": \"http://127.0.0.1:9090\"}" "GET" "/api/v1/status/tsdb?limit=2"
mentdb
{"status":"success","data":{"headStats":{"numSeries":1129,"numLabelPairs":600,"chunkCount":2234,"minTime":1794930603148,"maxTime":1794931705309},"seriesCountByMetricName":[{"name":"prometheus_http_request_duration_seconds_bucket","value":140},{"name":"prometheus_http_response_size_bytes_bucket","value":126}],"labelValueCountByLabelName":[{"name":"__name__","value":364},{"name":"le","value":88}],"memoryInBytesByLabelName":[{"name":"__name__","value":57854},{"name":"instance","value":28025}],"seriesCountByLabelValuePair":[{"name":"job=prometheus","value":1048},{"name":"instance=127.0.0.1:9090","value":1047}]}}
A path with ..
admin
prometheus request "{\"url\": \"http://127.0.0.1:9090\"}" "GET" "/../etc/passwd"
mentdb
ERROR: Sorry, an error appears (the parameter 'path' must start with / (like /api/v1/status/config), without spaces, . or .. segments).

prometheus request <config> <method> <path> <body_json>


Description

    Any request with a JSON body

Parameters

    config:   The configuration as JSON: url (http://127.0.0.1:9090, with a path prefix if any: https://mimir.example.com/prometheus, http://vm:8428 for VictoriaMetrics, http://thanos-query:10902), username with password (basic authentication, often a reverse proxy), or token (a bearer token), tenant (the X-Scope-OrgID header of Mimir and Cortex; several tenants joined by |), timeout_ms (30000: the longest silence of the server; a whole answer must arrive within 10 x timeout_ms), max_bytes (64 MB, 256 MB at most: the largest answer read), ca_file (a PEM file of a private CA, with https), allow_plain (false: credentials over http are refused unless the host is this machine) - String - required
    method:   The HTTP method - String - required
    path:   The path - String - required
    body_json:   The JSON body - String - required
admin
prometheus request "{\"url\": \"http://127.0.0.1:9091\"}" "PUT" "/api/v1/admin/wipe" "{}"
mentdb
{"status": 202}