Converts Prometheus Alertmanager webhook to Discord webhook.
Default port to listen on is 5001 and can be configured by environment variable PORT
.
Store configuration at /etc/alertmanager-discord.yml
file e.g.:
hooks:
- slug: collaterals-monitoring
hook: https://discord.com/api/webhook/123
- slug: balval-alerts
hook: https://discord.com/api/webhook/456
- slug: automation-eng
hook: https://discord.com/api/webhook/789
Configure alertmanager to send alerts to the related hook:
receivers:
- name: "collaterals-monitoring"
webhook_configs:
- url: "http://alertmanager-discord:5001/hook/collaterals-monitoring"
send_resolved: false
- name: "balval-alerts"
webhook_configs:
- url: "http://alertmanager-discord:5001/hook/balval-alerts"
Provide mentions
alert's label value to mention arbitrary Discord user:
mentions: <user_id_0>,<user_id_1>
User ID may be found on Discord by Copy ID context menu item available with developer mode is turned on.
Provide TITLE_TMPL
and DESCR_TMPL
to override title and/or description, e.g. in docker-compose:
environment:
TITLE_TMPL: >
{{@if(it.status==='resolved'}}
{{it.annotations.onResolved|d('')}}
{{/if}}
If template is evaluating to an empty string, annotations.summary
and annotations.description
fields
will be used for title and description respectivelly.
Look at squirrelly docs for templating reference.
Provide inline_fields
alert's annotation to insert the inline fields with the values provided by the markdown list:
inline_fields: |
- hello
- there
If you want to use this service in alternative working mode, you can provide WORKING_MODE
environment variable.
For docker-compose it may look like this:
environment:
WORKING_MODE: "alternative"
It will allow you to describe alerts in the following way:
- alert: NumValidatorsWithNegativeDelta
expr: ethereum_validators_monitoring_validator_count_with_negative_balances_delta > 0 AND ON() changes(ethereum_validators_monitoring_epoch_number[1m]) > 0
labels:
severity: critical
annotations:
emoji: 💸
summary: 'Operators have a negative balance delta'
resolved_summary: 'Operators have a positive balance delta'
description: 'Number of validators per operator who have a negative balance delta.'
resolved_description: 'Number of validators per operator who recovered.'
field_name: '{{ $labels.nos_name }}'
field_value: '[{{ $value | printf "%.0f" }}](http://127.0.0.1:8082/d/3wimU2H7h/nodeoperators/?var-nos_name_var={{ urlquery $labels.nos_name }}&from={{ with query "(time() - 1200) * 1000" }}{{ . | first | value | printf "%f" }}{{ end }}&to={{ with query "time() * 1000" }}{{ . | first | value | printf "%f" }}{{ end }})'
url: "http://127.0.0.1:8082/d/HRgPmpNnz/validators"
footer_text: 'Epoch • {{ with query "ethereum_validators_monitoring_epoch_number" }}{{ . | first | value | printf "%.0f" }}{{ end }}'
footer_icon_url: "https://cryptologos.cc/logos/steth-steth-logo.png"
And it will produce the following result:
To create new release:
- Merge all changes to the
master
branch - Navigate to Repo => Actions
- Run action "Prepare release" action against
master
branch - When action execution is finished, navigate to Repo => Pull requests
- Find pull request named "chore(release): X.X.X" review and merge it with "Rebase and merge" (or "Squash and merge")
- After merge release action will be triggered automatically
- Navigate to Repo => Actions and see last actions logs for further details