diff --git a/monitoring/collectd-extensions/centos/build_srpm.data b/monitoring/collectd-extensions/centos/build_srpm.data index cb4885304..fb8be4619 100644 --- a/monitoring/collectd-extensions/centos/build_srpm.data +++ b/monitoring/collectd-extensions/centos/build_srpm.data @@ -16,4 +16,4 @@ COPY_LIST="$PKG_BASE/src/LICENSE \ $PKG_BASE/src/example.py \ $PKG_BASE/src/example.conf" -TIS_PATCH_VER=2 +TIS_PATCH_VER=3 diff --git a/monitoring/collectd-extensions/src/memory.py b/monitoring/collectd-extensions/src/memory.py index 2b436aeca..65e467c1b 100755 --- a/monitoring/collectd-extensions/src/memory.py +++ b/monitoring/collectd-extensions/src/memory.py @@ -74,16 +74,26 @@ def config_func(config): (PLUGIN, obj.cmd)) -# Get the platform cpu list and number of cpus reported by /proc/cpuinfo +# Load the hostname and kernel memory 'overcommit' setting. def init_func(): # get current hostname obj.hostname = os.uname()[1] + # get strict setting + # + # a value of 0 means "heuristic overcommit" + # a value of 1 means "always overcommit" + # a value of 2 means "don't overcommit". + # + # set strict true strict=1 if value is = 2 + # otherwise strict is false strict=0 (default) + fn = '/proc/sys/vm/overcommit_memory' if os.path.exists(fn): with open(fn, 'r') as infile: for line in infile: - obj.strict = int(line) + if int(line) == 2: + obj.strict = 1 break collectd.info("%s strict:%d" % (PLUGIN, obj.strict))