The NTP service isn’t discovered anymore on my Slackware-based system (Unraid). The service is launched from /usr/sbin/ntpd and it used to work in 1.6.x, so I looked at the new Linux agent code and the problem is definitely in there:
section_ntp() {
if [ -n "$IS_DOCKERIZED" ] || [ -n "$IS_LXC_CONTAINER" ]; then
return 0
fi
# First we try to identify if we're beholden to systemd
if inpath systemctl; then
# shellcheck disable=SC2016
if [ "$(systemctl | awk '/ntp.service|ntpd.service/{print $3; exit}')" = "active" ]; then
# remove heading, make first column space separated
get_ntpq
return
fi
fi
# If we get to this point, we attempt via classic ntp daemons (ntpq required)
if inpath ntpq; then
# Try to determine status via /etc/init.d
# This might also be appropriate for AIX, Solaris and others
for _ntp_daemon in ntp ntpd openntpd; do
# Check for a service script
if [ -x /etc/init.d/"${_ntp_daemon}" ]; then
# If the status returns 0, we assume we have a running service
if /etc/init.d/"${_ntp_daemon}" status >/dev/null 2>&1; then
get_ntpq
return
fi
fi
done
unset -v _ntp_daemon
fi
}
So this piece of code looks for ntpd in systemd or init.d. In the 1.6 agent they don’t bother with sanitary checks like this, they just try to run ntpq if it exists.
The easy way to fix this for me is literally just to add get_ntpq at the end of this session_ntp() function since the get_ntpq() function also checks if ntpq exists before calling it, thus making it somewhat safe for my specific use-case, but this needs more attention from the dev team.
section_ntp() {
if [ -n "$IS_DOCKERIZED" ] || [ -n "$IS_LXC_CONTAINER" ]; then
return 0
fi
# First we try to identify if we're beholden to systemd
if inpath systemctl; then
# shellcheck disable=SC2016
if [ "$(systemctl | awk '/ntp.service|ntpd.service/{print $3; exit}')" = "active" ]; then
# remove heading, make first column space separated
get_ntpq
return
fi
fi
# If we get to this point, we attempt via classic ntp daemons (ntpq required)
if inpath ntpq; then
# Try to determine status via /etc/init.d
# This might also be appropriate for AIX, Solaris and others
for _ntp_daemon in ntp ntpd openntpd; do
# Check for a service script
if [ -x /etc/init.d/"${_ntp_daemon}" ]; then
# If the status returns 0, we assume we have a running service
if /etc/init.d/"${_ntp_daemon}" status >/dev/null 2>&1; then
get_ntpq
return
fi
fi
# this for systems that don't use initd or systemd, we can't check the service status
if [ -x /usr/sbin/"${_ntp_daemon}" ]; then
get_ntpq
return
fi
done
unset -v _ntp_daemon
fi
}
The easiest way to get this integrated into the normal code base is, make a pull request on github with this fix. As it is a fix for a problem and no “enhancement” it should also be processed.
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.