From 3bf0483a6e1d50b9785acc9e268017d79b958e9e Mon Sep 17 00:00:00 2001 From: Xuefer Date: Sat, 10 Sep 2016 18:02:24 +0800 Subject: [PATCH] sensors: ignore overflow value Signed-off-by: Xuefer --- python.d/sensors.chart.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python.d/sensors.chart.py b/python.d/sensors.chart.py index 7abe7f08..f2960958 100644 --- a/python.d/sensors.chart.py +++ b/python.d/sensors.chart.py @@ -49,6 +49,13 @@ CHARTS = { ]} } +LIMITS = { + 'temperature': [-127, 1000], + 'voltage': [-127, 127], + 'current': [-127, 127], + 'fan': [0, 65535] +} + TYPE_MAP = { 0: 'voltage', 1: 'fan', @@ -82,6 +89,11 @@ class Service(SimpleService): for sf in sfi: val = sensors.get_value(chip, sf.number) break + typeName = TYPE_MAP[feature.type] + if typeName in LIMITS: + limit = LIMITS[typeName]; + if val < limit[0] or val > limit[1]: + continue data[prefix + "_" + str(feature.name.decode())] = int(val * 1000) except Exception as e: self.error(e) -- 2.39.2