Before you begin, you need multiple things to have:
- Have an account on Space
- Channel to send alerts
- Application with
Enable client credentials flow
on (Administration
->Applications
).
usage: alertmanager-webhook-space \
--space-channel-id=SPACE-CHANNEL-ID \
--space-base-url=SPACE-BASE-URL \
--space-token=APP_TOKEN \
--debug \
[<flags>]
alertmanager-webhook-space
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
-l, --listen="0.0.0.0:9091" Address to listen on
--space-channel-id=SPACE-CHANNEL-ID
Channel id
--space-base-url=SPACE-BASE-URL
Base url like https://mycompany.jetbrains.space
--space-token=APP_TOKEN
Application token
--debug
Debug logs
$ CGO_ENABLED=0 go build -o alertmanager-webhook-jetbrains-space ./cmd/alertmanager-webhook-space/main.go
$ docker run --rm -it ns3777k/alertmanager-webhook-space
But you're better off using a specific tag.
If you're on linux and have systemd, here is a sample configuration:
[Unit]
Description=Alertmanager webhook jetbrains space
After=network-online.target
[Service]
Type=simple
User=myuser
Group=myuser
ExecStart=/usr/local/bin/alertmanager-webhook-jetbrains-space
SyslogIdentifier=alertmanager-webhook-jetbrains-space
Restart=always
[Install]
WantedBy=multi-user.target
Don't forget to put the binary on /usr/local/bin/alertmanager-webhook-jetbrains-space
.
Do not copy-paste this blindly, that's just an example:
global:
resolve_timeout: 3m
templates:
- '/etc/alertmanager/templates/*.tmpl'
receivers:
- name: webhook
webhook_configs:
- url: http://127.0.0.1:9091/api/v1/webhook
route:
group_by:
- cluster
- alertname
group_interval: 5m
group_wait: 30s
receiver: webhook
repeat_interval: 4h