Module: check_mk
Branch: master
Commit: eeff3ca077ed8a1efe51cc601aa0afa76c1c0897
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eeff3ca077ed8a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 12 15:21:14 2017 +0100
5580 Host event limit can now be configured individuall per Host & service ruleset
The host event limit can now be customized per host & service parameter ruleset.
There is a new ruleset named "Host event limit" available to configure the host
event limit individually for overriding the global limit.
Change-Id: I0d1d144db13ad21de4a71877b97ddb3bfb14a896
---
.werks/5580 | 12 +++++++++
bin/mkeventd | 10 +++++++-
web/plugins/wato/mkeventd.py | 58 +++++++++++++++++++++++++++-----------------
3 files changed, 57 insertions(+), 23 deletions(-)
diff --git a/.werks/5580 b/.werks/5580
new file mode 100644
index 0000000..308ec43
--- /dev/null
+++ b/.werks/5580
@@ -0,0 +1,12 @@
+Title: Host event limit can now be configured individuall per Host & service ruleset
+Level: 1
+Component: ec
+Compatible: compat
+Edition: cre
+Version: 1.5.0i2
+Date: 1513088405
+Class: feature
+
+The host event limit can now be customized per host & service parameter ruleset.
+There is a new ruleset named "Host event limit" available to configure the host
+event limit individually for overriding the global limit.
diff --git a/bin/mkeventd b/bin/mkeventd
index 353099a..e8d0b58 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -2961,12 +2961,20 @@ class EventServer(ECServerThread):
# protected by lock_eventstatus
def _get_event_limit(self, ty, event):
- # Prefer the rule inidividual limit for by_rule limit (in case there is some)
+ # Prefer the rule individual limit for by_rule limit (in case there is some)
if ty == "by_rule":
rule_limit = self._rule_by_id[event["rule_id"]].get("event_limit")
if rule_limit:
return rule_limit["limit"], rule_limit["action"]
+ # Prefer the host individual limit for by_host limit (in case there is some)
+ if ty == "by_host":
+ host_config = g_event_server.host_config.get(event["core_host"], {})
+ host_limit = host_config.get("custom_variables", {}).get("EC_EVENT_LIMIT")
+ if host_limit:
+ limit, action = host_limit.split(":", 1)
+ return int(limit), action
+
limit = g_config["event_limit"][ty]["limit"]
action = g_config["event_limit"][ty]["action"]
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index a84cd0a..bd1e8a4 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -2581,6 +2581,40 @@ if mkeventd_enabled:
optional_keys = [],
)
+ def vs_ec_host_limit(title):
+ return Dictionary(
+ title = title,
+ help = _("You can limit the number of current events created by a single "
+ "host here. This is meant to "
+ "prevent you from message storms created by one device.<br>"
+ "Once the limit is reached, the Event Console will block "
+ "all future incoming messages sent by this host until the "
+ "number of current "
+ "events has been reduced to be below this limit. In the "
+ "moment the limit is reached, the Event Console will notify "
+ "the configured contacts of the host."),
+ elements = [
+ ("limit", Integer(
+ title = _("Limit"),
+ minvalue = 1,
+ default_value = 1000,
+ unit = _("current events"),
+ )),
+ ("action", vs_ec_event_limit_actions("notify contacts of the host")),
+ ],
+ optional_keys = [],
+ )
+
+ register_rule(
+ "eventconsole",
+ "extra_host_conf:_ec_event_limit",
+ Transform(vs_ec_host_limit(title=_("Host event limit")),
+ forth = lambda x: dict([("limit", int(x.split(":")[0])), ("action", x.split(":")[1])]),
+ back = lambda x: "%d:%s" % (x["limit"], x["action"]),
+ ),
+ match = "first",
+ )
+
register_configvar(groups["ec"],
"event_limit",
Dictionary(
@@ -2589,28 +2623,7 @@ if mkeventd_enabled:
"problems which may occur in case of too many current events at the "
"same time."),
elements = [
- ("by_host", Dictionary(
- title = _("Host limit"),
- help = _("You can limit the number of current events created by a single "
- "host here. This is meant to "
- "prevent you from message storms created by one device.<br>"
- "Once the limit is reached, the Event Console will block "
- "all future incoming messages sent by this host until the "
- "number of current "
- "events has been reduced to be below this limit. In the "
- "moment the limit is reached, the Event Console will notify "
- "the configured contacts of the host."),
- elements = [
- ("limit", Integer(
- title = _("Limit"),
- minvalue = 1,
- default_value = 1000,
- unit = _("current events"),
- )),
- ("action", vs_ec_event_limit_actions("notify contacts of the host")),
- ],
- optional_keys = [],
- )),
+ ("by_host", vs_ec_host_limit(title=_("Host limit"))),
("by_rule", vs_ec_rule_limit()),
("overall", Dictionary(
title = _("Overall current events"),
@@ -3129,6 +3142,7 @@ register_rule(
itemtype = 'service',
match = 'first',
)
+
#.
# .--Notifications-------------------------------------------------------.
# | _ _ _ _ __ _ _ _ |
Module: check_mk
Branch: master
Commit: fbf017cfa962164ff2ce532aada3c2a37e568a50
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fbf017cfa96216…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 12 15:28:13 2017 +0100
5581 FIX Fixed incompatibility when installing baked packages on systems with older python versions
When installing a package containing python agent plugins, the pre install script could fail
on systems that are using older python versions than 2.7.
Change-Id: I78cfa5a95fbf8d1fd0d765588d40d0f41dc0e668
---
.werks/5581 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/.werks/5581 b/.werks/5581
new file mode 100644
index 0000000..b3c8a46
--- /dev/null
+++ b/.werks/5581
@@ -0,0 +1,12 @@
+Title: Fixed incompatibility when installing baked packages on systems with older python versions
+Level: 1
+Component: agents
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0i2
+Date: 1513088826
+
+When installing a package containing python agent plugins, the pre install script could fail
+on systems that are using older python versions than 2.7.
Module: check_mk
Branch: master
Commit: 3d5fe7b636ea689c1742b5e5bcd5da854d8c8666
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d5fe7b636ea68…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 12 12:54:05 2017 +0100
5578 FIX Fixed process locking (pid file handling)
The PID file handling of the Event Console had the following issues:
a) The locking was only done by the init script. Manual executions
could lead to multiple running EC processes. This has been fixed
by adding an additional file lock to the PID file.
b) The PID file was only removed in case the EC stopped without
exception. In case one happened, the PID file was left over
refering to the old PID.
Change-Id: I5714a45a039dbfd7a1486733121cf2b44f5fb91c
---
.werks/5578 | 17 +++++++++++++++++
bin/mkeventd | 11 ++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/.werks/5578 b/.werks/5578
new file mode 100644
index 0000000..8bbb965
--- /dev/null
+++ b/.werks/5578
@@ -0,0 +1,17 @@
+Title: Fixed process locking (pid file handling)
+Level: 1
+Component: ec
+Compatible: compat
+Edition: cre
+Version: 1.5.0i2
+Date: 1513079448
+Class: fix
+
+The PID file handling of the Event Console had the following issues:
+
+ a) The locking was only done by the init script. Manual executions
+ could lead to multiple running EC processes. This has been fixed
+ by adding an additional file lock to the PID file.
+ b) The PID file was only removed in case the EC stopped without
+ exception. In case one happened, the PID file was left over
+ refering to the old PID.
diff --git a/bin/mkeventd b/bin/mkeventd
index e8642a9..866ed04 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -5144,8 +5144,7 @@ if __name__ == "__main__":
cmk.daemon.daemonize()
logger.info("Daemonized with PID %d." % os.getpid())
- # Create PID file
- file(g_pid_file, "w").write("%d\n" % os.getpid())
+ cmk.daemon.lock_with_pid_file(g_pid_file)
# Install signal hander
signal.signal(signal.SIGHUP, signal_handler)
@@ -5189,10 +5188,16 @@ if __name__ == "__main__":
pass
logger.info("Successfully shut down.")
- os.remove(g_pid_file)
sys.exit(0)
except:
if opt_debug:
raise
bail_out(traceback.format_exc())
+
+ finally:
+ if cmk.store.have_lock(g_pid_file):
+ try:
+ os.remove(g_pid_file)
+ except OSError:
+ pass
Module: check_mk
Branch: master
Commit: c28b034aaef75843df25d886dc0344b9c847559d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c28b034aaef758…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Dec 12 13:02:07 2017 +0100
5526 FIX check_dns: Do not pass off the host's IP address as a default DNS server address
Previously, in case of the DNS server address not being specified, Check_MK would
fill it in with the host's IP address, causing the check to time out. This has been fixed.
Thanks to Björn Müller for the patch!
Change-Id: I307bf8f0550fcc2305cc81884081665b516f5082
---
.werks/5526 | 14 ++++++++++++++
checks/check_dns | 2 --
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.werks/5526 b/.werks/5526
new file mode 100644
index 0000000..515dcbf
--- /dev/null
+++ b/.werks/5526
@@ -0,0 +1,14 @@
+Title: check_dns: Do not pass off the host's IP address as a default DNS server address
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i2
+Date: 1513079892
+
+Previously, in case of the DNS server address not being specified, Check_MK would
+fill it in with the host's IP address, causing the check to time out. This has been fixed.
+
+Thanks to Björn Müller for the patch!
diff --git a/checks/check_dns b/checks/check_dns
index 743636f..2f5bbd2 100644
--- a/checks/check_dns
+++ b/checks/check_dns
@@ -31,8 +31,6 @@ def check_dns_arguments(params):
if "server" in settings:
if settings["server"] != None:
args += ' -s %s' % quote_shell_string(settings["server"])
- else:
- args += " -s '$HOSTADDRESS$'"
if "expected_address" in settings:
# Convert from old (str) to new (list of strings)