How to patch/override existing legacy check plugin?

How do we override existing legacy check plugins in $OMD_ROOT/share/check_mk/checks in 2.4 and beyond?

The path $OMD_ROOT/local/share/check_mk/checks is now ignored.

Pull requests for the legacy checks will not be accepted AFAIK.

1 Like

Only solution is create your “override” or modification inside “~/local/lib/python3/cmk/plugins/collection/agent_based/” name the section there exactly as the old one and your modification will be used.

As far as i know is this the only working solution.

1 Like

These seems to work.

Unfortunately a legacy ruleset will not be used any more. Bummer. I do not want to rewrite the ruleset “efreq” as it is also used in other legacy check plugins.

The result: check_mk_extensions/janitza_umg_patch_512 at cmk2.4 · HeinleinSupport/check_mk_extensions · GitHub

For better or worse, I ran into this with my simple icmp_extended plugin on the exchange. Something similar might work for you. I’m a relative novice and stumbled on this “solution”.

I found a way to force this active check ruleset to register and included it in the package manifest. I’ve tested in lab and on a small home setup and it works but I’d appreciate any feedback if this is a big no no or causes any unanticipated issues. It’s in anticipation of an upgrade to 2.4 in the next couple of weeks across our enterprise.

File is located in $OMDROOT/local/share/check_mk/web/plugins/wato/icmp_extended.py

#!/usr/bin/env python3
"""
WATO plugin for icmp_extended active check

This file directly registers the icmp_extended ruleset by importing
the valuespec function from cmk_addons and registering it here.
"""

from cmk.utils.rulesets.definition import RuleGroup
from cmk.gui.plugins.wato.utils import HostRulespec, rulespec_registry
from cmk.gui.wato import RulespecGroupActiveChecks

# Import the valuespec function from our cmk_addons module
from cmk_addons.plugins.icmp_extended.rulesets.icmp import (
    _valuespec_active_checks_icmp,
)

# Register the ruleset in this scope (where load_web_plugins expects it)
rulespec_registry.register(
    HostRulespec(
        group=RulespecGroupActiveChecks,
        match_type="all",
        name=RuleGroup.ActiveChecks("icmp"),
        valuespec=_valuespec_active_checks_icmp,
    )
)

Sincerely,

Scotsie