Merge "Fix collectd Memory plugin Strict Mode learning"
This commit is contained in:
commit
14f168ac4b
@ -16,4 +16,4 @@ COPY_LIST="$PKG_BASE/src/LICENSE \
|
|||||||
$PKG_BASE/src/example.py \
|
$PKG_BASE/src/example.py \
|
||||||
$PKG_BASE/src/example.conf"
|
$PKG_BASE/src/example.conf"
|
||||||
|
|
||||||
TIS_PATCH_VER=2
|
TIS_PATCH_VER=3
|
||||||
|
@ -74,16 +74,26 @@ def config_func(config):
|
|||||||
(PLUGIN, obj.cmd))
|
(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():
|
def init_func():
|
||||||
# get current hostname
|
# get current hostname
|
||||||
obj.hostname = os.uname()[1]
|
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'
|
fn = '/proc/sys/vm/overcommit_memory'
|
||||||
if os.path.exists(fn):
|
if os.path.exists(fn):
|
||||||
with open(fn, 'r') as infile:
|
with open(fn, 'r') as infile:
|
||||||
for line in infile:
|
for line in infile:
|
||||||
obj.strict = int(line)
|
if int(line) == 2:
|
||||||
|
obj.strict = 1
|
||||||
break
|
break
|
||||||
|
|
||||||
collectd.info("%s strict:%d" % (PLUGIN, obj.strict))
|
collectd.info("%s strict:%d" % (PLUGIN, obj.strict))
|
||||||
|
Loading…
Reference in New Issue
Block a user