English version below
Alerthandler - модуль на языке python, который опрашивает KUMA по REST API v1 на предмет изменения информации об алертах и отправляет эту информацию в Alertmanager для дальнейшей их отправки выбранным получателям.
- alertmanager 0.28
- python 3.6+ (requests, pyyaml)
- Скачайте
alerthandler-<version>.tar.gzна странице Releases - Распакуйте архив:
tar -xf alerthandler-<version>.tar.gz - Перейдите в директорию:
cd alerthandler/ - Задайте права на исполнение файлу install:
chmod +x install.sh - Запустите установку:
sudo ./install.sh
В результате установки будет сделано следующее:
- созданы директории /opt/alertmanager/ и /opt/alerthandler/
- в директории помещены соответствующие файлы необходимые для работы программы
- созданы службы alertmanager.service и alerthandler.service
- созданы пользователи alerthandler и alertmanager
- Правим файл конфигурации alertmanager под себя, можно использовать # чтобы закомментировать строки В текущей версии присутствуют примеры отправки в почту, телеграм и webhook. Остальные возможные варианты интеграции, а также более тонкая настройка существующих есть в документации на Alertmanager.
vi /opt/alertmanager/alertmanager.yml
- Переходим в директорию и запускаем вручную с дебаг-режимом для проверки отсутствия ошибок
cd /opt/alertmanager/
sudo -u alertmanager /opt/alertmanager/alertmanager --config.file /opt/alertmanager/alertmanager.yml --log.level=debug
Если выполнение не останавливается и в выводе присутствуют только INFO и DEBUG, значит все ок.
- Если все ок, можно запускать сервис
systemctl daemon-reload
systemctl enable alertmanager.service
systemctl start alertmanager.service
- Проверяем статус службы
systemctl status alertmanager.service
- Правим файл конфигурации alerthandler под себя, можно использовать # чтобы закомментировать строки
vi /opt/alerthandler/config.yml
- Переходим в директорию и запускаем вручную, чтобы проверить отсутствие ошибок
cd /opt/alerthandler/
sudo -u alerthandler python3 /opt/alerthandler/alerthandler.py
Если в выводе отсутствует какая-либо информация или traceback, значит все ок
- Если все ок можно запускать сервис:
systemctl enable alerthandler.service
systemctl start alerthandler.service
- Проверяем статус службы
systemctl status alerthandler.service
Alerthandler is a Python module that polls KUMA via REST API v1 for changes in alert information and forwards that information to Alertmanager for further delivery to selected recipients.
- alertmanager 0.28
- python 3.6+ (requests, pyyaml)
- Download
alerthandler-<version>.tar.gzfrom the Releases page - Extract the archive:
tar -xf alerthandler-<version>.tar.gz - Navigate to the directory:
cd alerthandler/ - Grant execute permission to the install script:
chmod +x install.sh - Run the installation:
sudo ./install.sh
The installation will perform the following:
- create directories /opt/alertmanager/ and /opt/alerthandler/
- place the necessary program files into the respective directories
- create alertmanager.service and alerthandler.service systemd services
- create alerthandler and alertmanager system users
- Edit the alertmanager configuration file to suit your needs. You can use # to comment out lines. The current version includes examples for email, Telegram, and webhook delivery. For other integration options and more advanced configuration, refer to the Alertmanager documentation.
vi /opt/alertmanager/alertmanager.yml
- Navigate to the directory and run manually in debug mode to check for errors
cd /opt/alertmanager/
sudo -u alertmanager /opt/alertmanager/alertmanager --config.file /opt/alertmanager/alertmanager.yml --log.level=debug
If the process does not stop and the output contains only INFO and DEBUG entries, everything is working correctly.
- If everything is ok, start the service
systemctl daemon-reload
systemctl enable alertmanager.service
systemctl start alertmanager.service
- Check the service status
systemctl status alertmanager.service
- Edit the alerthandler configuration file to suit your needs. You can use # to comment out lines.
vi /opt/alerthandler/config.yml
- Navigate to the directory and run manually to check for errors
cd /opt/alerthandler/
sudo -u alerthandler python3 /opt/alerthandler/alerthandler.py
If there is no output or traceback, everything is working correctly.
- If everything is ok, start the service:
systemctl enable alerthandler.service
systemctl start alerthandler.service
- Check the service status
systemctl status alerthandler.service

