Skip to content

Instantly share code, notes, and snippets.

@tom-a
Created June 17, 2014 13:57
Show Gist options
  • Save tom-a/233b6de49f9d59235b95 to your computer and use it in GitHub Desktop.
Save tom-a/233b6de49f9d59235b95 to your computer and use it in GitHub Desktop.
FreeBSDでCPUクロックをモニタするmuninのplugin
#!/bin/sh
#%# family=auto
#%# capabilities=autoconf
GETNUM=`sysctl dev.cpu.0.freq | sed s/dev.cpu.0.freq..//`
GETNUM=`expr $GETNUM \* 1000000`
if [ "$1" = "autoconf" ]; then
if [ -n ${GETNUM} ] ; then
echo yes
exit 0
else
echo no
exit 0
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title CPU Frequensy'
echo 'graph_args --lower-limit 0 --base 1000'
echo 'graph_vlabel Clock'
echo 'graph_category system'
echo 'CPU0.label CPU0'
echo 'CPU0.min 0'
echo 'CPU0.type GAUGE'
exit 0
fi
echo "CPU0.value $GETNUM";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment