Module: check_mk
Branch: master
Commit: 989bef70ecdcf45f1e82f3daddf6f20ceedde023
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=989bef70ecdcf4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 18 10:09:30 2015 +0100
#2770 FIX Check_MK is now warning the user about deprecated but configured checkgroup
parameters
These messages help during migration from 1.2.6 to 1.2.8 when the check groups of checks
have been changed. The message is a hint for the user to check the deprecated rulesets
and migrate the rules to the new ones.
---
.werks/2770 | 11 +++++++++++
ChangeLog | 1 +
modules/check_mk.py | 34 ++++++++++++++++++++++++++++------
modules/nagios.py | 2 ++
4 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/.werks/2770 b/.werks/2770
new file mode 100644
index 0000000..56cb12b
--- /dev/null
+++ b/.werks/2770
@@ -0,0 +1,11 @@
+Title: Check_MK is now warning the user about deprecated but configured checkgroup
parameters
+Level: 1
+Component: core
+Compatible: compat
+Version: 1.2.7i4
+Date: 1447836914
+Class: fix
+
+These messages help during migration from 1.2.6 to 1.2.8 when the check groups of checks
+have been changed. The message is a hint for the user to check the deprecated rulesets
+and migrate the rules to the new ones.
diff --git a/ChangeLog b/ChangeLog
index 87617b0..cbb1cf3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
* 2756 FIX: SNMP: Generalized error handling of emtpy info for SNMP checks...
* 2759 FIX: Allowing Emails to contain special characters like umlauts...
* 2764 FIX: Fixed broken SNMP checks in case SNMP check interval is configured for
clusters...
+ * 2770 FIX: Check_MK is now warning the user about deprecated but configured
checkgroup parameters...
Checks & Agents:
* 2434 NetApp monitoring: Cluster-Mode is now supported, changes in existing 7Mode
checks...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 9d3639b..da7231e 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -380,20 +380,25 @@ def load_checks():
# Now convert check_info to new format.
convert_check_info()
- verify_checkgroups()
+ verify_checkgroup_members()
-# This function validates the checks which are members of checkgroups to have either
-# all or none an item. Mixed checkgroups lead to strange exceptions when processing
-# the check parameters. So it is much better to catch these errors in a central place
-# with a clear error message.
-def verify_checkgroups():
+def checks_by_checkgroup():
groups = {}
for check_type, check in check_info.items():
group_name = check["group"]
if group_name:
groups.setdefault(group_name, [])
groups[group_name].append((check_type, check))
+ return groups
+
+
+# This function validates the checks which are members of checkgroups to have either
+# all or none an item. Mixed checkgroups lead to strange exceptions when processing
+# the check parameters. So it is much better to catch these errors in a central place
+# with a clear error message.
+def verify_checkgroup_members():
+ groups = checks_by_checkgroup()
for group_name, checks in groups.items():
with_item, without_item = [], []
@@ -4840,6 +4845,7 @@ def compute_check_parameters(host, checktype, item, params):
params = entry
return params
+
def get_checkgroup_parameters(host, checktype, item):
checkgroup = check_info[checktype]["group"]
if not checkgroup:
@@ -4854,6 +4860,22 @@ def get_checkgroup_parameters(host, checktype, item):
return service_extra_conf(host, item, rules)
+# Verify that the user has no deprecated check groups configured.
+def verify_non_deprecated_checkgroups():
+ groups = checks_by_checkgroup()
+
+ for checkgroup, rules in checkgroup_parameters.items():
+ if checkgroup not in groups:
+ raise MKGeneralException(
+ "Found configured rules of deprecated check group \"%s\".
These rules are not used "
+ "by any check. Maybe this check group has been renamed during an
update, "
+ "in this case you will have to migrate your configuration to the new
ruleset manually. "
+ "Please check out the release notes of the involved versions.
"
+ "You may use the page \"Deprecated rules\" in WATO to view
your rules and move them to "
+ "the new rulesets." % checkgroup)
+
+
+
def output_profile():
if g_profile:
g_profile.dump_stats(g_profile_path)
diff --git a/modules/nagios.py b/modules/nagios.py
index fa45388..a032a64 100644
--- a/modules/nagios.py
+++ b/modules/nagios.py
@@ -79,6 +79,8 @@ def create_nagios_config(outfile = sys.stdout, hostnames = None):
if summary_service_notification_periods != []:
raise MKGeneralException("summary_service_notification_periods is not longer
supported. Please use extra_summary_service_conf['notification_period']
instead.")
+ verify_non_deprecated_checkgroups()
+
# Map service_period to _SERVICE_PERIOD. This field das not exist in Nagios/Icinga.
# The CMC has this field natively.
if "service_period" in extra_host_conf: