Fix Debian NTP path used by collectd plugin

The collectd log was showing stacktraces on Debian
when attempting to invoke the ntp plugin.

ntpq is located at /usr/bin/ntpq on Debian.

The plugin will now use that location when running
on Debian.  This will prevent the stacktraces, and
fixes how collect monitors NTP.

Test Plan:
  Build / Install / Provision AIO-SX.  Enable NTP.
  Verify collectd logs are clean.

Closes-Bug: #1998503
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I23130022c92023773ace22b674845761e0ff23ec
This commit is contained in:
Al Bailey
2022-12-01 15:43:26 +00:00
parent 571d0e4205
commit c9a017b1d7

View File

@@ -78,6 +78,7 @@ PLUGIN = 'NTP query plugin'
PLUGIN_INTERVAL = 300 # audit interval in secs
PLUGIN_CONF = '/etc/ntp.conf'
PLUGIN_EXEC = '/usr/sbin/ntpq'
PLUGIN_EXEC_DEBIAN = '/usr/bin/ntpq'
PLUGIN_EXEC_OPTIONS = '-pn'
PLUGIN_ALARMID = "100.114"
@@ -715,7 +716,7 @@ def read_func():
data = subprocess.check_output([PLUGIN_EXEC, PLUGIN_EXEC_OPTIONS])
else:
# Debian
data = subprocess.check_output([PLUGIN_EXEC, PLUGIN_EXEC_OPTIONS], encoding='utf-8')
data = subprocess.check_output([PLUGIN_EXEC_DEBIAN, PLUGIN_EXEC_OPTIONS], encoding='utf-8')
# Keep this FIT test code but make it commented out for security
#