I tracked down the problem to the Linux Agent and the variable MK_RUN_ASYNC_PARTS
set in the systemctl service file
# grep ASYNC /etc/systemd/system/check_mk@.service
Environment="MK_RUN_ASYNC_PARTS=false"
The behaviour is
-
chrony.cache
file is outdated long time ago. - opening a connection to port 6556 runs fine but it does not update the
chrony.cache
file. - Running manually the Linux Agent does update the
chrony.cache
file and therefore the alert is cleared.
I guess the following part of the run_cached
function in the Linux Agent ends before reach the last lines because of the value of the MK_RUN_ASYNC_PARTS
variable.
$MK_RUN_ASYNC_PARTS || return
# Cache file outdated and new job not yet running? Start it
if [ -z "$USE_CACHEFILE" ] && [ ! -e "$CACHEFILE.new" ]; then
# When the command fails, the output is throws away ignored
if [ $mrpe -eq 1 ]; then
echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; run_mrpe $NAME \"$CMDLINE\" && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup /bin/bash >/dev/null 2>&1 &
else
echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup /bin/bash >/dev/null 2>&1 &
fi
fi
Test:
# date
Mon Mar 27 15:00:32 CEST 2023
# ll /var/lib/check_mk_agent/cache/chrony.cache
-rw------- 1 root root 497 Mar 27 11:25 /var/lib/check_mk_agent/cache/chrony.cache
# export MK_RUN_ASYNC_PARTS=false
# check_mk_agent >/dev/null 2>&1
# ll /var/lib/check_mk_agent/cache/chrony.cache
-rw------- 1 root root 497 Mar 27 11:25 /var/lib/check_mk_agent/cache/chrony.cache
# unset MK_RUN_ASYNC_PARTS
# check_mk_agent >/dev/null 2>&1
# ll /var/lib/check_mk_agent/cache/chrony.cache
-rw------- 1 root root 497 Mar 27 15:02 /var/lib/check_mk_agent/cache/chrony.cache
Best regards