Constructing new check plug-ins

Hi there,

Apologies, I am not that clued up on python. Are there any guides/documentation/examples that explain how to configure the check under /omd/sites/yoursite/local/share/check_mk/checks?

The closest I could find for any explanations is https://docs.checkmk.com/latest/en/dev_guidelines.html but this doesn’t seem to help me with any examples.

I can’t seem to workout how the value(s) of the output from the script that executes on the local server under the plugins folder get translated to set some default levels, or translate these into variables that can be passed into the return value which presents in the cmk check.

Any help would be appreciated. I’ve posted my current python code below with an example output.

#!/usr/bin/python
    # -*- encoding: utf-8; py-indent-offset: 4 -*-

    #Output sample:
    #<<<win_patching>>>
    #CAP-RG-GPO-WUA_Reboot_XXXXXXX_XXXX

    factory_settings["win_patching_default_levels"] = {

    }

    def inventory_win_patching(info):
    return[ (None, {}) ]

    def check_win_patching(no_item, params, info):

        if xxxx == "False":
            return 2, "Patching Group: Not Configured(!!)"
        else:
            return 0, "Patching Group: Configured %value"

    check_info["win_patching"] = {
    "check_function"           : check_win_patching,
    "inventory_function"       : inventory_win_patching,
    "default_levels_variable"  : "win_patching_default_levels",
    "group"                    : "win_patching",
    "service_description"      : "Windows Patching",
    "has_perfdata"             : False,}

It is blank. Do you want to hardcode some values like warn=bla and criit=bli ?
Try doing a print(info) to see what is passed

if you print in inventory function, then you have to run

cmk --debug -vvII --checks=win_patching

If you want to print in check function, then you have to run:

cmk --debug -vn --checks=win_patching

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