OnCallReady

Commands

amtool - View and modify the current Alertmanager state

amtool --alertmanager.url=<url> alert|silence ...
amtool check-config <file>
amtool config routes [show|test <labels>...]

Options you will use

--alertmanager.url=URL
Required for everything that talks to a running Alertmanager. Or put alertmanager.url: http://localhost:9093 in ~/.config/amtool/config.yml.
alert query [matchers]
Active alerts. -s includes silenced, -i inhibited, -a all. -o extended|json.
silence add <matchers> -c COMMENT -d DURATION
Create a silence; prints its ID. Duration defaults to 1h.
silence query [-q] [--expired]
List silences (-q prints only IDs).
silence expire <id>...
End silences now.
check-config <file>
Validate alertmanager.yml offline.
config routes [show|test labels...]
Print the routing tree, or which receiver a label set lands on. Works offline with --config.file.
--alertmanager.url=URL
Alertmanager to talk to (or alertmanager.url in ~/.config/amtool/config.yml).
-o, --output FORMAT
Output format: simple, extended or json.
-q, --quiet
Only print IDs (silences) or alert names.

Examples

$ amtool --alertmanager.url=http://localhost:9093 alert query

what is firing right now

$ amtool silence add alertname=NodeHighCPU instance=localhost:9100 -d 2h -c 'load test, ticket OPS-123'

silence during planned work

$ amtool config routes test --config.file=/etc/prometheus/alertmanager.yml severity=page

where would a page go?

Gotchas

Taught in

Try amtool in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.