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

56 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
#
# Plugin to monitor CPU speed on system that allow to reduce it for power saving
#
# probably only useful on laptops if you configure it to lower CPU frequency for
# less power consumptoin. This plugin works by reading from the /sys file system.
#
# by dominik dot stadler at gmx.at
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# 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
echo 'graph_title CPU speed'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel speed'
# echo 'graph_scale no'
echo 'graph_category system'
echo 'graph_info This graph shows the speed of the system fan.'
echo 'maxspeed.label maxspeed'
echo 'maxspeed.info The maximum speed of the CPU.'
echo 'minspeed.label minspeed'
echo 'minspeed.info The minimum speed of the CPU.'
echo 'cpuspeed.label speed'
echo 'cpuspeed.info The current speed of the CPU.'
exit 0
fi
echo -n "maxspeed.value "
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
echo -n "minspeed.value "
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
echo -n "cpuspeed.value "
# cpuinfo_cur_freq is not readable for user munin, therefore using scaling_cur_freq for now, should
# be equal information, see http://wiki.ubuntuusers.de/Prozessortaktung
# We could also configure this plugin to require root access, but I like it better this way.
#cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq