checkmk icon indicating copy to clipboard operation
checkmk copied to clipboard

Linux agent: ignore QEMU Emulator as shell (when on ARM)

Open simonmeggle opened this issue 2 years ago • 1 comments

General information

This bug probably only occurs when developing, and only when the checkmk container is running on Rosetta/QEMU (Mac M1/ARM), as I am doing.

I wondered why the agent (also installed in the container) does silently ignore any execution of asynchronous plugins (robotmk).

Seen on CMK image 2.1.0p4, fixed for 2.1.0.p9 (Debian 10).

Proposed changes

  • Expected behaviour: execution of robotmk-runner.py in /usr/lib/check_mk_agent/plugins/180
  • Observed: no execution
  • The patch removes the shell /usr/bin/qemu-x86_64 from the ps comand output and takes the command which was executed by the QEMU emulator as shell (here: /bin/bash)
# the line being parsed by sed
root@e055ddab3af8:/cmk_plugins# ps -o args= -p $$
/usr/bin/qemu-x86_64 /bin/bash bash
# Wrong result: 
root@e055ddab3af8:/cmk_plugins# ps -o args= -p $$ | sed -e 's/^-//' -e 's/\ .*//'
/usr/bin/qemu-x86_64
# Patched: 
root@e055ddab3af8:/cmk_plugins# ps -o args= -p $$ | sed -e 's/^-//' -e 's/^.*qemu-x86_64 //' -e 's/\ .*//'
/bin/bash

simonmeggle avatar Aug 01 '22 16:08 simonmeggle

Can you add the lines from your comment

Done!

simonmeggle avatar Aug 23 '22 09:08 simonmeggle

Thanks, I'll merge this soon.

mo-ki avatar Sep 05 '22 13:09 mo-ki