2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/cpuspeed2
2011-12-18 15:10:09 +01:00

46 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
#
# Munin-plugin to monitor the cpu speeds of all available cpus
#
# Armin Haaf, 4-11-2007
# Licensed under: GNU GPL
MAX_CORES=1024
if [ "$1" = "config" ]; then
echo "graph_title CPU speed"
echo 'graph_category system'
echo "graph_info This graph shows the cpu-speed for each core, as reported by the kernel"
i=0
while [ $i -lt $MAX_CORES ]
do
MODEL=`cat /proc/cpuinfo | grep -A 6 "processor.*:.*$i" | grep "model name"`
if [ $? -ne 0 ]
then
break
fi
MODEL=`echo $MODEL | cut -c 12-`
echo "core$i.label Core $i speed in MHz"
echo "core$i.info Core $i speed in MHz $MODEL"
echo "core$i.type GAUGE"
i=$[$i+1]
done
exit 0
fi
i=0
while true
do
cat /proc/cpuinfo | grep -A 6 "processor.*:.*$i" > /dev/null
if [ $? -ne 0 ]
then
break
fi
echo -n "core$i.value "
cat /proc/cpuinfo | grep -A 6 "processor.*:.*$i" | grep "cpu MHz" | cut -c 12- | cut -f 1 -d .
i=$[$i+1]
done