Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #%# family=auto
- #%# capabilities=autoconf suggest
- if [ "$1" = "autoconf" ]; then
- echo yes
- exit 0
- fi
- if [ "$1" = "suggest" ]; then
- awk ' / [hs]d[a-z][0-9]* / { print $3 }' /proc/diskstats
- exit 0
- fi
- device=`basename $0 | sed 's/^diskutil_//g'`
- ncpu=$(egrep '^cpu[0-9]+ ' /proc/stat | wc -l)
- if [ "$1" = "config" ]; then
- echo 'graph_category disk'
- echo "graph_title Disk Utilization ${device}"
- echo 'graph_args --base 1000 -l 0'
- echo 'graph_vlabel %'
- echo 'util.label utilization'
- echo 'util.info utilization %'
- echo 'util.type GAUGE'
- echo 'util.draw LINE2'
- exit 0
- fi
- statefiledir=/var/lib/munin/plugin-state/
- statefile="${statefiledir}diskutil-${device}.state"
- newticks=`awk '/^cpu / { print $2+$3+$4+$5+$6+$7+$8+$9+$10 }' /proc/stat`
- newioticks=`cat /proc/diskstats | grep " $device " | awk '{ print $13 }'`
- if [ -s $statefile ] ; then
- oldticks=`awk '{print $1}' $statefile`
- oldioticks=`awk '{print $2}' $statefile`
- else
- oldticks=$newticks
- oldioticks=$newioticks
- fi
- echo "${newticks} ${newioticks}" > $statefile
- deltaticks=$(($newticks-$oldticks))
- deltaioticks=$(($newioticks-$oldioticks))
- echo "${deltaioticks} ${deltaticks} ${ncpu}" | awk '{ printf "util.value %f\n", $1/$2*$3*10 }'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement