Skip to content

Luk45135/Mail2CheckMk

Repository files navigation

Mail2CheckMk

Mail2CheckMk is a checkmk localcheck that reads emails from a IMAP server, parses them with RegEx and saves them to service files that are then printed to stdout to be sent to checkmk.

Why? - Do you have a stupid service that can't use SNMP and can only send emails? Then you can write a config file for your specific service and let Mail2CheckMk handle the rest.

Installation

This project is packaged with uv.

Git clone this repo or download the archive and extract it to /opt/.

It should look like this /opt/Mail2CheckMK/main.py.

On Debian make sure you have python3-venv installed. sudo apt install python3.13-venv

Navigate into the project-root. cd /opt/Mail2CheckMk

Create a virtual environment. python3 -m venv .venv

Enter the venv. source .venv/bin/activate

Update pip. pip install --upgrade pip

Install the needed requirements. pip install -r requirements.txt

You can now exit the venv with exit or by pressing Ctrl+D

Configure

Configure your IMAP server and login details in ./config/config.cfg.

Use a template or create your own service config file in ./config/services/~Your config file~.cfg.

I recommend https://regex101.com for writing regular expressions.

Usage

Move the mail2checkmk.sh launch-script to the proper checkmk local check directory /usr/lib/check_mk_agent/local/.

Debugging

Mail2CheckMk is built with user-serviceability in mind. Everything is saved in easy to read and override txt files.

The service files (whats being sent to checkmk) are in service-files/.

The emails are in plaintext-emails/ and the emails that are not recognized as having a check are in plaintext-emails/without-service/.

To manually run this script for debugging purposes you can either:

Enter the venv. source .venv/bin/activate

Run the main file. python main.py

--OR--

Directly run the script. .venv/bin/python main.py

About

A python script that transforms emails to CheckMk local checks with RegEx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors