Module: check_mk
Branch: master
Commit: b5d86821a4275b795e309b9b55502eb282de2f19
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b5d86821a4275b…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Oct 14 16:00:27 2014 +0200
#1186 RBN: It's now possible to Filter for contactgroups
This feature only works with cmc (Check_MK Microcore) because Nagios doesn't have the needed context information.
---
.werks/1186 | 10 ++++++++++
ChangeLog | 1 +
modules/notify.py | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/.werks/1186 b/.werks/1186
new file mode 100644
index 0000000..5845669
--- /dev/null
+++ b/.werks/1186
@@ -0,0 +1,10 @@
+Title: RBN: It's now possible to Filter for contactgroups
+Level: 1
+Component: notifications
+Compatible: compat
+Version: 1.2.5i6
+Date: 1413295156
+Class: feature
+
+This feature only works with cmc (Check_MK Microcore) because Nagios doesn't have the needed context information.
+
diff --git a/ChangeLog b/ChangeLog
index b6584a9..2f4fb96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -147,6 +147,7 @@
* 1394 HTML notifications have a new content field for debugging variables...
* 1400 Added example notification script for Pushover to doc/treasures/notifications...
* 1123 Rule based notifications: New condition "Match Service Groups"
+ * 1186 RBN: It's now possible to Filter for contactgroups...
* 1156 FIX: Graphs in HTML mails are now sent again where they where missing...
* 1157 FIX: Fixed SMS plugin on at least debian (distrs which have no sendsms/smssend)...
* 1407 FIX: Fix exception in rule based notification on non-Ascii characters in log message
diff --git a/modules/notify.py b/modules/notify.py
index ec09c31..3299cb1 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -699,7 +699,7 @@ def rbn_match_servicegroups(rule, context):
def rbn_match_contactgroups(rule, context):
required_groups = rule.get("match_contactgroups")
if context["WHAT"] != "SERVICE":
- cgn = context.get("SERVICECONTACTS")
+ cgn = context.get("SERVICECONTACTGROUPNAMES")
else:
cgn = context.get("HOSTCONTACTGROUPNAMES")
Module: check_mk
Branch: master
Commit: b27061d06853fb8f72989344a2eb53dbe7aed0f1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b27061d06853fb…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Oct 14 15:39:24 2014 +0200
ps: check has been split into a check file and an include file ps.include to enable other checks to make use it
---
checks/ps | 345 +-------------------------------------------------
checks/ps.include | 365 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 371 insertions(+), 339 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=b27061d068…
Module: check_mk
Branch: master
Commit: 9936c652b78901eda9d930e21014f29fad7e648d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9936c652b78901…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Oct 14 15:37:44 2014 +0200
RBN: Prepare support for Contact Group Filter. Only works with CMC, Nagios don't have all needed informations
---
modules/notify.py | 26 ++++++++++++++++++++++++++
web/htdocs/wato.py | 14 +++++++++++---
2 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/modules/notify.py b/modules/notify.py
index 276b11a..ec09c31 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -627,6 +627,7 @@ def rbn_match_rule(rule, context):
rbn_match_hosttags(rule, context) or \
rbn_match_hostgroups(rule, context) or \
rbn_match_servicegroups(rule, context) or \
+ rbn_match_contactgroups(rule, context) or \
rbn_match_hosts(rule, context) or \
rbn_match_exclude_hosts(rule, context) or \
rbn_match_services(rule, context) or \
@@ -695,6 +696,31 @@ def rbn_match_servicegroups(rule, context):
return "The service is only in the groups %s, but %s is required" % (
sgn, " or ".join(required_groups))
+def rbn_match_contactgroups(rule, context):
+ required_groups = rule.get("match_contactgroups")
+ if context["WHAT"] != "SERVICE":
+ cgn = context.get("SERVICECONTACTS")
+ else:
+ cgn = context.get("HOSTCONTACTGROUPNAMES")
+
+ if required_groups != None:
+ if cgn == None:
+ notify_log("Warning: No information about contact groups in the context. " \
+ "Seams that you don't use the Check_MK Microcore. ")
+ return
+ if cgn:
+ contactgroups = cgn.split(",")
+ else:
+ return "The object is in no group, but %s is required" % (
+ " or ".join(required_groups))
+
+ for group in required_groups:
+ if group in contactgroups:
+ return
+
+ return "The object is only in the groups %s, but %s is required" % (
+ cgn, " or ".join(required_groups))
+
def rbn_match_hostgroups(rule, context):
required_groups = rule.get("match_hostgroups")
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index b0fea5a..80ce88e 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -8301,7 +8301,15 @@ def vs_notification_rule(userid = None):
( "match_servicegroups",
GroupChoice("service",
title = _("Match Service Groups"),
- help = _("The host must be in one of the selected service groups"),
+ help = _("The service must be in one of the selected service groups"),
+ allow_empty = False,
+ )
+ ),
+ ( "match_contactgroups",
+ GroupChoice("contact",
+ title = _("Match Contact Groups (cmc only)"),
+ help = _("The host/ service must be in one of the selected contact groups. Only works with Check_MK Microcore. " \
+ "If you don't use the CMC, that filter will not apply"),
allow_empty = False,
)
),
@@ -8555,7 +8563,7 @@ def vs_notification_rule(userid = None):
],
optional_keys = [ "match_folder", "match_hosttags", "match_hostgroups", "match_hosts", "match_exclude_hosts",
- "match_services", "match_servicegroups", "match_exclude_services", "match_plugin_output",
+ "match_services", "match_servicegroups", "match_contactgroups", "match_exclude_services", "match_plugin_output",
"match_timeperiod", "match_escalation", "match_escalation_throttle",
"match_sl", "match_host_event", "match_service_event", "match_ec",
"match_checktype", "bulk", "contact_users", "contact_groups", "contact_emails" ],
@@ -8565,7 +8573,7 @@ def vs_notification_rule(userid = None):
+ contact_headers
+ [
( _("Conditions"), [ "match_folder", "match_hosttags", "match_hostgroups", "match_hosts", "match_exclude_hosts",
- "match_services", "match_servicegroups", "match_exclude_services", "match_plugin_output",
+ "match_services", "match_servicegroups", "match_contactgroups", "match_exclude_services", "match_plugin_output",
"match_checktype", "match_timeperiod",
"match_escalation", "match_escalation_throttle",
"match_sl", "match_host_event", "match_service_event", "match_ec" ] ),
Module: check_mk
Branch: master
Commit: 719ebc501affc6ae686ef285e6a0ae2bbee676e6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=719ebc501affc6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 14 13:11:00 2014 +0200
Updated bug entries #1074
---
.bugs/1074 | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.bugs/1074 b/.bugs/1074
index 2a23b0b..f0221b9 100644
--- a/.bugs/1074
+++ b/.bugs/1074
@@ -1,11 +1,15 @@
Title: Predictive monitoring does not take into account DST
Component: checks
-State: open
+Class: bug
+State: done
Date: 2013-10-16 21:43:31
Targetversion: future
-Class: bug
The predictive monitoring appearantly does not handle daylight saving time
correctly.
This is really hard to fix.
+
+2014-10-14 13:10:58: changed state open -> done
+We simply shift each beginning of a period according to the current
+timezone in that particular period of time. Seems to fix the problem.