cc957de
#!@@GOODSH@@
cc957de
#
cc957de
# Plugin to monitor CPU speed
cc957de
#
cc957de
# Usage: Place in /etc/munin/node.d/ (or link it there  using ln -s)
cc957de
#
cc957de
# Parameters understood:
cc957de
#
cc957de
# 	config   (required)
cc957de
# 	autoconf (optional - used by munin-config)
cc957de
#
cc957de
# Magic markers - optional - used by installation scripts and
cc957de
# munin-config:
cc957de
#
cc957de
#%# family=auto
cc957de
#%# capabilities=autoconf
cc957de
cc957de
if [ "$1" = "autoconf" ]; then
cc957de
	if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ]; then
cc957de
		echo yes
cc957de
		exit 0
cc957de
	else
cc957de
		echo no
cc957de
		exit 1
cc957de
	fi
cc957de
fi
cc957de
cc957de
cc957de
if [ "$1" = "config" ]; then
cc957de
    cat <
cc957de
graph_title CPU frequency scaling
cc957de
graph_args --base 1000 -r --lower-limit 0
cc957de
graph_vlabel Hz
cc957de
graph_scale yes
cc957de
graph_info This graph shows at what speeds the CPUs are running
cc957de
graph_category system
cc957de
EOF
cc957de
cc957de
for c in /sys/devices/system/cpu/cpu*; do
cc957de
    N=${c##*/cpu}
cc957de
    MAXHZ=$(cat $c/cpufreq/cpuinfo_max_freq)
cc957de
    cat <
cc957de
cpu$N.label CPU $N
cc957de
cpu$N.max $MAXHZ
cc957de
cpu$N.min $(cat $c/cpufreq/cpuinfo_min_freq)
cc957de
cpu$N.type GAUGE
cc957de
EOF
cc957de
    if [ "$scaleto100" = "yes" ]; then
cc957de
	echo "cpu$N.cdef $cpu$N,$MAXHZ,/"
cc957de
    fi
cc957de
done
cc957de
cc957de
	exit 0
cc957de
fi
cc957de
cc957de
for c in /sys/devices/system/cpu/cpu*; do
cc957de
    N=${c##*/cpu}
cc957de
    echo "cpu$N.value $(cat $c/cpufreq/scaling_cur_freq)"
cc957de
done