Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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

License

NotificationsYou must be signed in to change notification settings

schlauerlauer/alertmanager-webhook-signal

Repository files navigation

Note: The default config path is now /config.yaml

If you want to override the config location, set the CONFIG_PATH environment variable

This project creates a containerized http endpoint which listens for requests by analertmanager webhook receiverand maps it to thesignal-cli by bbernhard.

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

Use a prometheus labelrecipients 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

Run container

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

Configuration

Aconfig.yaml file is needed for configuration.

Example configuration:

# Alertmanager webhook url: /api/v3/alertmanager# Grafana webhook url: /api/v3/grafanaserver:port:10000# port this program listens on; requireddebug:falsesignal:number:"+4923456"# the number you are sending messages from; requiredrecipients:# 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; requiredalertmanager:ignoreLabels:# filter labels in the message; optional  -"alertname"ignoreAnnotations:[]# filter annotations in the message; optionalgeneratorURL:true# include generator URL in the message; optional (default: false)matchLabel:"recipients"recipients:# optional list of recipient names and numbers for label matchingalice:"+49123123123"bob:"+49234234234"templates:grafana:|-    {{ if eq .State "alerting" }}❗{{ else }}✅{{ end }} {{ .Title}}    {{ .RuleName }}    {{ .Message }}    {{ .RuleUrl }}alertmanager:|-    {{ if eq .Alert.Status "firing" }}❗{{ else }}✅{{ end }} Alert {{ .Alertname }} is {{ .Alert.Status }}    {{- if gt (len (.Alert.Labels)) 0 }}    Labels:    {{- range $key, $value := .Alert.Labels }}      - {{ $key }}: {{ $value }}    {{- end }}    {{- end }}    {{- if gt (len (.Alert.Annotations)) 0 }}    Annotations:    {{- range $key, $value := .Alert.Annotations }}      - {{ $key }}: {{ $value }}    {{- end }}    {{- end }}    {{ if .Config.GeneratorURL -}}    {{ .Alert.GeneratorURL}}    {{ end -}}

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"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/api/v3/alertmanager"send_resolved:true

[8]ページ先頭

©2009-2025 Movatter.jp