CMK version:
2.1.0p29 upgrade to 2.2.0p4
OS version:
Debian 11
Error message:
01/04 Rulesets...
-| Failed to load plugin /omd/sites/monitoring/local/share/check_mk/web/plugins/wato/check_support_period_parameters_ui.py: cannot import name 'RulespecGroupActiveChecks' from 'cmk.gui.plugins.wato.active_checks' (/omd/sites/monitoring/lib/python3/cmk/gui/plugins/wato/active_checks/__init__.py)
-| Traceback (most recent call last):
-| File "/omd/sites/monitoring/lib/python3/cmk/gui/utils/__init__.py", line 66, in load_web_plugins
-| exec(f.read(), globalvars)
-| File "<string>", line 21, in <module>
-| ImportError: cannot import name 'RulespecGroupActiveChecks' from 'cmk.gui.plugins.wato.active_checks' (/omd/sites/monitoring/lib/python3/cmk/gui/plugins/wato/active_checks/__init__.py)
-| Failed to load plugin /omd/sites/monitoring/local/share/check_mk/web/plugins/wato/check_support_period_parameters_ui.py: cannot import name 'RulespecGroupActiveChecks' from 'cmk.gui.plugins.wato.active_checks' (/omd/sites/monitoring/lib/python3/cmk/gui/plugins/wato/active_checks/__init__.py)
-| Traceback (most recent call last):
-| File "/omd/sites/monitoring/lib/python3/cmk/gui/utils/__init__.py", line 66, in load_web_plugins
-| exec(f.read(), globalvars)
-| File "<string>", line 21, in <module>
-| ImportError: cannot import name 'RulespecGroupActiveChecks' from 'cmk.gui.plugins.wato.active_checks' (/omd/sites/monitoring/lib/python3/cmk/gui/plugins/wato/active_checks/__init__.py)
-| 'check_mk --automation get-section-information' returned 'Error in plugin file /omd/sites/monitoring/local/share/check_mk/checks/check_support_period.py: cannot import name 'quote_shell_string' from 'cmk.utils' (/omd/sites/monitoring/lib/python3/cmk/utils/__init__.py)
-| '
-| 'check_mk --automation get-check-information' returned 'Error in plugin file /omd/sites/monitoring/local/share/check_mk/checks/check_support_period.py: cannot import name 'quote_shell_string' from 'cmk.utils' (/omd/sites/monitoring/lib/python3/cmk/utils/__init__.py)
-| '
-| 02/04 UI extensions...
-| Failed to load plugin /omd/sites/monitoring/local/share/check_mk/web/plugins/wato/check_support_period_parameters_ui.py: cannot import name 'RulespecGroupActiveChecks' from 'cmk.gui.plugins.wato.active_checks' (/omd/sites/monitoring/lib/python3/cmk/gui/plugins/wato/active_checks/__init__.py)
-| Traceback (most recent call last):
-| File "/omd/sites/monitoring/lib/python3/cmk/gui/utils/__init__.py", line 66, in load_web_plugins
-| exec(f.read(), globalvars)
-| File "<string>", line 21, in <module>
-| ImportError: cannot import name 'RulespecGroupActiveChecks' from 'cmk.gui.plugins.wato.active_checks' (/omd/sites/monitoring/lib/python3/cmk/gui/plugins/wato/active_checks/__init__.py)
-| Incompatible local file 'check_support_period_parameters_ui'.
-| Error: cannot import name 'RulespecGroupActiveChecks' from 'cmk.gui.plugins.wato.active_checks' (/omd/sites/monitoring/lib/python3/cmk/gui/plugins/wato/active_checks/__init__.py)
Here is the active check I’ve written, it worked well in 2.0 and 2.1:
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# ./local/share/check_mk/web/plugins/wato/check_support_period_parameters_ui.py
# CP 30.06.2022 14:00
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
Dictionary,
TextUnicode,
Integer,
TextAscii
)
from cmk.gui.plugins.wato import (
rulespec_registry,
HostRulespec
)
# We import the RulespecGroupActiveChecks
from cmk.gui.plugins.wato.active_checks import RulespecGroupActiveChecks
def _valuespec_active_check_support_period():
return Dictionary(
title=_("Check Support Expiration"),
help=_("This check alerts when a date for support expires"
"This check uses the active check <tt>check_support_period</tt>. "),
optional_keys=["Date", "Warning", "Critical", "ignore"],
elements=[
(
"description",
TextUnicode(
title=_("Service Description"),
help=_("The name of this active service to be displayed."),
allow_empty=False,
)
),
(
"service",
TextAscii(
title=_("Support Type"),
help=_("Input the Support Type. Default is Hardware Support"),
default_value="Hardware Support",
)
),
(
"Date",
TextAscii(
title=_("Date when support expires, DD.MM.YYYY"),
help=_('defaults to 01.01.2022'),
allow_empty=False,
default_value="01.01.2022",
)
),
(
"Warning",
TextAscii(
title=_("Warn threshold"),
help=_('default 60'),
default_value=60,
)
),
(
"Critical",
TextAscii(
title=_("Crit threshold"),
help=_('default 30'),
default_value=30,
)
),
(
"ignore",
TextAscii(
title=_("Ignore Check if 1"),
help=_('Check is always OK if 1. If 0, then Check executes normally.'),
default_value=0,
)
),
]
)
# enddef _valuespec_active_check_support_period
rulespec_registry.register(
HostRulespec(
group=RulespecGroupActiveChecks,
match_type="all",
name="active_checks:check_support_period",
valuespec=_valuespec_active_check_support_period,
)
)
I think this stopped working. But I don’t know why:
cmk.gui.plugins.wato.active_checks import RulespecGroupActiveChecks