Send Nagios notifications to a Telegram Messenger channel
Find a file
Julien Riou 9b692d8209
Improve installation procedure
Signed-off-by: Julien Riou <julien@riou.xyz>
2020-11-26 08:35:34 +01:00
.gitignore Improve installation procedure 2020-11-26 08:35:34 +01:00
.pre-commit-config.yaml Initial code 2020-11-25 17:21:18 +01:00
.pydocstyle Initial code 2020-11-25 17:21:18 +01:00
config.json.example Initial code 2020-11-25 17:21:18 +01:00
LICENSE Initial commit 2020-11-25 15:47:41 +01:00
nagios.cfg Improve installation procedure 2020-11-26 08:35:34 +01:00
notify-by-telegram.py Add timestamp when logging to file 2020-11-25 17:35:19 +01:00
README.md Improve installation procedure 2020-11-26 08:35:34 +01:00

notify-by-telegram

Send Nagios notifications to a Telegram Messenger channel.

Telegram bot

This tutorial explains how to create a Telegram bot. You'll need the chat_id and auth_key for the next section.

Installation

This guide has been written for Debian. Some commands might slightly change depending on your distribution.

Clone the repository:

git clone https://github.com/jouir/notify-by-telegram.git /opt/notify-by-telegram

Install dependencies using the package manager:

sudo apt install python3-jinja2 python3-requests

Configuration

Copy and update the configuration file example:

cp -p config.json.example telegram.json
vim telegram.json
sudo mv telegram.json /etc/nagios4/telegram.json
sudo chmod 640 root:nagios /etc/nagios4/telegram.json

Ensure Nagios reads the configuration file:

echo "cfg_file=/opt/notify-by-telegram/nagios.cfg" >> /etc/nagios4/nagios.cfg

Then reload service:

systemctl reload nagios4

Logs

Errors logs can be set with the --logfile argument.

Example:

tail -f /var/log/nagios4/telegram.log

Log level can be raised using --verbose or even more with --debug arguments.