Values of local check don't get transferred to check_mk

Hello,

we have a problem with a local check on our Check_MK Enterprise V.2.1.0.p32 on an Ubuntu 22.04 LTS. We wrote a Bash script to get some energy values from a database on multiple hosts running Rocky Linux 8.8. But the values aren’t transferred to Check_MK.

If we run the script directly or by using “check_mk_agent” we get the values in the local section like:

<<<local:sep(0)>>>
0 HW_corrupted value=0 0
0 GPU_power value=28 28 W
0 GPU_Temperature value=37 37 C
0 GPU_Utilisation value=0 0

But if we try to get it from the Check_MK or even locally using “nc” we get this:

<<<local:sep(0)>>>
0 HW_corrupted value=
0 GPU_power value=  W
0 GPU_Temperature value=  C
0 GPU_Utilisation value=

We also checked the permissions on the files and made them more open but it didn’t help:
-rwxr-xr-x 1 root root 2975 Dec 21 10:54 cmk_local_dcdb.sh

Does anybody have an idea on why this could be happening? Are we missing something? Other local checks on those hosts are working fine.

Best Regards,
Pascal

Under what user is the check_mk agent running? If it’s not root it may be a permissions thing; the non-root user not being able to read the values.

If that’s not the case, is it possible to enble some sort of debugging output so you can see what the difference is between local and remote execution.

Hello,

the agent is running under root so there shouldn’t be any problems. Here’s an excerpt from the systemd file:

# systemd service definition file
[Unit]
Description=Checkmk agent

[Service]
...
User=root
...

But with some debugging of the command I saw that it can’t connect to the database when running from remote. I am just not sure why. I am trying to find the difference now. But thank you. I wouldn’t have found it otherwise.

Ah, that would typically be because it doesn’t have the environment settings it has when logging in via a shell. You may want to set them explicitly in your script.

2 Likes

Yes, it was exactly that! One damn variable wasn’t set anymore when running from remote…
But now it works! Thank you so much!

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.