@cryptotaxi247 / netdata-1 / commits / 2e6820a9b

fixed sensors

paulfantom committed Jul 7, 2016 at 19:04 UTC 2e6820a9b03a8e99c935bd04c5a0efb6dae7e585
2 files changed +9 -8
python.d/python_modules/lm_sensors.py
+4 -4
@@ -32,10 +32,10 @@ TYPE_DICT = {
32 5: 'current',
33 6: 'humidity',
34 7: 'max_main',
35 - 10: 'vid',
36 - 11: 'intrusion',
37 - 12: 'max_other',
38 - 18: 'beep_enable'
35 + 16: 'vid',
36 + 17: 'intrusion',
37 + 18: 'max_other',
38 + 24: 'beep_enable'
39 }
40
41 class SensorsError(Exception):
python.d/sensors.chart.py
+5 -4
@@ -8,7 +8,7 @@ import lm_sensors as sensors
8 # default module values (can be overridden per job in `config`)
9 # update_every = 2
10
11 -ORDER = ['temperature', 'voltage', 'fan', 'power', 'current', 'energy', 'humidity']
11 +ORDER = ['temperature', 'fan', 'voltage', 'current', 'power', 'energy', 'humidity']
12
13 # This is a prototype of chart definition which is used to dynamically create self.definitions
14 CHARTS = {
@@ -63,7 +63,7 @@ class Service(SimpleService):
63 prefix = '_'.join(str(chip.path.decode()).split('/')[3:])
64 lines = {}
65 for feature in chip:
66 - data[prefix + "_" + str(feature.name.decode())] = feature.get_value()
66 + data[prefix + "_" + str(feature.name.decode())] = feature.get_value() * 1000
67 except Exception as e:
68 self.error(e)
69 return None
@@ -79,6 +79,8 @@ class Service(SimpleService):
79 name = ""
80 lines = []
81 for feature in chip:
82 + if feature.get_value() != 0:
83 + continue
84 if sensors.TYPE_DICT[feature.type] == type:
85 name = str(chip.prefix.decode()) + "_" + sensors.TYPE_DICT[feature.type]
86 if name not in self.order:
@@ -90,14 +92,13 @@ class Service(SimpleService):
92 line = list(CHARTS[type]['lines'][0])
93 line[0] = prefix + "_" + str(feature.name.decode())
94 line[1] = str(feature.label)
93 - print(line)
95 self.definitions[name]['lines'].append(line)
96
97 def check(self):
98 try:
99 sensors.init()
100 except Exception as e:
100 - print(e)
101 + self.error(e)
102 return False
103 try:
104 self._create_definitions()