check-mk

Check_MK - Custom check params specified in wato not being given to check function


I am working on a check_mk plugin and can't seem to get the WATO specified params passed to the check function when it runs for one check in particular...

Running cmk -D <hostname> shows the check as always having the default values though.

I have been staring at it for awhile and am out of ideas.

Check_MK version: 1.2.8p21 Raw

Bulk of check file:

factory_settings["elasticsearch_status_default"] = {
    "min": (600, 300)
}

def inventory_elasticsearch_status(info):
    for line in info:
        yield restore_whitespace(line[0]), {}

def check_elasticsearch_status(item, params, info):
    for line in info:
        name = restore_whitespace(line[0])
        message = restore_whitespace(line[2])

        if name == item:
            return get_status_state(params["min"], name, line[1], message, line[3])

check_info['elasticsearch_status'] = {
  "inventory_function"      : inventory_elasticsearch_status,
  "check_function"          : check_elasticsearch_status,
  "service_description"     : "ElasticSearch Status %s",
  "default_levels_variable" : "elasticsearch_status_default",
  "group"                   : "elasticsearch_status",
  "has_perfdata"            : False
}

Wato File:

group = "checkparams"
#subgroup_applications = _("Applications, Processes & Services")

register_check_parameters(
    subgroup_applications,
    "elasticsearch_status",
    _("Elastic Search Status"),
    Dictionary(
        elements = [
            ( "min",
              Tuple(
                  title = _("Minimum required status age"),
                  elements = [
                      Age(title = _("Warning if below"), default_value = 600),
                      Age(title = _("Critical if below"), default_value = 300),
                  ]
            ))
        ]
    ),
    None,
    match_type = "dict",
)

Entry in rules.mk from WATO rule:

checkgroup_parameters.setdefault('elasticsearch_status', [])

checkgroup_parameters['elasticsearch_status'] = [
  ( {'min': (3600, 1800)}, [], ALL_HOSTS ),
] + checkgroup_parameters['elasticsearch_status']

Let me know if any other information would be helpful!

EDIT: pls help


Solution

  • Posted question here as well and the mystery got solved.

    I was matching the WATO rule to item None (5th positional arg in the WATO file), but since this check had multiple items inventoried under it (none of which had the id None) the rule was applying to the host, but not to any of the specific service checks.

    Fix was to replace that param with:

    TextAscii( title = _("Status Description"), allow_empty = True),