Module: check_mk
Branch: master
Commit: cbfae370aef524607244d49b8a16dbdd1e408f69
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cbfae370aef524…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Apr 18 13:33:57 2018 +0200
5799 FIX Availability: Fixed error in duration computation when merging identical states
This error appears when the availability timeline is not fully connect, e.g. if it is split
by a service period. The computation error itself seems no big issue, since this incorrect
computed value wasn't evaluated, anyway.
Change-Id: I5a1976edb1569d36012013ca60093b54bb49b5f1
---
.werks/5799 | 13 +++++++++++++
web/htdocs/availability.py | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/5799 b/.werks/5799
new file mode 100644
index 0000000..57a22fe
--- /dev/null
+++ b/.werks/5799
@@ -0,0 +1,13 @@
+Title: Availability: Fixed error in duration computation when merging identical states
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1524050943
+Class: fix
+
+This error appears when the availability timeline is not fully connect, e.g. if it is split
+by a service period. The computation error itself seems no big issue, since this incorrect
+computed value wasn't evaluated, anyway.
+
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index 3c9510c..b9ffaaf 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -1077,7 +1077,7 @@ def object_title(what, av_entry):
def merge_timeline(entries):
n = 1
while n < len(entries):
- if entries[n][1] == entries[n-1][1]:
+ if entries[n][1] == entries[n-1][1] and entries[n][0]["from"] == entries[n-1][0]["until"]:
entries[n-1][0]["duration"] += entries[n][0]["duration"]
entries[n-1][0]["until"] = entries[n][0]["until"]
del entries[n]
Module: check_mk
Branch: master
Commit: 604eeb6407fe7991dd94cd28aae6463b68bae59c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=604eeb6407fe79…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Apr 18 12:21:05 2018 +0200
6010 Service levels in event console rules can now have a precedence
Event console rules specify a service level, but it was a bit unclear what
that actually means. Previously it was just a default value to use when the
incoming message did not carry a service level itself. If it carried one
(including '0'), this part of the rule did not have any effect.
This behavior was a bit confusing and did not cover all use cases, so you
can now specify what should happen when the incoming message already has a
service level: Keep it (old behavior, the default) or overwrite it
unconditionally with the configured service level.
Change-Id: Idaae7a26f8b41514b8ebe71e5b6416c93b11e973
---
.werks/6010 | 18 ++++++++++++++++++
cmk/ec/main.py | 4 ++--
web/plugins/wato/mkeventd.py | 34 ++++++++++++++++++++++++++--------
3 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/.werks/6010 b/.werks/6010
new file mode 100644
index 0000000..9f17674
--- /dev/null
+++ b/.werks/6010
@@ -0,0 +1,18 @@
+Title: Service levels in event console rules can now have a precedence
+Level: 1
+Component: ec
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1524046455
+Class: feature
+
+Event console rules specify a service level, but it was a bit unclear what
+that actually means. Previously it was just a default value to use when the
+incoming message did not carry a service level itself. If it carried one
+(including '0'), this part of the rule did not have any effect.
+
+This behavior was a bit confusing and did not cover all use cases, so you
+can now specify what should happen when the incoming message already has a
+service level: Keep it (old behavior, the default) or overwrite it
+unconditionally with the configured service level.
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 86e34b5..8336ff6 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -2599,8 +2599,8 @@ class EventServer(ECServerThread):
else:
event["state"] = rule["state"]
- if "sl" not in event:
- event["sl"] = rule["sl"]
+ if ("sl" not in event) or (rule["sl"]["precedence"] == "rule"):
+ event["sl"] = rule["sl"]["value"]
event["first"] = event["time"]
event["last"] = event["time"]
if "set_comment" in rule:
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index 929d43a..9fa5091 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -351,13 +351,31 @@ def vs_mkeventd_rule(customer=None):
help = _("The monitoring state that this event will trigger."),
default_value = -1,
)),
- ( "sl",
- DropdownChoice(
- title = _("Service Level"),
- choices = mkeventd.service_levels,
- prefix_values = True,
- ),
- ),
+ ( "sl", Transform(
+ Dictionary(
+ title = _("Service Level"),
+ optional_keys = False,
+ elements = [
+ ( "value", DropdownChoice(
+ title = _("Value"),
+ choices = mkeventd.service_levels,
+ prefix_values = True,
+ help = _("The default/fixed service level to use for this rule."),
+ )),
+ ( "precedence", DropdownChoice(
+ title = _("Precedence"),
+ choices = [
+ ( "message", _("Keep service level from message (if available)") ),
+ ( "rule", _("Always use service level from rule") ),
+ ],
+ help = _("Here you can specify which service level will be used when "
+ "the incoming message already carries a service level."),
+ default_value = "message",
+ )),
+ ]
+ ),
+ forth = lambda x: {"value": x, "precedence": "message"} if isinstance(x, int) else x
+ )),
( "contact_groups", Dictionary(
title = _("Contact Groups"),
elements = [
@@ -1574,7 +1592,7 @@ def mode_mkeventd_rules(phase):
html.write("%s" % dict(mkeventd.syslog_facilities)[facnr])
table.cell(_("Service Level"),
- dict(mkeventd.service_levels()).get(rule["sl"], rule["sl"]))
+ dict(mkeventd.service_levels()).get(rule["sl"]["value"], rule["sl"]["value"]))
hits = rule.get('hits')
table.cell(_("Hits"), hits != None and hits or '', css="number")
Module: check_mk
Branch: master
Commit: ad74fdd3e3f93b766f4e423134ff4b199bc67c49
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad74fdd3e3f93b…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Apr 17 14:49:50 2018 +0200
Fixed local and plugins section
Change-Id: I2346093736716205276db93520e79a43ae72502c
---
agents/check_mk_agent.linux | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 1f58f8e..98d4063 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -1161,7 +1161,7 @@ function is_valid_plugin () {
# Local checks
echo '<<<local>>>'
if cd "$LOCALDIR" ; then
- for skript in *.dpkg-{old,new,temp}; do
+ for skript in ./*; do
if is_valid_plugin "$skript"; then
./"$skript"
fi
@@ -1176,9 +1176,9 @@ fi
# Plugins
if cd "$PLUGINSDIR"; then
- for skript in *.dpkg-{old,new,temp}; do
+ for skript in ./*; do
if is_valid_plugin "$skript"; then
- ./"skript"
+ ./"$skript"
fi
done
# Call some plugins only every Xth second
Module: check_mk
Branch: master
Commit: d6c98a0b6de01b541eccbab56bce47a22f65db36
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d6c98a0b6de01b…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Apr 17 13:46:42 2018 +0200
6009 FIX Rewrite event text in cancel events, too
Previously, only non-cancelling events had their text rewritten. This has
been fixed.
Change-Id: I513239d77e4ed8b51d8963f334dfa5feeaa0c0fc
---
.werks/6009 | 11 +++++++++++
cmk/ec/main.py | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/.werks/6009 b/.werks/6009
new file mode 100644
index 0000000..16e217a
--- /dev/null
+++ b/.werks/6009
@@ -0,0 +1,11 @@
+Title: Rewrite event text in cancel events, too
+Level: 1
+Component: ec
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1523965551
+Class: fix
+
+Previously, only non-cancelling events had their text rewritten. This has
+been fixed.
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 0b4e0a1..86e34b5 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -4186,8 +4186,12 @@ class EventStatus(object):
# values and the logfile entry if more relevant.
previous_phase = event["phase"]
event["phase"] = "closed"
+ # TODO: Why do we use OK below and not new_event["state"]???
event["state"] = 0 # OK
event["text"] = new_event["text"]
+ # TODO: This is a hack and partial copy-n-paste from rewrite_events...
+ if "set_text" in rule:
+ event["text"] = replace_groups(rule["set_text"], event["text"], match_groups)
event["time"] = new_event["time"]
event["last"] = new_event["time"]
event["priority"] = new_event["priority"]