Dumps a prometheus query to a local file in a generic readable format for further data processing
promdump dump -u $PROM_URL '$PROM_QUERY' > query.json
Outputs the flattened query results as json to stdout that can be directly consumed by pandas via:
import pandas as pd
df = pd.read_json("query.json", orient="records")
print(df)
To get available metrics and their labels as JSON of a prometheus run
promdump metrics $PROM_URL
Multiple queries can be specified by separating them with a space.
Specifies the HTTP backend. Can be curl
or go
.
Specifies the name of the client certificate to use.
Specifies the serialization format. Can be json
or parquet
.
Specifies the data layout.
raw
directly serializes the response of prometheus.nested
creates "rows" of metric name, timestamp value and the label set as a nested element.flat
flattens the label set into the upper structure.
Specifies the compression for the output. Can be none
or gzip
.
Specifies the start timestamp for the query (layout: 2006-01-02T15:04:05
). Defaults to now - 5m
.
Specifies the end timestamp for the query (layout: 2006-01-02T15:04:05
). Defaults to now
.
Specifies the sample rate for the query. Defaults to 1m
.
Specifies the prometheis to query separated by ,
You need to enable that curl HTTP backend:
CURL_SSL_BACKEND=secure-transport promdump -b curl --client-cert $CERT_NAME dump -u $PROM_URL '$PROM_QUERY'