mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Merge pull request #408 from steveschnepp/rpi
Some plugins specific to RPi
This commit is contained in:
commit
f57d763b3f
2 changed files with 90 additions and 0 deletions
57
plugins/rpi/cpu_freq_1sec
Executable file
57
plugins/rpi/cpu_freq_1sec
Executable file
|
@ -0,0 +1,57 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# This is a small supersampling plugin that does
|
||||
# cpu sampling every 1 second.
|
||||
#
|
||||
# (c) 2013 - LGPL - Steve Schnepp <steve.schnepp@pwkf.org>
|
||||
|
||||
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 * 1000);
|
||||
system(\"\");
|
||||
}" >> $cache
|
||||
) &
|
||||
echo $! > $pidfile
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "config" ]
|
||||
then
|
||||
cat <<EOF
|
||||
graph_title CPU Freq 1sec stats
|
||||
graph_category 1sec::cpu
|
||||
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 GAUGE
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# values
|
||||
cat ${cache}
|
||||
> ${cache}
|
||||
|
||||
exit 0
|
33
plugins/rpi/rpi_temp
Executable file
33
plugins/rpi/rpi_temp
Executable file
|
@ -0,0 +1,33 @@
|
|||
#! /bin/sh
|
||||
# (c) 2013 - LGPL - Steve Schnepp <steve.schnepp@pwkf.org>
|
||||
|
||||
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 <<EOF
|
||||
graph_title CPU Temp
|
||||
graph_category system
|
||||
graph_vlabel C
|
||||
thermal_zone0.label Current CPU Temp
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# values
|
||||
TEMP_MILLI_C=$(cat /sys/class/thermal/thermal_zone0/temp)
|
||||
|
||||
echo thermal_zone0.value $( echo "scale=3; $TEMP_MILLI_C / 1000" | bc )
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue