Debug custom plugin - no print output in function "check"

I have no debug output from function “def check_”.
What is wrong with my thinking?

  • pprint(‘ABC-Import’)
  • pprint(‘ABC-Discover’)
  • pprint(‘ABC-Check’) → missing

Sample:

from .agent_based_api.v1 import *

from cmk.utils import debug
from pprint import pprint

if debug.enabled():
    pprint('ABC-Import')

def discover_my_rest_api(section):
    if debug.enabled():
        pprint('ABC-Discover')
    for replcheck, replvalue in section:
        yield Service(item=replcheck)

def check_my_rest_api(item, section):
    if debug.enabled():
        pprint('ABC-Check')
    for replcheck, replvalue in section:
        if replcheck == item:
            if replcheck== 'TestABC':
                if int(replvalue[0]) == 0:
                    yield Result(state=State.WARN, summary="Keine Nodes!")
                else:
                    yield Result(state=State.OK, summary=replvalue+" Nodes")
            return

register.check_plugin(
    name="my_rest_api",
    service_name="Test rest API %s",
    discovery_function=discover_my_rest_api,
    check_function=check_my_rest_api,
)

Plugin test:

cmk  --debug -vII --plugins my_rest_api abctest

Result:

'ABC-Import'
Discovering services and host labels on: abctest
abctest:
+ FETCHING DATA
[ProgramFetcher] Execute data source
[PiggybackFetcher] Execute data source
No piggyback files for 'abctest'. Skip processing.
+ ANALYSE DISCOVERED HOST LABELS
SUCCESS - Found no host labels
+ ANALYSE DISCOVERED SERVICES
+ EXECUTING DISCOVERY PLUGINS (1)
'ABC-Discover'
  1 my_rest_api
SUCCESS - Found 1 services

Thanks

-II will only call the discovery function.
cmk without -II will call the check function.

These are two different phases.

Great, it works thank you