mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-08-07 22:53:15 +00:00
- have some dirs
This commit is contained in:
parent
0b089ea777
commit
08346aac58
687 changed files with 0 additions and 0 deletions
60
plugins/system/cpuspeed_sane
Executable file
60
plugins/system/cpuspeed_sane
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to graph cpu speed on FreeBSD
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# sysctl - Override path to sysctl program
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
sysctl=${sysctl:-/sbin/sysctl}
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x ${sysctl} ]; then
|
||||
${sysctl} dev.cpu.0.freq 2>/dev/null | grep 'dev' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
echo "no (dev.cpu.0.freq not found)"
|
||||
exit 1
|
||||
else
|
||||
echo "no (sysctl binary not found)"
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title CPU speed'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel speed in MHz'
|
||||
echo 'graph_category system'
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_info Current CPU speed in MHz. Available levels for the CPU:' `$sysctl -n dev.cpu.0.freq_levels|sed 's!/[0-9]*!!g;s! !, !g'` 'MHz'
|
||||
|
||||
echo cpu0.label cpu0
|
||||
echo cpu0.info `$sysctl -n hw.model` Speed
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
file=/usr/local/var/munin/plugin-state/cpuspeed
|
||||
|
||||
echo -n "cpu0.value "
|
||||
if find $file -mtime -300s 2>/dev/null|grep -Fq $file ; then
|
||||
head -1 $file
|
||||
else
|
||||
$sysctl -n dev.cpu.0.freq
|
||||
fi
|
||||
|
||||
# Get/cache cpuspeed "later".
|
||||
export sysctl file
|
||||
sh -c '(
|
||||
rand=$(dd if=/dev/urandom bs=1 count=1 2>/dev/null|od -A n -D)
|
||||
rand=$(expr $rand \* 60 / 256 + 25)
|
||||
sleep $rand
|
||||
$sysctl -n dev.cpu.0.freq > $file
|
||||
)&' >/dev/null 2>&1
|
Loading…
Add table
Add a link
Reference in a new issue