Checkmk cmk2 Unkategorisiert

Checkmk: Find all Context Variables for Notification Plugins

The Problem is, that the Gui is not showing all of them.
So you can’t see which variables you can access, when building a new notification plugin.

A simple Workaround is to build a first test.
Just create a new plugin, as you would do. Make sure it’s in Python and Executable.

Place it in: ~/local/share/check_mk/notifications/

Then you put this code inside:

#!/usr/bin/env python3
# BK: Test full Context
import pprint

from cmk.notification_plugins import utils
pprint.pprint(utils.collect_context())

You will find now a new notification Method “BK: Test full Context”, when you create a new Notification Rule.
If it’s not there, run omd restart apach first.

Create your rule, trigger a notification and check the log in
~/var/log/notify.log

There you see now the full context.

Schreibe einen Kommentar

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.