From 3233ad49342de96e02df66dbe839dac2892c9953 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sat, 12 Oct 2013 20:50:02 +0200 Subject: [PATCH 1/6] p: adding a cpu freq 1 sec for RPi --- plugins/rpi/cpu_freq_1sec | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 plugins/rpi/cpu_freq_1sec diff --git a/plugins/rpi/cpu_freq_1sec b/plugins/rpi/cpu_freq_1sec new file mode 100755 index 00000000..90698dbf --- /dev/null +++ b/plugins/rpi/cpu_freq_1sec @@ -0,0 +1,53 @@ +#! /bin/sh +# (c) 2013 - LGPL - Steve Schnepp + +pluginfull="$0" # full name of plugin +plugin="${0##*/}" # name of plugin +pidfile="$MUNIN_PLUGSTATE/munin.$plugin.pid" +cache="$MUNIN_PLUGSTATE/munin.$plugin.value" + + +if [ ! -r "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" ] +then + echo "# Cannot read CPU Freq" + exit 1 +fi + +if [ "$1" = "acquire" ] +then + ( + while sleep 1 + do + echo $( + date +%s + cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq + ) + done | awk "{ + print \"scaling_cur_freq.value \" \$1 \":\" \$2; + system(\"\"); + }" >> $cache + ) & + echo $! > $pidfile + exit 0 +fi + + +if [ "$1" = "config" ] +then + cat < ${cache} + +exit 0 From 6af19f5558347cc221574b28e68f1279d00fa954 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sat, 12 Oct 2013 20:57:26 +0200 Subject: [PATCH 2/6] p: adding a temp plugin for RPi --- plugins/rpi/rpi_temp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 plugins/rpi/rpi_temp diff --git a/plugins/rpi/rpi_temp b/plugins/rpi/rpi_temp new file mode 100755 index 00000000..9f38b802 --- /dev/null +++ b/plugins/rpi/rpi_temp @@ -0,0 +1,33 @@ +#! /bin/sh +# (c) 2013 - LGPL - Steve Schnepp + +pluginfull="$0" # full name of plugin +plugin="${0##*/}" # name of plugin +pidfile="$MUNIN_PLUGSTATE/munin.$plugin.pid" +cache="$MUNIN_PLUGSTATE/munin.$plugin.value" + + +if [ ! -r "/sys/class/thermal/thermal_zone0/temp" ] +then + echo "# Cannot read CPU Temp" + exit 1 +fi + + +if [ "$1" = "config" ] +then + cat < Date: Sat, 12 Oct 2013 20:59:22 +0200 Subject: [PATCH 3/6] p/rpi_temp: adding a milli precision --- plugins/rpi/rpi_temp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rpi/rpi_temp b/plugins/rpi/rpi_temp index 9f38b802..8eff2283 100755 --- a/plugins/rpi/rpi_temp +++ b/plugins/rpi/rpi_temp @@ -28,6 +28,6 @@ fi # values TEMP_MILLI_C=$(cat /sys/class/thermal/thermal_zone0/temp) -echo thermal_zone0.value $( echo "$TEMP_MILLI_C / 1000" | bc ) +echo thermal_zone0.value $( echo "scale=3; $TEMP_MILLI_C / 1000" | bc ) exit 0 From 48d3de6056f4419147732df6ad179990a8732230 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Fri, 6 Dec 2013 21:09:24 +0100 Subject: [PATCH 4/6] p/cpu_freq_1sec: fix the unit & the DS type --- plugins/rpi/cpu_freq_1sec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/rpi/cpu_freq_1sec b/plugins/rpi/cpu_freq_1sec index 90698dbf..91286818 100755 --- a/plugins/rpi/cpu_freq_1sec +++ b/plugins/rpi/cpu_freq_1sec @@ -23,7 +23,7 @@ then cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ) done | awk "{ - print \"scaling_cur_freq.value \" \$1 \":\" \$2; + print \"scaling_cur_freq.value \" \$1 \":\" (\$2 * 1000); system(\"\"); }" >> $cache ) & @@ -41,7 +41,7 @@ graph_data_size custom 1d, 10s for 1w, 1m for 1t, 5m for 1y graph_vlabel Hz update_rate 1 scaling_cur_freq.label Current CPU Scaling Frequence -scaling_cur_freq.type DERIVE +scaling_cur_freq.type GAUGE EOF exit 0 fi From 3669b92a609f158347cbf3e5313c364bbd1b111d Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Fri, 6 Dec 2013 21:10:00 +0100 Subject: [PATCH 5/6] p/cpu_freq_1sec: fix the indentation --- plugins/rpi/cpu_freq_1sec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/rpi/cpu_freq_1sec b/plugins/rpi/cpu_freq_1sec index 91286818..384985c1 100755 --- a/plugins/rpi/cpu_freq_1sec +++ b/plugins/rpi/cpu_freq_1sec @@ -24,8 +24,8 @@ then ) done | awk "{ print \"scaling_cur_freq.value \" \$1 \":\" (\$2 * 1000); - system(\"\"); - }" >> $cache + system(\"\"); + }" >> $cache ) & echo $! > $pidfile exit 0 From ca5aafbec7c50f44a95799a5098895a747123648 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sat, 7 Dec 2013 15:24:09 +0100 Subject: [PATCH 6/6] p/cpu_freq_1sec: adding a description --- plugins/rpi/cpu_freq_1sec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/rpi/cpu_freq_1sec b/plugins/rpi/cpu_freq_1sec index 384985c1..44e01214 100755 --- a/plugins/rpi/cpu_freq_1sec +++ b/plugins/rpi/cpu_freq_1sec @@ -1,4 +1,8 @@ #! /bin/sh +# +# This is a small supersampling plugin that does +# cpu sampling every 1 second. +# # (c) 2013 - LGPL - Steve Schnepp pluginfull="$0" # full name of plugin