promtool
Tooling for the Prometheus monitoring system.
Flags
Flag | Description |
---|---|
-h, –help |
Show context-sensitive help (also try –help-long and –help-man). |
–version |
Show application version. |
–experimental |
Enable experimental commands. |
–enable-feature |
Comma separated feature names to enable (only PromQL related and no-default-scrape-port). See https://prometheus.io/docs/prometheus/latest/feature_flags/ for the options and more details. |
Commands
Command | Description |
---|---|
help |
Show help. |
check |
Check the resources for validity. |
query |
Run query against a Prometheus server. |
debug |
Fetch debug information. |
push |
Push to a Prometheus server. |
test |
Unit testing. |
tsdb |
Run tsdb commands. |
promql |
PromQL formatting and editing. Requires the –experimental flag. |
promtool check
Check the resources for validity.
Flags
Flag | Description |
---|---|
–extended |
Print extended information related to the cardinality of the metrics. |
promtool check service-discovery
Perform service discovery for the given job name and report the results, including relabeling.
======= Flags
Flag | Description | Default |
---|---|---|
–timeout |
The time to wait for discovery results. |
|
======= Arguments
Argument | Description | Required |
---|---|---|
config-file |
The prometheus config file. |
Yes |
job |
The job to run service discovery for. |
Yes |
promtool check config
Check if the config files are valid or not.
======= Flags
Flag | Description | Default |
---|---|---|
–syntax-only |
Only check the config file syntax, ignoring file and content validation referenced in the config |
|
–lint |
Linting checks to apply to the rules specified in the config. Available options are: all, duplicate-rules, none. Use –lint=none to disable linting |
|
–lint-fatal |
Make lint errors exit with exit code 3. |
|
–agent |
Check config file for Prometheus in Agent mode. |
======= Arguments
Argument | Description | Required |
---|---|---|
config-files |
The config files to check. |
Yes |
promtool check web-config
Check if the web config files are valid or not.
======= Arguments
Argument | Description | Required |
---|---|---|
web-config-files |
The config files to check. |
Yes |
promtool check healthy
Check if the Prometheus server is healthy.
======= Flags
Flag | Description | Default |
---|---|---|
–http.config.file |
HTTP client configuration file for promtool to connect to Prometheus. |
|
–url |
The URL for the Prometheus server. |
|
promtool check ready
Check if the Prometheus server is ready.
======= Flags
Flag | Description | Default |
---|---|---|
–http.config.file |
HTTP client configuration file for promtool to connect to Prometheus. |
|
–url |
The URL for the Prometheus server. |
|
promtool check rules
Check if the rule files are valid or not.
======= Flags
Flag | Description | Default |
---|---|---|
–lint |
Linting checks to apply. Available options are: all, duplicate-rules, none. Use –lint=none to disable linting |
|
–lint-fatal |
Make lint errors exit with exit code 3. |
|
======= Arguments
Argument | Description |
---|---|
rule-files |
The rule files to check, default is read from standard input. |
promtool check metrics
Pass Prometheus metrics over stdin to lint them for consistency and correctness.
examples:
$ cat metrics.prom | promtool check metrics
$ curl -s http://localhost:9090/metrics | promtool check metrics
promtool query
Run query against a Prometheus server.
Flags
Flag | Description | Default |
---|---|---|
-o, –format |
Output format of the query. |
|
–http.config.file |
HTTP client configuration file for promtool to connect to Prometheus. |
promtool query instant
Run instant query.
======= Flags
Flag | Description |
---|---|
–time |
Query evaluation time (RFC3339 or Unix timestamp). |
======= Arguments
Argument | Description | Required |
---|---|---|
server |
Prometheus server to query. |
Yes |
expr |
PromQL query expression. |
Yes |
promtool query range
Run range query.
======= Flags
Flag | Description |
---|---|
–header |
Extra headers to send to server. |
–start |
Query range start time (RFC3339 or Unix timestamp). |
–end |
Query range end time (RFC3339 or Unix timestamp). |
–step |
Query step size (duration). |
======= Arguments
Argument | Description | Required |
---|---|---|
server |
Prometheus server to query. |
Yes |
expr |
PromQL query expression. |
Yes |
promtool query series
Run series query.
======= Flags
Flag | Description |
---|---|
–match |
Series selector. Can be specified multiple times. |
–start |
Start time (RFC3339 or Unix timestamp). |
–end |
End time (RFC3339 or Unix timestamp). |
======= Arguments
Argument | Description | Required |
---|---|---|
server |
Prometheus server to query. |
Yes |
promtool query labels
Run labels query.
======= Flags
Flag | Description |
---|---|
–start |
Start time (RFC3339 or Unix timestamp). |
–end |
End time (RFC3339 or Unix timestamp). |
–match |
Series selector. Can be specified multiple times. |
======= Arguments
Argument | Description | Required |
---|---|---|
server |
Prometheus server to query. |
Yes |
name |
Label name to provide label values for. |
Yes |
promtool query analyze
Run queries against your Prometheus to analyze the usage pattern of certain metrics.
======= Flags
Flag | Description | Default |
---|---|---|
–server |
Prometheus server to query. |
|
–type |
Type of metric: histogram. |
|
–duration |
Time frame to analyze. |
|
–time |
Query time (RFC3339 or Unix timestamp), defaults to now. |
|
–match |
Series selector. Can be specified multiple times. |
promtool debug
Fetch debug information.
promtool push
Push to a Prometheus server.
Flags
Flag | Description |
---|---|
–http.config.file |
HTTP client configuration file for promtool to connect to Prometheus. |
promtool push metrics
Push metrics to a prometheus remote write (for testing purpose only).
======= Flags
Flag | Description | Default |
---|---|---|
–label |
Label to attach to metrics. Can be specified multiple times. |
|
–timeout |
The time to wait for pushing metrics. |
|
–header |
Prometheus remote write header. |
======= Arguments
Argument | Description | Required |
---|---|---|
remote-write-url |
Prometheus remote write url to push metrics. |
Yes |
metric-files |
The metric files to push, default is read from standard input. |
promtool test
Unit testing.
promtool tsdb
Run tsdb commands.
promtool tsdb bench write
Run a write performance benchmark.
promtool tsdb analyze
Analyze churn, label pair cardinality and compaction efficiency.
promtool tsdb dump
Dump samples from a TSDB.
promtool tsdb dump-openmetrics
[Experimental] Dump samples from a TSDB into OpenMetrics format. Native histograms are not dumped.
promtool tsdb create-blocks-from
[Experimental] Import samples from input and produce TSDB blocks. Please refer to the storage docs for more details.
promtool tsdb create-blocks-from openmetrics
Import samples from OpenMetrics input and produce TSDB blocks. Please refer to the storage docs for more details.
promtool tsdb create-blocks-from rules
Create blocks of data for new recording rules.
Flags
Flag | Description | Default |
---|---|---|
–http.config.file |
HTTP client configuration file for promtool to connect to Prometheus. |
|
–url |
The URL for the Prometheus API with the data where the rule will be backfilled from. |
|
–start |
The time to start backfilling the new rule from. Must be a RFC3339 formatted date or Unix timestamp. Required. |
|
–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 |
Output directory for generated blocks. |
|
–eval-interval |
How frequently to evaluate rules when backfilling if a value is not set in the recording rule files. |
|