2
0
Fork
You've already forked alertpush
0
bridge between Prometheus Alertmanager and Simplepush
  • Go 96.3%
  • Makefile 3.2%
  • Dockerfile 0.5%
2024年11月11日 15:51:41 +00:00
internal fix: allocate a TLSConfig instance for https server 2024年10月22日 19:38:03 +09:00
sample Clean up sample config and temporarily drop unimplemented cmd flags 2024年10月06日 14:30:39 +00:00
.gitattributes Add .gitattributes 2024年11月10日 21:53:31 +00:00
.gitignore Add release target 2024年11月10日 01:30:22 +00:00
.goreleaser.yml Correct permissions for alertpush binary in tarballs 2024年11月11日 15:51:41 +00:00
AUTHORS Update copyright headers 2024年09月25日 15:19:11 +00:00
Dockerfile Simplify Docker image build and build stripped binary by default 2024年09月24日 22:33:12 +00:00
go.mod add: basic simplepush implementation 2024年09月22日 14:30:33 +09:00
go.sum add: basic simplepush implementation 2024年09月22日 14:30:33 +09:00
LICENSE Update copyright headers 2024年09月25日 15:19:11 +00:00
main.go add: implement custom but standardized logging 2024年09月29日 13:48:53 +09:00
Makefile Add release target to dependency chain 2024年11月10日 20:41:27 +00:00
README.md chg: add CLI option section to README 2024年11月02日 11:31:47 +09:00
TODO.md Update TODO 2024年11月10日 21:14:57 +00:00

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

  1. Get the official Simplepush app at https://simplepush.io/
  2. While in the app, get your primary 6-char key or configure additional keys
  3. Create a minimal config at /etc/alertpush/config.yml:
alertmanager:url:http://127.0.0.1:28080/alertsimplepush:auth:apikey:xXyYzZ

For encrypted messages:

alertmanager:url:http://127.0.0.1:28080/alertsimplepush:auth:apikey:xXyYzZencrypted:truepass:easytobreaksalt:Zf149o3e
  1. 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.yml unless overridden by command-line flags (-f or --config), but if it fails to open this config file it will then attempt the fallbacks of config.yml, config.yaml, and config.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 (-f or --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 Grouprules:- alert:InstanceDownfor:1mexpr:up == 0labels:severity:criticalannotations:summary:"Instance {{ $labels.instance }} is down"description:"{{ $labels.instance }} has been down for the past 1 minute."

Minimal Alertmanager configuration

global:resolve_timeout:1mroute:group_by:['alertname']group_wait:30sgroup_interval:10srepeat_interval:1hreceiver:alertpushreceivers:- name:alertpushwebhook_configs:- url:'http://127.0.0.1:28080/alert'send_resolved:true

Running alertpush

Run alertpush with:

./alertpush

Running in a Docker container

  1. Create a directory containing the config file config.yml:
$ mkdir alertpush && cd alertpush
  1. Run docker run while mounting that directory as a volume:
$ docker run -v $(pwd):/etc/alertpush -it vaygr/alertpush:latest