promtool(1)
πΈ NAME πΈ
okay so you're looking at the promtool(1) page β that's the manual for promtool, and the version stamped up top is 3.15.0. Bestie, it's literally Tooling for the Prometheus monitoring system. That's the whole name vibe. π
β¨ SYNOPSIS β¨
promtool [<flags>] <command> [<args> ...]
π DESCRIPTION π
Tooling for the Prometheus monitoring system. No cap, that's the description β short, sweet, and doing exactly what it says on the label. π
π OPTIONS π
-h,--helpβ Show context-sensitive help (also try--help-longand--help-man). It's giving "help me help you," and honestly? Iconic. π«Ά--versionβ Show application version. So you can check which era ofpromtoolyou're living in. β--experimentalβ Enable experimental commands. It's the "let me try something" flag, bestie. π§--enable-feature=β Comma separated feature names to enable. Valid options:promql-experimental-functions,promql-delayed-name-removal,promql-extended-range-selectors. Seehttps://prometheus.io/docs/prometheus/latest/feature_flags/for more details. Lowkey important: those names are exact, so don't freestyle them. π
β¨ COMMANDS β¨
okay bestie, this is the whole menu of stuff promtool can actually do. every subcommand with every flag, right here, no gatekeeping π
help [<command>...]
shows help. that's it, that's the whole vibe. ask it about a specific command and it'll spill the tea on that one π«Ά
check service-discovery [<flags>] <config-file> <job>
runs service discovery for the job name you give it and reports back the results, including relabeling. it's giving "show me what you actually found" β¨
--timeout=30sβ how long to wait for discovery results before giving up.
check config [<flags>] <config-files>...
the vibe check for your config files β valid or not, bestie? π
--syntax-onlyβ only checks the config file syntax. it ignores the file and content validation that the config references. so like, syntax slay, but it's not looking at the referenced stuff.--lint="duplicate-rules"β the linting checks to apply to the rules/scrape configs in the config. available options are:all,duplicate-rules,none,too-long-scrape-interval. use--lint=noneto disable linting entirely.--lint-fatalβ makes lint errors exit with exit code3. dramatic? yes. useful? also yes.--ignore-unknown-fieldsβ ignores unknown fields in the rule groups read by the config files. this is useful when you wanna extend rule files with custom metadata. but make sure you remove those fields before loading them into the Prometheus server, because it does strict checks by default π--agentβ checks the config file for Prometheus in Agent mode.
check web-config <web-config-files>...
same energy, but for your web config files. valid or not, one file at a time π¦
check healthy [<flags>]
pings the Prometheus server to see if it's healthy. wellness check for your server, lowkey π©Ίβ¨
--http.config.file=<filename>β HTTP client configuration file. the details live athttps://prometheus.io/docs/prometheus/latest/configuration/promtool--url=http://localhost:9090β the URL for the Prometheus server.
check ready [<flags>]
basically the same as healthy but for readiness β is it ready or is it still doing its hair π
--http.config.file=<filename>β HTTP client configuration file, see details athttps://prometheus.io/docs/prometheus/latest/configuration/promtool--url=http://localhost:9090β the URL for the Prometheus server.
check rules [<flags>] [<rule-files>...]
checks if your rule files are valid. rule files get the same rigorous vibe check π
--lint="duplicate-rules"β linting checks to apply. available options are:all,duplicate-rules,none. use--lint=noneto disable linting.--lint-fatalβ makes lint errors exit with exit code3.--ignore-unknown-fieldsβ ignores unknown fields in the rule files. useful when you wanna extend rule files with custom metadata. again: remove those fields before loading them into the Prometheus server, because it performs strict checks by default. no cap.
check metrics [<flags>]
feeds Prometheus metrics in over stdin and lints them for consistency and correctness β and if you want, it'll also do a cardinality analysis. main character energy for your metrics π₯
the examples, verbatim, because they're iconic:
$ cat metrics.prom | promtool check metrics
$ curl -s http://localhost:9090/metrics | promtool check metrics
--extended
$ curl -s http://localhost:9100/metrics | promtool check metrics
--extended --lint=none
--extendedβ prints extended information related to the cardinality of the metrics.--lint="all"β linting checks to apply for metrics. available options are:all,none. use--lint=noneto disable metrics linting.
query instant [<flags>] <server> <expr>
runs an instant query. one moment in time, one slay π
--time=TIMEβ query evaluation time (RFC3339 or Unix timestamp).--header=HEADERβ extra headers to send to server.
query range [<flags>] <server> <expr>
runs a range query. a whole era of time, bestie π
--header=HEADERβ extra headers to send to server.--start=STARTβ query range start time (RFC3339 or Unix timestamp).--end=ENDβ query range end time (RFC3339 or Unix timestamp).--step=STEPβ query step size (duration).
query series --match=MATCH [<flags>] <server>
runs a series query. --match=MATCH is a required flag here, iykyk π
--match=MATCHβ series selector. can be specified multiple times.--start=STARTβ start time (RFC3339 or Unix timestamp).--end=ENDβ end time (RFC3339 or Unix timestamp).
query labels [<flags>] <server> <name>
runs a labels query. gimme the label names π·οΈβ¨
--start=STARTβ start time (RFC3339 or Unix timestamp).--end=ENDβ end time (RFC3339 or Unix timestamp).--match=MATCHβ series selector. can be specified multiple times.
query analyze --server=SERVER --type=TYPE --match=MATCH [<flags>]
runs queries against your Prometheus to analyze the usage pattern of certain metrics. detective mode activated ππ
--server=SERVERβ Prometheus server to query.--type=TYPEβ type of metric:histogram.--duration=1hβ time frame to analyze.--time=TIMEβ query time (RFC3339 or Unix timestamp), defaults to now.--match=MATCHβ series selector. can be specified multiple times.
debug pprof <server>
fetches profiling debug information. for when you need to see what's going on inside π«£
debug metrics <server>
fetches metrics debug information.
debug all <server>
fetches all the debug information. the whole buffet π
push metrics [<flags>] <remote-write-url> [<metric-files>...]
pushes metrics to a Prometheus remote write β for testing purpose only β οΈ like, do not make this your whole personality, it's literally just for testing.
--label=job=promtoolβ label to attach to metrics. can be specified multiple times.--timeout=30sβ the time to wait for pushing metrics.--header=HEADERβ Prometheus remote write header.--protobuf_message="prometheus.WriteRequest"β protobuf message to use when writing (prometheus.WriteRequestorio.prometheus.write.v2.Request).--remote-write.path="/api/v1/write"β override the default remote write API path.
test rules [<flags>] <test-rule-file>...
unit tests for rules. yes bestie, we're testing the rules themselves π§ͺπ
--run=RUNβ if set, will only run test groups whose names match the regular expression. can be specified multiple times.--debugβ enable unit test debugging.--diffβ [Experimental] prints colored differential output between expected & received output.--ignore-unknown-fieldsβ ignores unknown fields in the test files. useful when you wanna extend rule files with custom metadata. and yes, remove those fields before loading them into the Prometheus server β strict checks by default, always π
tsdb bench write [<flags>] [<file>]
runs a write performance benchmark. let's see how hard your disk can go πββοΈπ¨
--out="benchout"β set the output path.--metrics=10000β number of metrics to read.--scrapes=3000β number of scrapes to simulate.
tsdb analyze [<flags>] [<db path>] [<block id>]
analyzes churn, label pair cardinality and compaction efficiency. the TSDB gossip session π
--limit=20β how many items to show in each list.--extendedβ run extended analysis.--match=MATCHβ series selector to analyze. only 1 set of matchers is supported now.
tsdb list [<flags>] [<db path>]
lists tsdb blocks. the lineup πΈ
-r,--human-readableβ print human readable values.
tsdb dump [<flags>] [<db path>]
dumps data (series+samples, or optionally just series) from a TSDB. dump it, queen π
--sandbox-dir-root=SANDBOX-DIR-ROOTβ root directory where a sandbox directory will be created. this sandbox is used in case WAL replay generates chunks (default is the database path). the sandbox is cleaned up at the end.--min-time=-9223372036854775808β minimum timestamp to dump, in milliseconds since the Unix epoch.--max-time=9223372036854775807β maximum timestamp to dump, in milliseconds since the Unix epoch.--match={__name__=~'(?s:.*)'}β series selector. can be specified multiple times.--format=promβ output format of the dump (prom(default) orseriesjson).
tsdb dump-openmetrics [<flags>] [<db path>]
[Experimental] dumps samples from a TSDB into OpenMetrics text format β excluding native histograms and staleness markers, which are not representable in OpenMetrics. be aware of the exclusions, bestie π
--sandbox-dir-root=SANDBOX-DIR-ROOTβ root directory where a sandbox directory will be created. this sandbox is used in case WAL replay generates chunks (default is the database path). the sandbox is cleaned up at the end.--min-time=-9223372036854775808β minimum timestamp to dump, in milliseconds since the Unix epoch.--max-time=9223372036854775807β maximum timestamp to dump, in milliseconds since the Unix epoch.--match={__name__=~'(?s:.*)'}β series selector. can be specified multiple times.
tsdb create-blocks-from openmetrics [<flags>] <input file> [<output directory>]
imports samples from OpenMetrics input and produces TSDB blocks. please refer to the storage docs for more details πβ¨
--label=LABELβ label to attach to metrics. can be specified multiple times. example:--label=label_name=label_value
tsdb create-blocks-from rules --start=START [<flags>] <rule-files>...
creates blocks of data for new recording rules. backfilling era π«
--http.config.file=<filename>β HTTP client configuration file, see details athttps://prometheus.io/docs/prometheus/latest/configuration/promtool--url=http://localhost:9090β the URL for the Prometheus API with the data where the rule will be backfilled from.--start=STARTβ the time to start backfilling the new rule from. must be a RFC3339 formatted date or Unix timestamp. required.--end=ENDβ if an end time is provided, all recording rules in the rule files provided will be backfilled to the end time. default will backfill up to 3 hours ago. must be a RFC3339 formatted date or Unix timestamp.--output-dir="data/"β output directory for generated blocks.--eval-interval=60sβ how frequently to evaluate rules when backfilling if a value is not set in the recording rule files.
promql format <query>
formats a PromQL query into pretty printed form. make it cute, make it readable π
promql label-matchers set [<flags>] <query> <name> <value>
sets a label matcher in the query.
-t,--type==β type of the label matcher to set.
promql label-matchers delete <query> <name>
deletes a label from the query. bye bye label ππ
and that's the whole page, bestie π«Ά this one's from the promtool manual β promtool, promtool(1) β straight out of the Prometheus source and version, dated whenever that build was cut β¨ go forth and lint responsibly π
π¦ where this page comes from
- epel 9: prometheus 3.15.0-1.el9 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MIT-0 AND MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms