Module: check_mk
Branch: master
Commit: 3b9af35025b94989e15f33f046367fcd3aa021f5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b9af35025b949…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 1 23:14:17 2013 +0200
mkeventd: new notification plugin for forwarding notifications to EC
---
ChangeLog | 6 +++++-
check_mk_templates.cfg | 7 +++++--
notifications/mkeventd | 22 ++++++++++++++++++++++
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e3c0c50..5bb6989 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
1.2.3i3:
Core:
* FIX: fixed typo in core startup message "logging initial states"
+
+ Notifications:
+ * mkeventd: new notification plugin for forwarding notifications
+ to the Event Console. See inline docu in share/check_mk/notification/mkeventd
+ for documentation.
* FIX: cleanup environment from notifications (needed for CMC)
Checks & Agents:
@@ -11,7 +16,6 @@
* FIX: host notification email in html format: fixed formating error
(typo in tag)
-
Multisite:
* FIX: add missing service icons to view "All Services with this descr..."
* FIX: ldap attribute plugins: fixed crash when parameters are None
diff --git a/check_mk_templates.cfg b/check_mk_templates.cfg
index 9f09bda..4a455f4 100644
--- a/check_mk_templates.cfg
+++ b/check_mk_templates.cfg
@@ -390,9 +390,12 @@ define command {
NOTIFY_NOTIFICATIONAUTHORNAME='$NOTIFICATIONAUTHORNAME$' \
NOTIFY_NOTIFICATIONAUTHORALIAS='$NOTIFICATIONAUTHORALIAS$' \
NOTIFY_HOSTTAGS='$_HOSTTAGS$' \
- NOTIFY_SVC_SL='$_SERVICEEC_SL$' \
NOTIFY_HOST_SL='$_HOSTEC_SL$' \
- @BINDIR@/check_mk --notify
+ NOTIFY_SVC_SL='$_SERVICEEC_SL$' \
+ NOTIFY_SERVICE_SL='$_SERVICEEC_SL$' \
+ NOTIFY_HOST_EC_CONTACT='$_HOSTEC_CONTACT$' \
+ NOTIFY_SERVICE_EC_CONTACT='$_SERVICEEC_CONTACT$' \
+ @BINDIR@/check_mk --notify
}
diff --git a/notifications/mkeventd b/notifications/mkeventd
new file mode 100755
index 0000000..3999acb
--- /dev/null
+++ b/notifications/mkeventd
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Forward Notification to Event Console
+# This notification plugin sends a notification to the
+# Check_MK Event Console. It takes two parameters:
+# 1. Syslog facility to use. This must be a number
+# from 0 to 23. 16 means 'local0', 17 means 'local1',
+# ... and 23 means 'local7'. If you leave this empty
+# the local0 is being used.
+# 2. IP-Address of the remote Event Console. If you
+# do not leave this empty then the notifications are
+# being sent via syslog/UDP (port 514) to that address.
+
+FACILITY=${NOTIFY_PARAMETER_1:-16}
+REMOTE=${NOTIFY_PARAMETER_2:-}
+
+if [ "$NOTIFY_WHAT" = HOST ]
+then
+ mkevent -n "$FACILITY" "$REMOTE" $NOTIFY_HOSTSTATEID
"$NOTIFY_HOSTNAME" "" "$NOTIFY_HOSTOUTPUT"
"$NOTIFY_HOST_SL" "$NOTIFY_HOST_EC_CONTACT"
+else
+ mkevent -n "$FACILITY" "$REMOTE" $NOTIFY_SERVICESTATEID
"$NOTIFY_HOSTNAME" "$NOTIFY_SERVICENAME"
"$NOTIFY_SERVICEOUTPUT" "$NOTIFY_SERVICE_SL"
"$NOTIFY_SERVICE_EC_CONTACT" "$NOTIFY_HOST_SL"
"$NOTIFY_HOST_EC_CONTACT"
+fi
+