"cpufreq" module fixes
lgz committed
Oct 13, 2017 at 17:42 UTC
9350c06e37dd3c43ddeb249c68f074882c222cc5
1 file changed
+3
-16
python.d/cpufreq.chart.py
+3
-16
@@ -14,12 +14,13 @@ ORDER = ['cpufreq']
14
15
CHARTS = {
16
'cpufreq': {
17
- 'options': [None, 'CPU Clock', 'MHz', 'cpufreq', None, 'line'],
17
+ 'options': [None, 'CPU Clock', 'MHz', 'cpufreq', 'cpufreq', 'line'],
18
'lines': [
19
# lines are created dynamically in `check()` method
20
]}
21
}
22
23
+
24
class Service(SimpleService):
25
def __init__(self, configuration=None, name=None):
26
prefix = os.getenv('NETDATA_HOST_PREFIX', "")
@@ -29,7 +30,7 @@ class Service(SimpleService):
30
SimpleService.__init__(self, configuration=configuration, name=name)
31
self.order = ORDER
32
self.definitions = CHARTS
32
- self._orig_name = ""
33
+ self.fake_name = 'cpu'
34
self.assignment = {}
35
self.accurate_exists = True
36
self.accurate_last = {}
@@ -72,7 +73,6 @@ class Service(SimpleService):
73
if accurate_ok:
74
return data
75
75
-
76
for name, paths in self.assignment.items():
77
data[name] = open(paths['inaccurate'], 'r').read()
78
@@ -84,8 +84,6 @@ class Service(SimpleService):
84
except (KeyError, TypeError):
85
self.error("No path specified. Using: '" + self.sys_dir + "'")
86
87
- self._orig_name = self.chart_name
88
-
87
for path in glob.glob(self.sys_dir + '/system/cpu/cpu*/cpufreq/stats/time_in_state'):
88
path_elem = path.split('/')
89
cpu = path_elem[-4]
@@ -113,14 +111,3 @@ class Service(SimpleService):
111
112
return True
113
116
- def create(self):
117
- self.chart_name = "cpu"
118
- status = SimpleService.create(self)
119
- self.chart_name = self._orig_name
120
- return status
121
-
122
- def update(self, interval):
123
- self.chart_name = "cpu"
124
- status = SimpleService.update(self, interval=interval)
125
- self.chart_name = self._orig_name
126
- return status