2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/iostat

56 lines
1.1 KiB
Plaintext
Raw Normal View History

2009-07-07 13:14:03 +02:00
#!/bin/sh
#
# Monitor disk iostat on FreeBSD host.
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
PATH=/bin:/usr/bin
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
DISKS=`/usr/sbin/iostat -dIn9 | head -1`
if [ "$1" = "config" ]; then
echo 'graph_title IOstat'
echo 'graph_args --base 1024 -l 0'
echo 'graph_vlabel Bytes per ${graph_period}'
echo 'graph_category disk'
echo 'graph_info This graph shows disk load on the machine.'
for D in $DISKS
do
if echo $D | grep -vq '^pass'; then
echo "$D.label $D"
echo "$D.type DERIVE"
echo "$D.min 0"
fi
done
exit 0
fi
VALUES=`/usr/sbin/iostat -dIn9 | tail -1`
COL=3 # 3rd value for each disk is grabbed
for D in $DISKS
do
if echo $D | grep -vq '^pass'; then
echo -n "$D.value "
VAL=`echo $VALUES | cut -d ' ' -f $COL`
echo "$VAL 1048576 * p" | dc | cut -d '.' -f 1
fi
COL=$(($COL + 3))
done