- Go 96.3%
- Makefile 3.2%
- Dockerfile 0.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| internal | ||
| sample | ||
| .gitattributes | ||
| .gitignore | ||
| .goreleaser.yml | ||
| AUTHORS | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| Makefile | ||
| README.md | ||
| TODO.md | ||
Description
alertpush is a bridge between Prometheus Alertmanager and Simplepush allowing you to receive notifications from Prometheus on your smartphone.
Supported features
- Event ID
- Encrypted messages
Building
$ make
Building a Docker image
$ docker build .
Configuration
- Get the official Simplepush app at https://simplepush.io/
- While in the app, get your primary 6-char key or configure additional keys
- Create a minimal config at
/etc/alertpush/config.yml:
alertmanager:
url: http://127.0.0.1:28080/alert
simplepush:
auth:
apikey: xXyYzZ
For encrypted messages:
alertmanager:
url: http://127.0.0.1:28080/alert
simplepush:
auth:
apikey: xXyYzZ
encrypted: true
pass: easytobreak
salt: Zf149o3e
- Alternatively, alertpush can be configured using environment variables or using CLI options/flags
Notes:
- alertpush also supports config files in JSON format, and defaults to loading from
/etc/alertpush/config.ymlunless overridden by command-line flags (-for--config), but if it fails to open this config file it will then attempt the fallbacks ofconfig.yml,config.yaml, andconfig.json(in that order) in the current directory.
Warning: make sure to swap 127.0.0.1 with 0.0.0.0 if you're planning to run alertpush in a container, so it's accessible from other than the same localhost.
Environment variables
The following environment variables that set/override configuration parameters are recognized by alertpush:
| Environment variable | Description |
|---|---|
ALERTPUSH_ALERTMANAGER_URL |
Alertmanager receiver instance URL |
ALERTPUSH_SIMPLEPUSH_APIKEY |
API key to use with the simplepush.io receiver instance |
ALERTPUSH_SIMPLEPUSH_URL |
simplepush.io sender instance URL |
ALERTPUSH_SIMPLEPUSH_ENCRYPT |
whether messages sent over the simplepush.io connection should be encrypted, with supported values as yes, true, on, enable |
ALERTPUSH_SIMPLEPUSH_PASSWORD |
simplepush.io password to use when sending encrypted messages |
ALERTPUSH_SIMPLEPUSH_SALT |
simplepush.io password salt to use when sending encrypted messages |
CLI options
The following command-line options/flags can be used to set/override alertpush configuration parameters:
| CLI option | Description |
|---|---|
-f or -config |
specify an alertpush config file to load |
-alertmanager-url |
Alertmanager receiver instance URL |
-simplepush-apikey |
API key to use with the simplepush.io receiver instance |
-simplepush-url |
simplepush.io sender instance URL |
-simplepush-encrypt |
whether messages sent over the simplepush.io connection should be encrypted |
-simplepush-password |
simplepush.io password to use when sending encrypted messages |
-simplepush-salt |
simplepush.io password salt to use when sending encrypted messages |
The full set of command-line options, their syntax, and their descriptions can be displayed by running alertpush -h.
Notes:
- You can force alertpush to use command-line config values (or, when not given, any built-in default values) by setting the config file override (
-for--config) to/dev/null.
Warning: not all functionality listed via -h is currently implemented.
Minimal Prometheus configuration
…
alerting:
alertmanagers:
- static_configs:
- targets:
- 'localhost:9093'
rule_files:
- 'alerts.yml'
…
alerts.yml:
groups:
- name: Instance Group
rules:
- alert: InstanceDown
for: 1m
expr: up == 0
labels:
severity: critical
annotations:
summary: "Instance {{ $labels.instance }} is down"
description: "{{ $labels.instance }} has been down for the past 1 minute."
Minimal Alertmanager configuration
global:
resolve_timeout: 1m
route:
group_by: ['alertname']
group_wait: 30s
group_interval: 10s
repeat_interval: 1h
receiver: alertpush
receivers:
- name: alertpush
webhook_configs:
- url: 'http://127.0.0.1:28080/alert'
send_resolved: true
Running alertpush
Run alertpush with:
./alertpush
Running in a Docker container
- Create a directory containing the config file
config.yml:
$ mkdir alertpush && cd alertpush
- Run
docker runwhile mounting that directory as a volume:
$ docker run -v $(pwd):/etc/alertpush -it vaygr/alertpush:latest