Output of plugin changes when called from agent

CMK version:

OS version:
Oracle Linux 7.9

Error message:
No error message

I’m using the mk_oracle plugin. Running it directly, I can see information about tablespaces for all the databases, but if I run it via the agent, I can only see some of them.

Here some example calling the agent directly:

[root@sbghodat1n0 (22:35:54) /usr/lib/check_mk_agent/plugins (BT90_2) ]$./mk_oracle  | egrep "oracle_tablespaces" -A1

Here some example when calling the agent:

[root@sbghodat1n0 (22:36:18) /usr/lib/check_mk_agent/plugins (BT90_2) ]$/usr/bin/check_mk_agent  | egrep "oracle_tablespaces" -A1
11:blkio:/user.slice,8:pids:/user.slice,7:memory:/user.slice,6:devices:/user.slice,4:cpu,cpuacct:/user.slice,1:name=systemd:/user.slice/user-169126.slice/session-621.scope root 114296 2344 00:00:00 00:01 70544 grep -E --color=auto oracle_tablespaces -A1
11:blkio:/system.slice/ohasd.service,8:pids:/system.slice/ohasd.service,7:memory:/system.slice/ohasd.service,6:devices:/system.slice/ohasd.service,1:name=systemd:/system.slice/oracle-ohasd.service oracle 17535012 27640 00:14:09 21-05:21:35 70548 ora_scm0_BT24_2

As you can see, if I call the plugin directly, I get information from 3 different databases, but if I call it via the agent, I get information only from one of the databases.

Any ideas what to do here, please?

Thanks and best regards,

You are running both under the same user, I am assuming?

This usually is a problem with differing environments (paths, libraries and other variables). To debug I suggest dumping the environment one time from the shell:

env > /tmp/env_shell.txt

and once by adding this lines to a dummy plugin /usr/lib/check_mk_agent/plugins/dummy.sh:

env > /tmp/env_plugin.txt

Make it executable chmod 0755 /usr/lib/check_mk_agent/plugins/dummy.sh, then wait a minute until it got executed and compare both. Differing variables that cause the differing outputs have to be set explicitly. There are some plugins where you can set environment variables by rules, for others you have to edit (or fork the plugin script itself).


I suggest env | sort > /tmp/env_shell.txt for easier comparison.


Hello mschlenker,

thank you very much for the hint. Finally, the problem was due to MK_VARDIR pointing to a different location. Now the issue is solved :slight_smile:

Best regards,

1 Like