summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin/cpufreq
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/charts.d.plugin/cpufreq/Makefile.inc13
-rw-r--r--collectors/charts.d.plugin/cpufreq/README.md2
-rw-r--r--collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh (renamed from charts.d/cpufreq.chart.sh)32
-rw-r--r--collectors/charts.d.plugin/cpufreq/cpufreq.conf (renamed from conf.d/charts.d/cpufreq.conf)0
4 files changed, 32 insertions, 15 deletions
diff --git a/collectors/charts.d.plugin/cpufreq/Makefile.inc b/collectors/charts.d.plugin/cpufreq/Makefile.inc
new file mode 100644
index 000000000..682379133
--- /dev/null
+++ b/collectors/charts.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_charts_DATA += cpufreq/cpufreq.chart.sh
+dist_chartsconfig_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/charts.d.plugin/cpufreq/README.md b/collectors/charts.d.plugin/cpufreq/README.md
new file mode 100644
index 000000000..d82951aac
--- /dev/null
+++ b/collectors/charts.d.plugin/cpufreq/README.md
@@ -0,0 +1,2 @@
+> THIS MODULE IS OBSOLETE.
+> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
diff --git a/charts.d/cpufreq.chart.sh b/collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh
index 1c41c38f2..1fc6caabf 100644
--- a/charts.d/cpufreq.chart.sh
+++ b/collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh
@@ -1,9 +1,10 @@
+# shellcheck shell=bash
# no need for shebang - this file is loaded from charts.d.plugin
+# SPDX-License-Identifier: GPL-3.0-or-later
# netdata
# real-time performance and health monitoring, done right!
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
-# GPL v3+
#
# if this chart is called X.chart.sh, then all functions and global variables
@@ -19,7 +20,7 @@ cpufreq_update_every=
cpufreq_priority=10000
cpufreq_find_all_files() {
- find $1 -maxdepth $cpufreq_sys_depth -name scaling_cur_freq 2>/dev/null
+ find "$1" -maxdepth $cpufreq_sys_depth -name scaling_cur_freq 2>/dev/null
}
# _check is called once, to find out if this chart should be enabled or not
@@ -29,30 +30,30 @@ cpufreq_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- [ -z "$( cpufreq_find_all_files $cpufreq_sys_dir )" ] && return 1
+ [ -z "$( cpufreq_find_all_files "$cpufreq_sys_dir" )" ] && return 1
return 0
}
# _create is called once, to create the charts
cpufreq_create() {
- local dir= file= id= i=
+ local dir file id i
# we create a script with the source of the
# cpufreq_update() function
# - the highest speed we can achieve -
- [ $cpufreq_source_update -eq 1 ] && echo >$TMP_DIR/cpufreq.sh "cpufreq_update() {"
+ [ $cpufreq_source_update -eq 1 ] && echo >"$TMP_DIR/cpufreq.sh" "cpufreq_update() {"
echo "CHART cpu.cpufreq '' 'CPU Clock' 'MHz' 'cpufreq' '' line $((cpufreq_priority + 1)) $cpufreq_update_every"
- echo >>$TMP_DIR/cpufreq.sh "echo \"BEGIN cpu.cpufreq \$1\""
+ echo >>"$TMP_DIR/cpufreq.sh" "echo \"BEGIN cpu.cpufreq \$1\""
i=0
- for file in $( cpufreq_find_all_files $cpufreq_sys_dir | sort -u )
+ for file in $( cpufreq_find_all_files "$cpufreq_sys_dir" | sort -u )
do
i=$(( i + 1 ))
- dir=$( dirname $file )
+ dir=$( dirname "$file" )
cpu=
- [ -f $dir/affected_cpus ] && cpu=$( cat $dir/affected_cpus )
+ [ -f "$dir/affected_cpus" ] && cpu=$( cat "$dir/affected_cpus" )
[ -z "$cpu" ] && cpu="$i.a"
id="$( fixid "cpu$cpu" )"
@@ -60,14 +61,15 @@ cpufreq_create() {
debug "file='$file', dir='$dir', cpu='$cpu', id='$id'"
echo "DIMENSION $id '$id' absolute 1 1000"
- echo >>$TMP_DIR/cpufreq.sh "echo \"SET $id = \"\$(< $file )"
+ echo >>"$TMP_DIR/cpufreq.sh" "echo \"SET $id = \"\$(< $file )"
done
- echo >>$TMP_DIR/cpufreq.sh "echo END"
+ echo >>"$TMP_DIR/cpufreq.sh" "echo END"
- [ $cpufreq_source_update -eq 1 ] && echo >>$TMP_DIR/cpufreq.sh "}"
+ [ $cpufreq_source_update -eq 1 ] && echo >>"$TMP_DIR/cpufreq.sh" "}"
# ok, load the function cpufreq_update() we created
- [ $cpufreq_source_update -eq 1 ] && . $TMP_DIR/cpufreq.sh
+ # shellcheck disable=SC1090
+ [ $cpufreq_source_update -eq 1 ] && . "$TMP_DIR/cpufreq.sh"
return 0
}
@@ -80,8 +82,8 @@ cpufreq_update() {
# do all the work to collect / calculate the values
# for each dimension
# remember: KEEP IT SIMPLE AND SHORT
-
- [ $cpufreq_source_update -eq 0 ] && . $TMP_DIR/cpufreq.sh $1
+ # shellcheck disable=SC1090
+ [ $cpufreq_source_update -eq 0 ] && . "$TMP_DIR/cpufreq.sh" "$1"
return 0
}
diff --git a/conf.d/charts.d/cpufreq.conf b/collectors/charts.d.plugin/cpufreq/cpufreq.conf
index 7130555af..7130555af 100644
--- a/conf.d/charts.d/cpufreq.conf
+++ b/collectors/charts.d.plugin/cpufreq/cpufreq.conf