Checkmk Telegram Notifications 1.0.0 Released
Back in 2016 I wrote a Checkmk notification script that sends messages via a Telegram Bot. Only a few years later I got around and turned it into a real Checkmk package.
After switching to Checkmk 1.6 some months ago, all I had for notifications was email. During my christmas vacation I got notifications via Telegram set up again. As part of the setup I also brought the old code into shape and finally packaged it as a real Checkmk package to make installation easier.
Compared to the initial script I posted, quite a few things changed:
- The Telegram bot token can be configured directly in WATO. It’s no longer hardcoded in the notification script.
- The Telegram chat id can also be provided in the same place. It is not a custom contact variable anymore that needs to be configured separately (that caused more confusion than being helpful)
- Messages are now prefixed with an emojified host/service status
- A bug that made the script use the wrong Python interpreter got fixed
- HTTP handling is now done via the Python Requests module, which ships with Checkmk packages and is also recommended in the Checkmk contribution guidelines
- The code has been cleaned up, thanks to flake8 and black
- All message handling should be unicode safe now (that’s how the emojis sneaked in)
- The plugin should be easy to port to Python 3 and I’m planning to do the port once Checkmk 2.0.0 has been released
For further information as well as some setup instructions see the Checkmk Telegram Notifications code repository. It also contains the v1.0.0 release files including the Checkmk package. Once the package has been approved, it will also be available at the Checkmk Exchange.
There are also a few things I want to improve based on previous post comments as well as using the notification script myself: