This Spring Boot application helps to transfer alerts from Prometheus Alertmanager to Telegram chat and channels using webhooks and spring-boot-starter-prometheus-alerts
You can build application using following command:
./gradlew clean build
You can run unit test using following command:
./gradlew test
According to Spring Docs you can override default application properties by put custom application.properties file in one of the following locations:
- a
/config
subdirectory of the current directory - the current directory
The following properties can be configured in application.properties:
property | description |
---|---|
prometheus.alertmanager.endpoint.base | base url for POST request mapping for prometheus alert (default /alert ) |
server.port | application port (default 8080 ) |
prometheus.telegram.auth-token | telegram bot auth token |
prometheus.telegram.chat-id | telegram chat id |
prometheus.telegram.proxy.enable | is use proxy (default false ) |
prometheus.telegram.proxy.host | proxy host |
prometheus.telegram.proxy.port | proxy port |
You can run application using following command:
java -jar prometheus-telegram-alert.jar
You can test application by sending POST request with request body from test alerts/simple.json file.
-
For building the application and creation Docker image run
docker-compose build
-
Customise configs with you preferred editor
place configs in ./config directory
-
Run the docker image
docker-compose up -d
route:
receiver: 'telegram'
receivers:
- name: 'telegram'
webhook_configs:
- url: http://<application-host>:<application-port>/alert
You can create your own message format by implementing MessageConverter.java.
Holding secrets with HashiCorp Vault
Integration with Vault
was made using spring-cloud-vault.
By default prometheus-telegram-alert
integration with Vault
disabled.
To enable integration with Vault
pass following arguments to prometheus-telegram-alert
run command:
java -jar prometheus-telegram-alert.jar --spring.cloud.vault.enabled=true --spring.cloud.vault.uri=<your vault uri>
--spring.cloud.vault.token=<your vault token> --spring.cloud.vault.kv.application-name=<vault application name>
Feel free to contribute. New feature proposals and bug fixes should be submitted as GitHub pull requests. Fork the repository on GitHub, prepare your change on your forked copy, and submit a pull request.
IMPORTANT!
Before contributing please read about Conventional Commits / Conventional Commits RU