Module: check_mk
Branch: master
Commit: 5be05f06482f5ab6c4a9ad774171e2f3becddb00
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5be05f06482f5a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 21 18:12:06 2016 +0200
3716 New sites now have a default rule pack from the start
---
.werks/3716 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 2 ++
web/plugins/wato/mkeventd.py | 20 ++++++++++++++------
4 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/.werks/3716 b/.werks/3716
new file mode 100644
index 0000000..d14c953
--- /dev/null
+++ b/.werks/3716
@@ -0,0 +1,9 @@
+Title: New sites now have a default rule pack from the start
+Level: 1
+Component: ec
+Compatible: compat
+Version: 1.4.0i1
+Date: 1469117490
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index b13f3a5..febcf79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -546,6 +546,7 @@
* 3390 Events can now be cancelled by the syslog application...
* 3539 Event console: The EC notifications are now also controlled through the master
control snapin...
* 3656 Added support for syslog messages produced by Aristana devices...
+ * 3716 New sites now have a default rule pack from the start
* 3058 FIX: Event Console is now allowing non loadable MIB modules on startup...
* 3097 FIX: mkeventd: fixed crash with non-descriptive error message if mibs
couldn't be loaded
* 3335 FIX: Improved error handling when requested rule pack does not exist
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index c7d3ddb..5e918e4 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -14616,6 +14616,8 @@ def create_sample_config():
import werks
werks.acknowledge_all_werks()
+ save_mkeventd_sample_config()
+
def has_agent_bakery():
return 'bake_agents' in globals()
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index e9d11f7..4ecf996 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -862,12 +862,7 @@ def load_mkeventd_rules():
# Convert old plain rules into a list of one rule pack
if vars["rules"] and not vars["rule_packs"]:
- vars["rule_packs"] = [{
- "id" : "default",
- "title" : _("Default rule pack"),
- "rules" : vars["rules"],
- "disabled" : False,
- }]
+ vars["rule_packs"] = [default_rule_pack(vars["rules"])]
# Add information about rule hits: If we are running on OMD then we know
# the path to the state retention file of mkeventd and can read the rule
@@ -887,6 +882,15 @@ def load_mkeventd_rules():
return vars["rules"], vars["rule_packs"]
+def default_rule_pack(rules):
+ return {
+ "id" : "default",
+ "title" : _("Default rule pack"),
+ "rules" : rules,
+ "disabled" : False,
+ }
+
+
def save_mkeventd_rules(legacy_rules, rule_packs):
make_nagios_directory(defaults.default_config_dir + "/mkeventd.d")
make_nagios_directory(mkeventd_config_dir)
@@ -904,6 +908,10 @@ def save_mkeventd_rules(legacy_rules, rule_packs):
out.write("rule_packs += \\\n%r\n" % rule_packs)
+def save_mkeventd_sample_config():
+ save_mkeventd_rules([], [default_rule_pack([])])
+
+
#.
# .--WATO Modes----------------------------------------------------------.
# | __ ___ _____ ___ __ __ _ |