skirl

Alertmanager

Each group of Prometheus alerts arrives as one message when it fires, at a priority taken from its severity label, and the same message is replaced as the group changes and when it resolves. You add a receiver to alertmanager.yml and route the alerts you want to it.

Setting it up#

In the app these steps are under Connect a system → Alertmanager, or a topic's Send to this topic tab, with the address, topic and a token filled in; New token makes the token.

A receiver for alertmanager.yml; route the alerts you want to it. A resolved alert replaces the message it fired with.

receivers:
  - name: skirl
    webhook_configs:
      - url: 'https://notify.example.com/alerts?template=alertmanager'
        send_resolved: true
        http_config:
          authorization:
            type: Bearer
            credentials: 'tk_replace_with_your_token'

The receiver here shows example values (https://notify.example.com, the topic alerts, tk_replace_with_your_token): copy it from the app, where yours are filled in.

  • Put the receiver under receivers: in alertmanager.yml, and send alerts to it from the route:: as the top route's receiver: skirl for every alert, or from a route that matches only some.
  • Alertmanager sends one message per alert group, as the route's group_by makes the groups. A group that changes (another alert fires, one resolves) replaces its message; when the whole group resolves, the message says "Resolved:".
  • Load the changed configuration: restart Alertmanager, or have it reload its configuration.
  • Skirl's tests run this receiver in Alertmanager 0.35.1.

Events#

Event On at first What it means
Alert firing Yes A group has alerts firing. The priority comes from the severity label: critical, page or emergency 5; error, high or major 4; info, low or none 2; any other, or none, 3.
Alert resolved Yes Every alert of the group resolved. Its message replaces the firing one, titled "Resolved: …", at priority 2.

The receiver has send_resolved: true, so Alertmanager sends resolved groups too. Unticking Alert resolved keeps the firing message as it was.

What a message looks like#

One alert firing, as Alertmanager 0.35.1 sent it:

DiskAlmostFull · nas01:9100
Volume 2 is at 91%
/volume2 on nas01 has 412 GB free of 4.6 TB.

Priority 5 · Tags: rotating_light, critical · Button: Open in Alertmanager

The title is the alert's name and its instance label; the text is its summary and description annotations. Tapping the message opens the alert's source in Prometheus; the button opens Alertmanager. rotating_light shows as 🚨.

A group of three, one of them resolved:

HostDown · 3 alerts
• web1 — No scrape of web1 for 5 minutes
• web2 — No scrape of web2 for 5 minutes
✓ web3 — No scrape of web3 for 5 minutes

Priority 3 · Tags: warning · Button: Open in Alertmanager

A group lists up to eight alerts, and then how many more. When Alertmanager itself leaves alerts out of a large group, the message ends with how many it did not send.

When nothing arrives#

  1. Alertmanager's log says "Notify failed". With Skirl's answer, 401 means the token is wrong, rotated or revoked; 403 means it is a token for another topic. Make a new token on the topic's Send to this topic tab and paste it into credentials:.
  2. No route sends alerts to the receiver. A receiver alone gets nothing: the top route, or a route that matches your alerts, must name skirl.
  3. The configuration was not loaded. Restart Alertmanager, or have it reload its configuration, after changing alertmanager.yml.
  4. Resolved groups do not arrive. Alert resolved is unticked (the address ends with &events=firing), or send_resolved: true was left out of the receiver.
  5. Alertmanager cannot reach Skirl: A sender gets no message through.

To send an alert by hand, amtool (it is in Alertmanager's own image) adds one; run it where Alertmanager answers on port 9093:

amtool --alertmanager.url=http://localhost:9093 alert add alertname=SkirlTest severity=warning --annotation='summary="A test alert"'

Once the route sends it to skirl, it arrives as "SkirlTest" with the text "A test alert", at priority 3 (or in the message of the group it falls into).

This page on GitHub