#! /bin/sh : <<=cut =head1 NAME cpu_freq_1sec - small supersampling plugin that samples cpu usage every second =head1 AUTHORS Copyright (C) 2013 Steve Schnepp =head1 LICENSE GNU Library General Public License v2 only SPDX-License-Identifier: LGPL-2.0-only =cut 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 < ${cache} exit 0