Plugin Development 2.0.0

Heyho,
i have a Problem to develop an Plugin for check_mk-v2.
The Problem is there there it after some time refused to run.
The Script: cmk_nextcloud/nextcloud.py at master · Serverfrog/cmk_nextcloud (github.com)

The Error Stacktrace:

Error in plugin file /omd/sites/checkfrog/local/share/check_mk/checks/nextcloud: "'__name__' not in globals"
Traceback (most recent call last):
  File "/omd/sites/checkfrog/bin/cmk", line 79, in <module>
errors = config.load_all_agent_based_plugins(check_api.get_check_api_context)
  File "/omd/sites/checkfrog/lib/python3/cmk/base/config.py", line 1415, in load_all_agent_based_plugins
errors.extend(load_checks(get_check_api_context, filelist))
  File "/omd/sites/checkfrog/lib/python3/cmk/base/config.py", line 1494, in load_checks
did_compile |= load_precompiled_plugin(f, check_context)
  File "/omd/sites/checkfrog/lib/python3/cmk/base/config.py", line 1776, in load_precompiled_plugin
exec(marshal.loads(open(precompiled_path, "rb").read()[_PYCHeader.SIZE:]), check_context)
  File "/omd/sites/checkfrog/local/share/check_mk/checks/nextcloud", line 2, in <module>
from .agent_based_api.v1 import *
KeyError: "'__name__' not in globals"

I followed the the Wiki Writing your own check plug-ins (checkmk.com) which seems that the Problem is the import which is checkmk-v2 needed

Hi,
looks like that the check is in wrong path. From my point of view, you need to move the check from ~/local/share/check_mk to ~/local/lib/python3/cmk/base/plugins/agent_based .
Then the v1 libs are found.
Cheers,
Christian

1 Like

Thanks a lot for the fix!

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.