Need help with sachet?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

messagebird
158 Stars 61 Forks BSD 2-Clause "Simplified" License 191 Commits 17 Opened issues

Description

SMS alerts for Prometheus' Alertmanager

Services available

!
?

Need anything else?

Contributors list

# 322,305
prometh...
Erlang
C
Shell
40 commits
# 392,957
prometh...
Go
Shell
alertma...
21 commits
# 378,281
prometh...
Go
Shell
alertma...
11 commits
# 106,847
prometh...
Shell
golang
hugo
6 commits
# 258,252
Go
prometh...
Shell
HTML
5 commits
# 116,504
centos7
centos
asdf
C
5 commits
# 139,091
prometh...
Go
nexus
knative
4 commits
# 47,699
Go
jira
HTML
alertma...
4 commits
# 140,400
Go
Python
Terrafo...
alertma...
4 commits
# 89,892
prometh...
golang
s3
xorm
4 commits
# 587,186
prometh...
Go
Shell
alertma...
3 commits
# 578,048
prometh...
Go
PHP
Shell
3 commits
# 552,037
prometh...
Shell
alertma...
C
3 commits
# 185,069
prometh...
source-...
Erlang
F#
2 commits
# 51,628
prometh...
unix
math-li...
html5
2 commits
# 358,950
atom-ed...
Atom
atom-pa...
PHP
2 commits
# 210,717
prometh...
seleniu...
zhihu
HTML
2 commits
# 252,171
prometh...
Shell
alertma...
Crystal
1 commit
# 541,808
prometh...
Shell
alertma...
C
1 commit
# 121,483
prometh...
alertma...
golang
HTML
1 commit

Sachet

Build Status

Sachet (or सचेत) is Hindi for conscious. Sachet is an SMS alerting tool for the Prometheus Alertmanager.

The problem

There are many SMS providers and Alertmanager supporting all of them would make the code noisy. To get around this issue a new service needed to be created dedicated only for SMS.

The solution

An HTTP API that accepts Alertmanager webhook calls and allows an end-user to configure it for the SMS provider of their dreams.

Usage

First get it

$ go get github.com/messagebird/sachet/cmd/sachet

And then running Sachet is as easy as executing

sachet
on the command line.
$ sachet

Use the

-h
flag to get help information.
$ sachet -h
Usage of sachet:
  -config string
        The configuration file (default "config.yaml")
  -listen-address string
        The address to listen on for HTTP requests. (default ":9876")

Testing

Sachet expects a JSON object from Alertmanager. The format of this JSON is described in the Alertmanager documentation, or, alternatively, in the Alertmanager GoDoc.

To quickly test Sachet is working you can also run:

bash
$ curl -H "Content-type: application/json" -X POST \
  -d '{"receiver": "team-sms", "status": "firing", "alerts": [{"status": "firing", "labels": {"alertname": "test-123"} }], "commonLabels": {"key": "value"}}' \
  http://localhost:9876/alert

Alertmanager configuration

To enable Sachet you need to configure a webhook in Alertmanager. You can do that by adding a webhook receiver to your Alertmanager configuration.

receivers:
- name: 'team-sms'
  webhook_configs:
  - url: 'http://localhost:9876/alert'

Message templating

Sachet supports Alertmanager-like templates for message content. You can do that by simply copying Alertmanager templates to Sachet. Some templates examples can be found in the Alertmanager documentation as well as available variables.

sachet.yml: ```yaml templates: - /etc/sachet/notifications.tmpl

receivers: - name: 'team-telegram' provider: telegram text: '{{ template "telegrammessage" . }}'

notifications.tmpl:
{{ define "telegramtitle" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }} @ {{ .CommonLabels.identifier }} {{ end }}

{{ define "telegram_message" }} {{ if gt (len .Alerts.Firing) 0 }} Alerts Firing: {{ range .Alerts.Firing }}• {{ .Labels.instance }}: {{ .Annotations.description }} {{ end }}{{ end }} {{ if gt (len .Alerts.Resolved) 0 }} Alerts Resolved: {{ range .Alerts.Resolved }}• {{ .Labels.instance }}: {{ .Annotations.description }} {{ end }}{{ end }}{{ end }}

{{ define "telegramtext" }}{{ template "telegramtitle" .}} {{ template "telegram_message" . }}{{ end }} ```

License

Sachet is licensed under The BSD 2-Clause License. Copyright (c) 2016, MessageBird

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.