sensors: ignore overflow value
Signed-off-by: Xuefer <xuefer@gmail.com>
Xuefer committed
Sep 10, 2016 at 18:02 UTC
3bf0483a6e1d50b9785acc9e268017d79b958e9e
1 file changed
+12
python.d/sensors.chart.py
+12
@@ -49,6 +49,13 @@ CHARTS = {
49
]}
50
}
51
52
+LIMITS = {
53
+ 'temperature': [-127, 1000],
54
+ 'voltage': [-127, 127],
55
+ 'current': [-127, 127],
56
+ 'fan': [0, 65535]
57
+}
58
+
59
TYPE_MAP = {
60
0: 'voltage',
61
1: 'fan',
@@ -82,6 +89,11 @@ class Service(SimpleService):
89
for sf in sfi:
90
val = sensors.get_value(chip, sf.number)
91
break
92
+ typeName = TYPE_MAP[feature.type]
93
+ if typeName in LIMITS:
94
+ limit = LIMITS[typeName];
95
+ if val < limit[0] or val > limit[1]:
96
+ continue
97
data[prefix + "_" + str(feature.name.decode())] = int(val * 1000)
98
except Exception as e:
99
self.error(e)