From .agent_based_api.v1 import * Error

Hi, I just now wrote a Check plugins according to the Document.
But i got the error by import the api module.

Traceback (most recent call last):
File “./Cisco_CMS.py”, line 3, in
from .agent_based_api.v1 import *
ImportError: attempted relative import with no known parent package

I tried with pip3 install agent_based_api, but it was not found.
How can I solve the problem?

A little bit more context to your check would be good.
How do you have done the test. What version of CMK do you use and so on.

This looks like code for the upcoming CMK 2.0 version. Is your development site already running the innovation release?

I am follwoing the german version Document for creating plugins.

and I am running at OMD - Open Monitoring Distribution Version 1.6.0p13.cee

No, i am running at OMD - Open Monitoring Distribution Version 1.6.0p13.cee

The documentation is for CheckMK 2.0 and later.

This is the starting document for the older versions: https://checkmk.de/cms_legacy_writing_checks.html

Hi, thanks for your Tips.
I tried your Docus and changed my script according to it. But still the error.

aster@checkmk:/opt/omd/sites/pn/local/share/check_mk/checks$ ./Cisco_CMS.py
Traceback (most recent call last):
File “./Cisco_CMS.py”, line 24, in
check_info[“Cisco_CMS”] = {
NameError: name ‘check_info’ is not defined

My Skript is as below:
def inventory_cisco_cms(section):
for item, value in section:
yield Service(item=item)

def check_cisco_cms(section):
for item, value in section:
if item == ‘Voice’:
yield Metrik(name=item, value=value, levels=(300,400))
elif item == ‘Video’:
yield Metrik(name=item, value=value, levels=(70,140))
else:
yield Metrik(name=item, value=value)

yield Result(state=State.OK, summary="CMS")
return

check_info[“Cisco_CMS”] = {
‘check_function’: check_cisco_cms,
‘inventory_function’: inventory_cisco_cms,
‘service_description’: ‘Cisco CMS Überwachung %s’,
‘has_perfdata’: True,
}

The output from agent:

<<>>
<<<Cisco_CMS>>>
Voice 25
Video 38
Conference 16
Outgoing 52.7
Incoming 43.1
(END)

You cannot start only the check plugin. It’s a plugin.

You can debug your plugins with a call to cmk -vv --debug --checks Cisco_CMS <hostname>.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.