]> arthur.barton.de Git - netdata.git/commitdiff
sensors: ignore overflow value
authorXuefer <xuefer@gmail.com>
Sat, 10 Sep 2016 10:02:24 +0000 (18:02 +0800)
committerXuefer <xuefer@gmail.com>
Thu, 22 Sep 2016 02:08:35 +0000 (10:08 +0800)
Signed-off-by: Xuefer <xuefer@gmail.com>
python.d/sensors.chart.py

index 7abe7f0809d45a5f20f47147501bf8126072544f..f2960958a67158066c85f2056ff429063dc3e283 100644 (file)
@@ -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)