1#!@@GOODSH@@ 2# -*- sh -*- 3# 4# Plugin for watching io-bound traffic (in bytes) on disks. 5# 6# Parameters: 7# 8# config (required) 9# autoconf (optional - used by munin-config) 10# 11# $Log: iostat.in,v $ 12# Revision 1.1.1.1 2006/06/04 20:53:57 he 13# Import the client version of the Munin system monitoring/graphing 14# tool -- project homepage is at http://munin.sourceforge.net/ 15# 16# This package has added support for NetBSD, via a number of new plugin 17# scripts where specific steps needs to be taken to collect information. 18# 19# I also modified the ntp_ plugin script to make it possible to not 20# plot the NTP poll delay, leaving just jitter and offset, which IMO 21# produces a more telling graph. 22# 23# 24# Magick markers (optional - used by munin-config and som installation 25# scripts): 26#%# family=auto 27#%# capabilities=autoconf 28 29if [ "$1" = "autoconf" ]; then 30 if [ -x /usr/sbin/iostat ]; then 31 echo yes 32 exit 0 33 else 34 echo "no (no /usr/sbin/iostat executable)" 35 exit 0 36 fi 37fi 38 39nf=`/usr/sbin/iostat -I -x | tail -1 | awk '{ print NF }'` 40if [ $nf -eq 5 ]; then 41 oldformat=true 42else 43 oldformat=false 44fi 45 46if [ "$1" = "config" ]; then 47 48 echo 'graph_title IOstat by bytes' 49 echo 'graph_args --base 1024 -l 0' 50 51 if ! $oldformat; then 52 echo 'graph_vlabel MB per ${graph_period} read (-) / written (+)' 53 else 54 echo 'graph_vlabel MB per ${graph_period} read+written' 55 fi 56 57 echo 'graph_category disk' 58 echo 'graph_info This graph shows the I/O to and from block devices' 59 60 drives=`/usr/sbin/iostat -I -x | awk ' 61/^device/ { next; } 62// { print $1; }'` 63 64 echo -n 'graph_order' 65 for d in $drives; do 66 if $oldformat; then 67 echo -n ' '${d}'_io' 68 else 69 echo -n ' '${d}'_read '${d}'_write' 70 fi 71 done 72 echo 73 74 if $oldformat; then 75 for d in $drives; do 76 echo "${d}_io.label ${d}" 77 echo "${d}_io.info I/O on device ${d}" 78 echo "${d}_io.type DERIVE" 79 echo "${d}_io.max 2000" 80 echo "${d}_io.min 0" 81 done 82 else 83 for d in $drives; do 84 echo "${d}_read.label ${d}" 85 echo "${d}_read.type DERIVE" 86 echo "${d}_read.max 2000" 87 echo "${d}_read.min 0" 88 echo "${d}_read.graph no" 89 90 echo "${d}_write.label ${d}" 91 echo "${d}_write.info I/O on device ${d}" 92 echo "${d}_write.type DERIVE" 93 echo "${d}_write.max 2000" 94 echo "${d}_write.min 0" 95 echo "${d}_write.negative ${d}_read" 96 done 97 fi 98 exit 0 99fi 100 101if $oldformat; then 102 /usr/sbin/iostat -I -x | awk ' 103/^device/ { next; } 104{ 105 print $1 "_io.value " int($5); 106} 107' 108else 109 /usr/sbin/iostat -I -x | awk ' 110/^device/ { next; } 111{ 112 print $1 "_read.value " int($5); 113 print $1 "_write.value " int($9); 114} 115' 116fi 117