AMTOOL(1)
π NAME π
amtool β Tooling for the Prometheus alert manager β¨
πΈ SYNOPSIS πΈ
amtool [<flags>] <command> [<args> ...]
π¦ DESCRIPTION π¦
Bestie, amtool is literally here so you can view and modify the current Alertmanager state. It's giving main character energy. π
Config File: The alertmanager tool will read a config file in YAML format from one of two default config locations: $HOME/.config/prometheus/amtool.yml or /etc/prometheus/amtool.yml. ποΈ
All flags can be given in the config file, but the following are the ones suited for static configuration:
alertmanager.urlβ set a default alertmanager url for each request πauthorβ set a default author value for new silences. If this argument is not specified then the username will be used βοΈrequire-commentβ Bool, whether to require a comment on silence creation. Defaults totrueβoutputβ set a default output type. Options are (simple,extended,json) π¨date.formatβ sets the output format for dates. Defaults to"2006-01-02 15:04:05 MST"πhttp.config.fileβ HTTP client configuration file for amtool to connect to Alertmanager. The format ishttps://prometheus.io/docs/alerting/latest/configuration/#http_config. π
π OPTIONS π
-h,--helpβ Show context-sensitive help (also try--help-longand--help-man). π--date.formatβ Format of date output π-v,--verboseβ Verbose running information π--alertmanager.url=http://localhost:9093/β Alertmanager to talk to π¬-o,--output=simpleβ Output formatter (simple,extended,json) π¨--timeout=30sβ Timeout for the executed command β³--http.config.file=<filename>β HTTP client configuration file for amtool to connect to Alertmanager. π--version-checkβ Check alertmanager version. Use--no-version-checkto disable. π--enable-featureβ Experimental features to enable, comma separated. Valid options:alert-names-in-metrics,receiver-name-in-metrics,group-key-in-metrics,classic-mode,utf8-strict-mode,auto-gomemlimit,event-recorderπ§ͺ--versionβ Show application version. π¦
π COMMANDS π
okay bestie, this is the actual main character section β every single subcommand amtool ships with. no skipping, no skimming, we're going through all of them together π
π¬ help [<command>...]
Show help.
that's it, that's the whole vibe. ask for help, receive help. iconic. β¨
π¨ alert query [<flags>] [<matcher-groups>...]
View and search through current alerts.
Amtool has a simplified prometheus query syntax, but contains robust support for bash variable expansions. The non-option section of arguments constructs a list of "Matcher Groups" that will be used to filter your query. The following examples will attempt to show this behaviour in action:
amtool alert query alertname=foo node=bar
This query will match all alerts with the alertname=foo and node=bar label value pairs set.
amtool alert query foo node=bar
If alertname is omitted and the first argument does not contain a = or a =~ then it will be assumed to be the value of the alertname pair.
amtool alert query 'alertname=~foo.*'
As well as direct equality, regex matching is also supported. The =~ syntax (similar to prometheus) is used to represent a regex match. Regex matching can be used in combination with a direct match.
Amtool supports several flags for filtering the returned alerts by state (inhibited, silenced, active, unprocessed). If none of these flags is given, only active alerts are returned. so like, pick your fighter or just vibe with the default πΈ
-i,--inhibitedβ Show inhibited alerts-s,--silencedβ Show silenced alerts-a,--activeβ Show active alerts-u,--unprocessedβ Show unprocessed alerts-r,--receiver=RECEIVERβ Show alerts matching receiver (Supports regex syntax)
β alert add [<flags>] [<labels>...]
Add a new alert.
This command is used to add a new alert to Alertmanager.
To add a new alert with labels:
amtool alert add alertname=foo node=bar
If alertname is omitted and the first argument does not contain a = then it will be assumed to be the value of the alertname pair.
amtool alert add foo node=bar
One or more annotations can be added using the --annotation flag:
amtool alert add foo node=bar
--annotation=runbook='http://runbook.biz'
--annotation=summary='summary of the alert'
--annotation=description='description of the alert'
Additional flags such as --generator-url, --start, and --end are also supported. (yes bestie, those are the next three right here, we love a callback π
)
--generator-url=GENERATOR-URLβ Set the URL of the source that generated the alert--start=STARTβ Set when the alert should start. RFC3339 format2006-01-02T15:04:05-07:00--end=ENDβ Set when the alert should end. RFC3339 format2006-01-02T15:04:05-07:00--annotation=ANNOTATIONβ Set an annotation to be included with the alert
π silence add [<flags>] [<matcher-groups>...]
Add a new alertmanager silence
This statement will add a silence that matches alerts with the alertname=foo and node=bar label value pairs set.
If alertname is omitted and the first argument does not contain a = or a =~ then it will be assumed to be the value of the alertname pair.
As well as direct equality, regex matching is also supported. The =~ syntax (similar to Prometheus) is used to represent a regex match. Regex matching can be used in combination with a direct match. shhhh time π€«
-a,--author=AUTHORβ Username forCreatedByfield-d,--duration="1h"β Duration of silence--start=STARTβ Set when the silence should start. RFC3339 format2006-01-02T15:04:05-07:00--end=ENDβ Set when the silence should end (overwrites duration). RFC3339 format2006-01-02T15:04:05-07:00-c,--comment=COMMENTβ A comment to help describe the silence--annotation=ANNOTATIONβ Set an annotation to be included with the silence
lowkey important:--endoverwrites--duration, so don't set both and expect the duration to win, because it will not. π«Ά
β³ silence expire [<silence-ids>...]
expire an alertmanager silence
feed it silence IDs and those silences get yeeted into the expired pile. bye bestie π
π₯ silence import [<flags>] [<input-file>]
Import alertmanager silences from JSON file or stdin
This command can be used to bulk import silences from a JSON file created by query command. For example:
amtool silence query -o json foo > foo.json
amtool silence import foo.json
JSON data can also come from stdin if no param is specified. pipes stay winning π
-f,--forceβ Force adding new silences even if it already exists-w,--worker=8β Number of concurrent workers to use for import
π silence query [<flags>] [<matcher-groups>...]
Query Alertmanager silences.
Amtool has a simplified prometheus query syntax, but contains robust support for bash variable expansions. The non-option section of arguments constructs a list of "Matcher Groups" that will be used to filter your query. The following examples will attempt to show this behaviour in action:
amtool silence query alertname=foo node=bar
This query will match all silences with the alertname=foo and node=bar label value pairs set.
amtool silence query foo node=bar
If alertname is omitted and the first argument does not contain a = or a =~ then it will be assumed to be the value of the alertname pair.
amtool silence query 'alertname=~foo.*'
As well as direct equality, regex matching is also supported. The =~ syntax (similar to prometheus) is used to represent a regex match. Regex matching can be used in combination with a direct match.
In addition to filtering by silence labels, one can also query for silences that are due to expire soon with the --within parameter. In the event that you want to preemptively act upon expiring silences by either fixing them or extending them. For example:
amtool silence query --within 8h
returns all the silences due to expire within the next 8 hours. This syntax can also be combined with the label based filtering above for more flexibility. mix and match, it's giving customizable β¨
The --expired parameter returns only expired silences. Used in combination with --within=TIME, amtool returns the silences that expired within the preceding duration.
amtool silence query --within 2h --expired
returns all silences that expired within the preceding 2 hours.
--expiredβ Show expired silences instead of active-q,--quietβ Only show silence ids--created-by=CREATED-BYβ Show silences that belong to this creator--id=IDβ Get a single silence by its ID--within=WITHINβ Show silences that will expire or have expired within a duration
βοΈ silence update [<flags>] [<update-ids>...]
Update silences
-q,--quietβ Only show silence ids-d,--duration=DURATIONβ Duration of silence--start=STARTβ Set when the silence should start. RFC3339 format2006-01-02T15:04:05-07:00--end=ENDβ Set when the silence should end (overwrites duration). RFC3339 format2006-01-02T15:04:05-07:00-c,--comment=COMMENTβ A comment to help describe the silence
same warning as before bestie: --end overwrites duration. do not fight it. π
β
check-config [<check-files>...]
Validate alertmanager config files
Will validate the syntax and schema for alertmanager config file and associated templates. Non existing templates will not trigger errors. it's like a vibe check but for YAML π
π cluster show
View cluster status and peers.
see who's in the group chat β sorry, the cluster. π¦
βοΈ config show
View current config.
The amount of output is controlled by the output selection flag:
- Simple: Print just the running config
- Extended: Print the running config as well as uptime and all version info
- Json: Print entire config object as json
π³ config routes show
Prints alert routing tree
Will print whole routing tree in form of ASCII tree view.
Routing is loaded from a local configuration file or a running Alertmanager configuration. Specifying --config.file takes precedence over --alertmanager.url.
Example:
amtool config routes [show] --config.file=doc/examples/simple.yml
π§ͺ config routes test [<flags>] [<labels>...]
Test alert routing
Will return receiver names which the alert with given labels resolves to. If the labelset resolves to multiple receivers, they are printed out in order as defined in the routing tree.
Routing is loaded from a local configuration file or a running Alertmanager configuration. Specifying --config.file takes precedence over --alertmanager.url.
Example:
amtool config routes test --config.file=doc/examples/simple.yml
--verify.receivers=team-DB-pager service=database
--verify.receivers=VERIFY.RECEIVERSβ Checks if specified receivers matches resolved receivers. The command fails if the labelset does not route to the specified receivers.--treeβ Prints out matching routes tree.
π§ template render --template.glob=TEMPLATE.GLOB --template.text=TEMPLATE.TEXT [<flags>]
Render a given definition in a template file to standard output.
--template.glob=TEMPLATE.GLOBβ Glob of paths that will be expanded and used for rendering.--template.text=TEMPLATE.TEXTβ The template that will be rendered.--template.type=TEMPLATE.TYPEβ The type of the template. Can be eithertext(default) orhtml.--template.data=TEMPLATE.DATAβ Full path to a file which contains the data of the alert(-s) with which the--template.textwill be rendered. Must be in JSON. File must be formatted according to the following layout:https://pkg.go.dev/github.com/prometheus/alertmanager/template#Data. If none has been specified then a predefined, simple alert will be used for rendering.
that's the whole page bestie, you made it to the end and honestly? ate. π π
this was prometheus-alertmanager 0.33.1, dated August 2026, answering to the name AMTOOL(1) β go forth and query, add, silence, expire, import, update, check, show, test and render, you absolute legend ππβ¨
π¦ where this page comes from
- ubuntu stonking: prometheus-alertmanager 0.33.1-4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms