summaryrefslogtreecommitdiffstats
path: root/cpuspeed.in.rev1243
blob: c5b4b3b8ac39c7f1d6cfc6cc42b074236ff1b337 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!@@GOODSH@@
#
# Plugin to monitor CPU speed
#
# Usage: Place in /etc/munin/node.d/ (or link it there  using ln -s)
#
# Parameters understood:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=auto
#%# capabilities=autoconf

if [ "$1" = "autoconf" ]; then
	if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ]; then
		echo yes
		exit 0
	else
		echo no
		exit 1
	fi
fi


if [ "$1" = "config" ]; then
    cat <<EOF
graph_title CPU frequency scaling
graph_args --base 1000 -r --lower-limit 0
graph_vlabel Hz
graph_scale yes
graph_info This graph shows at what speeds the CPUs are running
graph_category system
EOF

for c in /sys/devices/system/cpu/cpu*; do
    N=${c##*/cpu}
    MAXHZ=$(cat $c/cpufreq/cpuinfo_max_freq)
    cat <<EOF
cpu$N.label CPU $N
cpu$N.max $MAXHZ
cpu$N.min $(cat $c/cpufreq/cpuinfo_min_freq)
cpu$N.type GAUGE
EOF
    if [ "$scaleto100" = "yes" ]; then
	echo "cpu$N.cdef $cpu$N,$MAXHZ,/"
    fi
done

	exit 0
fi

for c in /sys/devices/system/cpu/cpu*; do
    N=${c##*/cpu}
    echo "cpu$N.value $(cat $c/cpufreq/scaling_cur_freq)"
done