Own rule not appearing in gui

I just wrote my first SNMP plugin for Mikrotik QoS (QueueTrees) and that works at last with the help of this forum. Now I try to make the parameters for this plugin not just hard coded, but changeable via a rule.
According to the (german) manual (Eine eigene Regelkette definieren) I wrote a file and placed it in local/share/check_mk/web/plugins/wato. But after a “omd restart apache” the rule do not appear in the rule search.

Any help appreceated - thanks,
Bernhard

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2022 Bernhard Voit - License: GNU General Public License v2
# check_parameter definition for the mikrotik_queuetree

from cmk.gui.i18n import _

from cmk.gui.ValueSpec import (
    Dictionary,
    Float,
    TextAscii,
)
from cmk.gui.plugins.wato import (
    CheckParameterRulespecWithItem,
    rulespec_registry,
    RulespecGroupCheckParametersNetworking,
)

def _item_valuespec_mikrotik_queuetree():
    return TextAscii(title=_("Queue Name"))

def _parameter_valuespec_mikrotik_queuetree():
    return Dictionary(
        elements=[
            ("warn_level", Float(title=_("Warning above Drops per second"))),
            ("ctit_level", Float(title=_("Critical above Drops per second"))),
        ],
    )

rulespec_registry.register(
    CheckParameterRulespecWithItem(
        check_group_name="mikrotik_queuetree",
        group=RulespecGroupCheckParametersNetworking,
        match_type="dict",
        item_spec=_item_valuespec_mikrotik_queuetree,
        parameter_valuespec=_parameter_valuespec_mikrotik_queuetree,
        title=lambda: _("Mikrotik QueueTree Parameters"),
    ))

ValueSpec needs to be lower case like this ‘valuespec’.

Thanks - I tried that, but it doesn’t help. I chaged from cmk.gui.ValueSpec to cmk.gui.valueSpec and restartet apache, but the rule is still not appearing in rule search.
I also tried

python3 -m py_compile local/share/check_mk/web/plugins/wato/Mikrotik_QueueTree.py

to see if there are any errors in the python file.
Are there any logs where I can look? Any more suggestions?

there is still on upercase sign

Yup - I was blind. Now it’s working. Thanks a lot.
But can you give me a hint how to find these errors on my own …

in my case this is a job for the IDE :wink:

image

Beside the IDE to find the problem directly, you should also see the errors inside the “web.log” in your sites ~/var/log folder.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.