Plugin template?

Hello,

is there some template for check_mk plugin?

I would like to write a plugin to monitor the Status of SIP-Trunks on Alcatel OXO PBX.

I have already a script, which can read and deliver the requested information.

I will modify the Script so, that it will accept four parameters: username, password, ip adress and name of sip trunk. I want to set these Parameters through wato. The Script will then connect to web interface and read the appropriate state of the sip trunk. The output can be “REGISTRATION FAILED” or “REGISTRATION SUCCESSFULL”.

Where can I begin? Unfortunately the documentation on check_mk web did not help me that much.

Thanks!

Hi,

have you already read this document?

https://checkmk.com/cms_devel_check_plugins.html

I suggest you first write a script that takes these 4 arguments as parameters and that returns 0 on success, 1 on warning, 2 on critical, else 3 (unknown).

You can use any programming language, but if you’re not sure then use python since most of the other plugins are written in it.

Hi,

here is my script returning desired values:

https://pastebin.com/WauPnGdR

How could I know proceed to be able to configure the script in WATO?

Thanks!

For configuration in WATO you have to develop other files on the central monitoring server in python.

Example for ~site/local/share/check_mk/web/plugins/wato/<your_filename>. It’s working in 1.5 and is not tested on 1.6. I am not sure if the reference changed for this functions.

register_check_parameters(
        subgroup_storage,
        'multipath_broken',
        _('Linux multipath broken paths'),
        Dictionary(
                elements = [
            ('broken_levels',
                Tuple(
                    title = _("Set levels on broken paths"),
                    elements = [
                                    Integer(title = _("Warning at"), default_value = 1),
                                    Integer(title = _("Critical at"), default_value = 2),
                            ]
                    ),
            ),
            ('sumpaths',
                Integer(title = _("Sum Paths"))
            ),
            ('state_if_new',
                MonitoringState(
                    default_value = 1,
                    title = _("State in case of new paths found"),
                )
            )
       ]
   ),
   None,
   match_type = 'dict',
)