From: Mark Wong Date: Wed, 13 Dec 2017 19:31:16 +0000 (-0800) Subject: Add sbin locations to PATH for sysctl X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5d53b09b66d8b378e01c1bcec56fdd67bfd6d581;p=pgperffarm.git 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. --- 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]