CheckMK 2.0 API - no imports of previous python modules like time / re

Hi there,

during my time migrating my own check plugins to new CheckMK 2.0 API, i noticed missing python module imports.

When consulting the Guidelines for coding check plug-ins it states clearly:

Do not use import in your check files. All permitted Python modules have already been imported.

But in reality, I must explicitly import the module re and time by myself. These modules were previosly already imported within plugin context.

Is this intended?

Thank you

Best Regards
Markus

Hi Markus,

the guidelines were “Last modified on 15-Jun-2020”.
I think they haven’t updated the guidelines to the new 2.0 API.

There is a blog post describing how you migrate check plugins:
Migrating check plug-ins to Checkmk 2.0

Here it states:

Before we can start the actual migration, we first need to clean up the code and make it as ‘close’ to the new API as possible - but without actually porting it. To do this, add the required ‘import’ commands. That was previously unnecessary with the ‘old’ libraries, since Checkmk made sure that they were ‘magically’ available. With the new Check API, however, each user is responsible for ensuring that they import the required Python libraries on a regular basis.

1 Like

Thank you very much for enlighting me.

Best Regards
Markus