diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/python.d.plugin/sensors/sensors.chart.py | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/sensors/sensors.chart.py (renamed from python.d/sensors.chart.py) | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/python.d/sensors.chart.py b/collectors/python.d.plugin/sensors/sensors.chart.py index 06e420b68..69d2bfe99 100644 --- a/python.d/sensors.chart.py +++ b/collectors/python.d.plugin/sensors/sensors.chart.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: sensors netdata python.d plugin # Author: Pawel Krupa (paulfantom) +# SPDX-License-Identifier: GPL-3.0-or-later from bases.FrameworkServices.SimpleService import SimpleService from third_party import lm_sensors as sensors @@ -16,37 +17,44 @@ CHARTS = { 'options': [None, ' temperature', 'Celsius', 'temperature', 'sensors.temperature', 'line'], 'lines': [ [None, None, 'absolute', 1, 1000] - ]}, + ] + }, 'voltage': { 'options': [None, ' voltage', 'Volts', 'voltage', 'sensors.voltage', 'line'], 'lines': [ [None, None, 'absolute', 1, 1000] - ]}, + ] + }, 'current': { 'options': [None, ' current', 'Ampere', 'current', 'sensors.current', 'line'], 'lines': [ [None, None, 'absolute', 1, 1000] - ]}, + ] + }, 'power': { 'options': [None, ' power', 'Watt', 'power', 'sensors.power', 'line'], 'lines': [ [None, None, 'absolute', 1, 1000000] - ]}, + ] + }, 'fan': { 'options': [None, ' fans speed', 'Rotations/min', 'fans', 'sensors.fan', 'line'], 'lines': [ [None, None, 'absolute', 1, 1000] - ]}, + ] + }, 'energy': { 'options': [None, ' energy', 'Joule', 'energy', 'sensors.energy', 'areastack'], 'lines': [ [None, None, 'incremental', 1, 1000000] - ]}, + ] + }, 'humidity': { 'options': [None, ' humidity', 'Percent', 'humidity', 'sensors.humidity', 'line'], 'lines': [ [None, None, 'absolute', 1, 1000] - ]} + ] + } } LIMITS = { @@ -94,7 +102,7 @@ class Service(SimpleService): limit = LIMITS[type_name] if val < limit[0] or val > limit[1]: continue - data[prefix + "_" + str(feature.name.decode())] = int(val * 1000) + data[prefix + '_' + str(feature.name.decode())] = int(val * 1000) except Exception as error: self.error(error) return None @@ -114,7 +122,7 @@ class Service(SimpleService): continue if TYPE_MAP[feature.type] == sensor: # create chart - name = chip_name + "_" + TYPE_MAP[feature.type] + name = chip_name + '_' + TYPE_MAP[feature.type] if name not in self.order: self.order.append(name) chart_def = list(CHARTS[sensor]['options']) @@ -122,7 +130,7 @@ class Service(SimpleService): self.definitions[name] = {'options': chart_def} self.definitions[name]['lines'] = [] line = list(CHARTS[sensor]['lines'][0]) - line[0] = chip_name + "_" + str(feature.name.decode()) + line[0] = chip_name + '_' + str(feature.name.decode()) line[1] = sensors.get_label(chip, feature) self.definitions[name]['lines'].append(line) @@ -136,4 +144,3 @@ class Service(SimpleService): self.create_definitions() return True - |