Wir nutzen Cookies, um Ihnen eine optimale Nutzung dieser Webseite zu ermöglichen. Mehr Informationen finden Sie im Datenschutzhinweis. Wir nehmen an, dass Sie damit einverstanden sind, falls Sie diese Webseite weiter besuchen.

Ihre Cookie-Einstellungen
Ihre Einstellungen wurden aktualisiert.
Damit die Änderungen wirksam werden, löschen Sie bitte Ihre Browser-Cookies und den Cache und laden dann die Seite neu.

Werk #11118: Plugin development: make all includes imports

KomponenteChecks & Agents
TitelPlugin development: make all includes imports
Datum2020-10-19 09:44:43
Checkmk EditionCheckmk Raw Edition (CRE)
Checkmk Version2.0.0i1
LevelTrivial Change
KlasseNew Feature
KompatibilitätIncompatible - Manual interaction might be required

This Werk only affects users who have developed their own check or inventory plugins *and* are using some of the shipped includes in them.

The *.include files have been moved to a dedicated module and are replaced with imports.

Note that the "include" mechanism is still available. If you are using your own include file you can continue to to so. However, if you are using (or shadowing) one of the shipped include files, you will need to change your plugins.

Users who are using code from a shipped include file should adapt their plugin in the following way:

  • drop the "includes" keyword from the check_info
  • import the required names from the module coresponding to the former include file

For example: If you used the line

"includes": ["temperature.include"],

to access the check_temperature function, you should now add the line

from cmk.base.check_legacy_includes.temperature import check_temperature

at the top of your plugin.

You can grep for "temperature import" in the checks directory for some examples. The checks/ directory can be found either at the top level of the git repository, or in in the share/check_mk/ folder of your site. Note that a wildcard import is used currently, but this is considered bad practice. You should explicitly import the required names.

If you have made local changes to an include file *but not to the plugin that should be affected*, you need to do the reverse: Locally change said plugin to re-introduce the "includes" key to the check_info *and* remove the corresponding import statement.