]> arthur.barton.de Git - netdata.git/commitdiff
fixed sensors
authorpaulfantom <paulfantom@gmail.com>
Thu, 7 Jul 2016 17:04:19 +0000 (19:04 +0200)
committerpaulfantom <paulfantom@gmail.com>
Thu, 7 Jul 2016 17:04:19 +0000 (19:04 +0200)
python.d/python_modules/lm_sensors.py
python.d/sensors.chart.py

index 4b111f5692216bbc234ed05da43c076a347478ac..106cf374e7b9c8ef6451aab2a0ef2080421bcb3f 100644 (file)
@@ -32,10 +32,10 @@ TYPE_DICT = {
     5: 'current',
     6: 'humidity',
     7: 'max_main',
-    10: 'vid',
-    11: 'intrusion',
-    12: 'max_other',
-    18: 'beep_enable'
+    16: 'vid',
+    17: 'intrusion',
+    18: 'max_other',
+    24: 'beep_enable'
 }
 
 class SensorsError(Exception):
index 0807f1aa7acbedc7331b3105ef922f472cf0829c..38c45657155f226d3c7a15930cf903cb08896bb5 100644 (file)
@@ -8,7 +8,7 @@ import lm_sensors as sensors
 # default module values (can be overridden per job in `config`)
 # update_every = 2
 
-ORDER = ['temperature', 'voltage', 'fan', 'power', 'current', 'energy', 'humidity']
+ORDER = ['temperature', 'fan', 'voltage', 'current', 'power', 'energy', 'humidity']
 
 # This is a prototype of chart definition which is used to dynamically create self.definitions
 CHARTS = {
@@ -63,7 +63,7 @@ class Service(SimpleService):
                 prefix = '_'.join(str(chip.path.decode()).split('/')[3:])
                 lines = {}
                 for feature in chip:
-                    data[prefix + "_" + str(feature.name.decode())] = feature.get_value()
+                    data[prefix + "_" + str(feature.name.decode())] = feature.get_value() * 1000
         except Exception as e:
             self.error(e)
             return None
@@ -79,6 +79,8 @@ class Service(SimpleService):
                 name = ""
                 lines = []
                 for feature in chip:
+                    if feature.get_value() != 0:
+                        continue
                     if sensors.TYPE_DICT[feature.type] == type:
                         name = str(chip.prefix.decode()) + "_" + sensors.TYPE_DICT[feature.type]
                         if name not in self.order:
@@ -90,14 +92,13 @@ class Service(SimpleService):
                         line = list(CHARTS[type]['lines'][0])
                         line[0] = prefix + "_" + str(feature.name.decode())
                         line[1] = str(feature.label)
-                        print(line)
                         self.definitions[name]['lines'].append(line)
 
     def check(self):
         try:
             sensors.init()
         except Exception as e:
-            print(e)
+            self.error(e)
             return False
         try:
             self._create_definitions()