wiki:PluginPortrait/iperf
  • runs iperf as client towards hosts you specify.
  • iperf -s needs to be listening on the target hosts.
  • remember to chmod a+x /usr/share/munin/plugins/iperf

/usr/share/munin/plugins/iperf

#!/bin/sh
#

if [ -f /etc/munin/iperf.conf ]; then
 . /etc/munin/iperf.conf
else
 echo missing configuration file - /etc/munin/iperf.conf
 exit
fi


if [ "$1" = "config" ]; then
   #print labels
   for host in $HOST ; do
     printf $host | sed 's/\./_/g'
     echo .label $host
   done
   #echo 'iperf.label iperf';          # Field label (legend)

   # These are not really nedded, but makes the graph prettier.
   echo 'graph_title Bandwith' # Set main title
   #echo 'graph_args --base 1000000 -l 0'
   echo 'graph_args -l 0'          # Y-axis starts at 0
   echo 'graph_scale yes'           # Say 0.04 load, not 40 milliload
   echo 'graph_vlabel Kbits/sec'        # Y-axis label
   #echo 'iperf.max 10000000'
   #echo 'iperf.min 0'

   exit 0
fi

#datagathering
for  host in $HOST ; do
printf $host | sed 's/\./_/g'
printf '.value '
iperf  -f b -c $host -t $TIME | grep "bits/sec" | cut -d" " -f12
done

/etc/munin/iperf.conf

#config file for ipserf plugin
#check for how many seconds
#longer is more acurate, but have more impact
TIME=1

# list of hosts to check
#ofcouse the example of checking localhost is utterly useless, edit as needed
#EXAMPLE: HOST="localhost localhost.localdomain 127.0.0.1"
HOST="localhost"
Last modified at 2006-03-24T19:41:56+01:00 Last modified on 2006-03-24T19:41:56+01:00