https://github.com/julb/alertmanager-gchat-integration
https://github.com/julb/alertmanager-gchat-integration
alertmanager gchat google-chat prometheus
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/julb/alertmanager-gchat-integration
- Owner: julb
- License: mit
- Created: 2020-11-30T13:11:29.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-23T06:19:18.000Z (almost 5 years ago)
- Last Synced: 2025-12-23T11:58:31.561Z (3 months ago)
- Topics: alertmanager, gchat, google-chat, prometheus
- Language: Python
- Homepage:
- Size: 43 KB
- Stars: 5
- Watchers: 1
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README



[](https://hub.docker.com/r/julb/alertmanager-gchat-integration)
[](https://hub.docker.com/r/julb/alertmanager-gchat-integration)
[](https://hub.docker.com/r/julb/alertmanager-gchat-integration)
# alertmanager-gchat-integration
## Description
The application provides a Webhook integration for Prometheus AlertManager to push alerts to Google Chat rooms.
The application expects a `config.toml` file like this:
```toml
[app.notification]
# Helpful to indicate the origin of the message. Default to HOSTNAME.
# origin = "custom-origin"
# Optional Jinja2 custom template to print message to GChat.
# custom_template_path = ".json.j2"
# Optional true to send the message as a Gchat card
# use_cards = true
[app.room.]
notification_url = "https://chat.googleapis.com/v1/spaces//messages?key=&token=&threadKey="
```
The file may be:
- Located in the current directory and named `config.toml`.
- Placed in the directory of your choice with `CONFIG_FILE_LOCATION` environment variable set.
Also, the application provides a built-in template for GChat notification located [here](./alertmanager_gchat_integration/default-notification-template.json.j2).
If you wish to customize it, create a custom version and use `app.notification.custom_template_path`.
By default, the message will be sent as a [basic message](https://developers.google.com/hangouts/chat/reference/message-formats/basic).
If you wish to use [cards](https://developers.google.com/hangouts/chat/reference/message-formats/cards) set `app.notification.use_cards` to `true`.
When the application is started, the following endpoints are available:
- `/alerts?room=` : Endpoint used by AlertManager to send messages to GChat. The `room-name` should match the value indicated in the config.toml file. HTTP expected methods are: `POST`.
- `/healthz` : return 200 OK if the service is running. HTTP expected methods are: `GET`.
- `/metrics` : return Prometheus metrics regarding HTTP requests. HTTP expected methods are: `GET`.
## Using the python module
```
$ pip install alertmanager-gchat-integration
$ CONFIG_FILE_LOCATION=config.toml python -m alertmanager_gchat_integration
```
## Using the container
To execute the container, you should have a ~/.kube/config with the context pointing to the cluster.
The user defined in the context should have the appropriate rights in th cluster to manage configmaps.
## Starts the service
- Run container as root:
```bash
$ docker run -ti \
--user 65534:65534 \
-p 80:8080 \
-v $(pwd)/config.toml:/app/config.toml \
julb/alertmanager-gchat-integration:latest
```
The following environment variables are also available:
| Environment var | Description | Default Value |
| -------------------- | --------------------------------------- | ------------------ |
| PORT | The listening port for the application. | `8080` |
| CONFIG_FILE_LOCATION | The config.toml file path. | `/app/config.toml` |
## Helm chart
A [Helm chart](https://github.com/julb/helm-charts/blob/main/julb/alertmanager-gchat-integration/README.md) is available to install this runtime.
## Contributing
This project is totally open source and contributors are welcome.
When you submit a PR, please ensure that the python code is well formatted and linted.
```
$ make install.dependencies
$ make format
$ make lint
```