Skip to content

schlauerlauer/alertmanager-webhook-signal

Repository files navigation

Alertmanager Webhook Signal

This project creates a containerized http endpoint which listens for requests by an alertmanager webhook receiver and maps it to the signal-cli by bbernhard.

This is useful if you already have the signal-cli running for example as a home-assistant notifier.

Use a prometheus label recipients to specify where you want the signal message to be send.

It now supports alert webhooks from Grafana aswell, including a preview graph image!

grafana

alertmanager

Prerequisites

  • A running and configured Signal CLI
  • Alertmanager and/or Grafana

Run container

docker run -d --name alertmanager-signal \
  -p 10000:10000 \
  -v $(pwd)/config.yaml:/config.yaml \
  -e CONFIG_PATH=/config.yaml \
  docker.io/schlauerlauer/alertmanager-webhook-signal:1.1.1

Configuration

A config.yaml file is needed for configuration.

See examples/config.yaml for the full configuration file

Example configuration:

server:
  port: 10000 # port this program listens on; required
  debug: false
signal:
  number: "+4923456" # the number you are sending messages from; required
  recipients: # default recipient(s), if the recipients label is not set in alert; required
    - "+49123123123"
  send: http://127.0.0.1:10001/v2/send # http endpoint of the signal-cli; required
alertmanager:
  ignoreLabels: # filter labels in the message; optional
    - "alertname"
  ignoreAnnotations: [] # filter annotations in the message; optional
  generatorURL: true # include generator URL in the message; optional (default: false)
  matchLabel: "recipients"
recipients: # optional list of recipient names and numbers for label matching
  alice: "+49123123123"
  bob: "+49234234234"

Example PrometheusRule:

groups:
  - name: "test.rules"
    rules:
      - alert: "Watchdog default recipient"
        annotations:
          message: "Testalert default recipient"
        expr: 'vector(1)'
        for: "1m"

      - alert: "Watchdog named recipient"
        annotations:
          message: "Testalert named recipient"
        labels:
          recipients: "alice,bob"
        expr: 'vector(1)'
        for: "1m"

Example Alertmanager config.yml:

global:

route:
  receiver: "signal"
  group_by: ["alertname"]
  group_wait: "5s"
  group_interval: "5m"
  repeat_interval: "3h"
receivers:
  - name: "signal"
    webhook_configs:
      - url: "http://127.0.0.1:10000/alertmanager"
        send_resolved: true

About

This project creates a little (dockerized) REST API Endpoint for an Alertmanager and Grafana webhook receiver and maps it to the dockerized signal-cli.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors