• Stars
    star
    216
  • Rank 183,179 (Top 4 %)
  • Language
    Go
  • License
    BSD 2-Clause "Sim...
  • Created over 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SMS alerts for Prometheus' Alertmanager

Sachet

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:

$ 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:

templates:
- /etc/sachet/notifications.tmpl

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

notifications.tmpl:

{{ define "telegram_title" }}[{{ .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 "telegram_text" }}{{ template "telegram_title" .}}
{{ template "telegram_message" . }}{{ end }}

License

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

More Repositories

1

php-rest-api

This repository contains the open source PHP client for MessageBird's REST API.
PHP
158
star
2

go-rest-api

MessageBird's REST API for Go
Go
120
star
3

messagebird-nodejs

The open source Node.js client for MessageBird's REST API
JavaScript
105
star
4

pushprom

Pushprom is a proxy to the Prometheus Go client.
Go
80
star
5

python-rest-api

This repository contains the open source Python client for MessageBird's REST API.
Python
65
star
6

csharp-rest-api

This repository contains the open source C# client for MessageBird's REST API.
C#
54
star
7

java-rest-api

This repository contains the open source Java client for MessageBird's REST API.
Java
50
star
8

clickhouse-postgres-fdw

This project provides federated access to Clickhouse cluster from Postgres, with the ability to write FDW API functions in GO.
Go
45
star
9

ruby-rest-api

MessageBird's REST API for Ruby
Ruby
37
star
10

beanstalkd_exporter

A beanstalkd stats exporter for Prometheus
Go
34
star
11

slackincident

This node.js app is allowing you to start an incident management process via a Slack slash command.
JavaScript
27
star
12

gcppromd

Prometheus GCP discovery
Go
18
star
13

mysql-monitor

A tool to monitor mysql databases
Go
12
star
14

firestore-send-msg

Source code for MessageBird Firebase send message extension
TypeScript
11
star
15

python-grpc-argument-validator

Python
7
star
16

pushprom-php-client

PHP client for Pushprom
PHP
6
star
17

dart-rest-api

MessageBird's REST API for Dart
Dart
5
star
18

messagebird-magento-integration

Integrate magento (v2) with the MessageBird Flow Builder
PHP
3
star
19

messagebird-magento

PHP
3
star
20

pushprom-yii2-client

Yii 2 client for Pushprom
PHP
2
star
21

openapi-specs

Open API specifications of MessageBird public API's
1
star