/cmk_discord

Checkmk Discord notification plugin

Primary LanguagePythonGNU General Public License v2.0GPL-2.0

cmk_discord - Checkmk Discord Notifications

GitHub Release Static Badge Static Badge

Discord notification plugin for Checkmk monitoring platform.

⚠️ Disclaimer: This is not an official plugin of Checkmk! It's a side project I've developed for my homelab notifications.

👏 inspired by the Discord notification plugin of n00rm that was created as a GitHub gist a while ago: https://gist.github.com/n00rm/32f1334b1dd2efc40122fee36551ef17 (unfortunately only as a gist so I couldn't extend it via PR)

Features

  • Colorized mesage to highlight alert state (incl. emoji ✨)
  • Supports all current notification types
    • 🚨 PROBLEM
    • RECOVERY
    • ☑️ ACKNOWLEDGEMENT
    • ⁉️ FLAPPINGSTART
    • FLAPPINGSTOP
    • DOWNTIMESTART
    • DOWNTIMEEND
    • ☑️ DOWNTIMECANCELLED
  • Service: Includes service description details
  • Supports comments (e.g. for acknowledgements or downtimes)
  • Link to failed service/host

Examples

Example: Host down Example: Filesystem Recovery

Installation

Method 1: MKP installation (preferred)

Download the mkp either from Checkmk Exchange or from the latest releases.

For installation instructions, please follow the official documentation: https://docs.checkmk.com/latest/en/mkps.html#_adding_an_mkp

Method 2: Manually

  • Download cmk_discord.py from the latest releases
  • On your Checkmk server, login to the instance you want to install the plugin (sudo su - <instance name>)
  • Copy cmk_discord.py to ~/local/share/check_mk/notifications
  • Make sure cmk_discord.py is executable: chmod +x ~/local/share/check_mk/notifications/cmk_discord.py

Configuration

In your Checkmk ui, go to Setup --> Notifications --> Add rule

  • As "Notification Method" select "Discord Notification"
  • First parameter should be the Discord Webhook URL (mandatory)
  • Second parameter (optional) URL to your checkmk instance. This is needed for links to the alerting service/host. (check known limitations below)

cmk-discord setup ui

Known limitations

Site URL needs to be a FQDN

If you see an error like

Unexpected response when calling webhook url https://discord.com/xyz 400. Response body: {"embeds": ["0"]}

This probably means that your site URL (the second parameters you've setup) isn't a FQDN (full-qualified-domain-name). Something like http://checkmkhost/my_monitoring won't work since "checkmkhost" is not a FQDN.

Instead using a FQDN https://checkmkhost.mycompany.com/my_monitoring (where "my_monitoring" is your site name)