CheckMK – Python local script not returning metrics

CMK version: 2.3.0p36
OS version: rhel-9.6

Hello, I’m new to CheckMK, but I have a problem — I’m trying to add my first script/plugin and ran into a rather strange issue.

I’m testing the functionality with the simplest echo/print,
and for example, when I placed a script in /usr/lib/check_mk_agent/local on the monitored host, it worked immediately:

#!/bin/sh
echo “test”
It works perfectly, and right away I get a new metric.
But when I try to run something in Python, like:

#!/usr/bin/env python3
print(“TEST”)

I don’t get any metric.
I tried adding #!/usr/bin/env python and #!/usr/bin/python3, but it doesn’t help. When I run the script manually, it works fine, but CheckMK doesn’t seem to return any metrics from Python at all.

I even tried to:
Limit script types to execute: py, sh — also without effect.

Maybe someone can give me a hint, because I feel like I’m making some very basic mistake — but which one?

Hello @Kirlen ,
welcome to the Checkmk forum.

Can you maybe clarify what metric do you mean?
“echo test” is not a local check format for metrics. :slight_smile:

Have you tried to use the proper local check context to create performance data?
for Example:

Docs: Local checks

Hope this helps.

Best Regards
Norm

ah, that explain my problem, changed to
print(“0 test_py - test string”)

and it works :wink:

1 Like