diff options
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/cpufreq/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/python.d.plugin/cpufreq/README.md | 30 | ||||
-rw-r--r-- | collectors/python.d.plugin/cpufreq/cpufreq.chart.py (renamed from python.d/cpufreq.chart.py) | 12 | ||||
-rw-r--r-- | collectors/python.d.plugin/cpufreq/cpufreq.conf (renamed from conf.d/python.d/cpufreq.conf) | 0 |
4 files changed, 50 insertions, 5 deletions
diff --git a/collectors/python.d.plugin/cpufreq/Makefile.inc b/collectors/python.d.plugin/cpufreq/Makefile.inc new file mode 100644 index 000000000..d6138801d --- /dev/null +++ b/collectors/python.d.plugin/cpufreq/Makefile.inc @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +# THIS IS NOT A COMPLETE Makefile +# IT IS INCLUDED BY ITS PARENT'S Makefile.am +# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT + +# install these files +dist_python_DATA += cpufreq/cpufreq.chart.py +dist_pythonconfig_DATA += cpufreq/cpufreq.conf + +# do not install these files, but include them in the distribution +dist_noinst_DATA += cpufreq/README.md cpufreq/Makefile.inc + diff --git a/collectors/python.d.plugin/cpufreq/README.md b/collectors/python.d.plugin/cpufreq/README.md new file mode 100644 index 000000000..33891d59d --- /dev/null +++ b/collectors/python.d.plugin/cpufreq/README.md @@ -0,0 +1,30 @@ +# cpufreq + +This module shows the current CPU frequency as set by the cpufreq kernel +module. + +**Requirement:** +You need to have `CONFIG_CPU_FREQ` and (optionally) `CONFIG_CPU_FREQ_STAT` +enabled in your kernel. + +This module tries to read from one of two possible locations. On +initialization, it tries to read the `time_in_state` files provided by +cpufreq\_stats. If this file does not exist, or doesn't contain valid data, it +falls back to using the more inaccurate `scaling_cur_freq` file (which only +represents the **current** CPU frequency, and doesn't account for any state +changes which happen between updates). + +It produces one chart with multiple lines (one line per core). + +### configuration + +Sample: + +```yaml +sys_dir: "/sys/devices" +``` + +If no configuration is given, module will search for cpufreq files in `/sys/devices` directory. +Directory is also prefixed with `NETDATA_HOST_PREFIX` if specified. + +--- diff --git a/python.d/cpufreq.chart.py b/collectors/python.d.plugin/cpufreq/cpufreq.chart.py index 3abde736c..cbbab6d7f 100644 --- a/python.d/cpufreq.chart.py +++ b/collectors/python.d.plugin/cpufreq/cpufreq.chart.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # Description: cpufreq netdata python.d module -# Author: Pawel Krupa (paulfantom) and Steven Noonan (tycho) +# Author: Pawel Krupa (paulfantom) +# Author: Steven Noonan (tycho) +# SPDX-License-Identifier: GPL-3.0-or-later import glob import os @@ -17,7 +19,8 @@ CHARTS = { 'options': [None, 'CPU Clock', 'MHz', 'cpufreq', 'cpufreq.cpufreq', 'line'], 'lines': [ # lines are created dynamically in `check()` method - ]} + ] + } } @@ -92,7 +95,7 @@ class Service(SimpleService): self.assignment[cpu]['accurate'] = path self.accurate_last[cpu] = {} - if len(self.assignment) == 0: + if not self.assignment: self.accurate_exists = False for path in glob.glob(self.sys_dir + '/system/cpu/cpu*/cpufreq/scaling_cur_freq'): @@ -102,7 +105,7 @@ class Service(SimpleService): self.assignment[cpu] = {} self.assignment[cpu]['inaccurate'] = path - if len(self.assignment) == 0: + if not self.assignment: self.error("couldn't find a method to read cpufreq statistics") return False @@ -110,4 +113,3 @@ class Service(SimpleService): self.definitions[ORDER[0]]['lines'].append([name, name, 'absolute', 1, 1000]) return True - diff --git a/conf.d/python.d/cpufreq.conf b/collectors/python.d.plugin/cpufreq/cpufreq.conf index 0890245d9..0890245d9 100644 --- a/conf.d/python.d/cpufreq.conf +++ b/collectors/python.d.plugin/cpufreq/cpufreq.conf |