From 5d53b09b66d8b378e01c1bcec56fdd67bfd6d581 Mon Sep 17 00:00:00 2001 From: Mark Wong Date: Wed, 13 Dec 2017 11:31:16 -0800 Subject: [PATCH] Add sbin locations to PATH for sysctl The location of sysctl may change depending on the distribution. Try to add all possible paths to the environment. --- client/collectors/linux.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/collectors/linux.py b/client/collectors/linux.py index 31c0428..3a8b231 100644 --- a/client/collectors/linux.py +++ b/client/collectors/linux.py @@ -15,6 +15,10 @@ class LinuxCollector(object): self._start_ts = None self._end_ts = None + # Hard code all possible places a packager might install sysctl. + self._env = os.environ + self._env['PATH'] = ':'.join(['/usr/sbin/', '/sbin/', self._env['PATH']]) + def start(self): self._start_ts = datetime.now() @@ -80,7 +84,7 @@ class LinuxCollector(object): 'collect kernel configuration' log("collecting sysctl") - r = run_cmd(['/usr/sbin/sysctl', '-a']) + r = run_cmd(['sysctl', '-a'], env=self._env) return r[1] -- 2.39.5