Révision 78276d2a
Initial version
| plugins/other/iostat | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
# |
|
| 3 |
# Monitor disk iostat on FreeBSD host. |
|
| 4 |
# |
|
| 5 |
# Parameters understood: |
|
| 6 |
# |
|
| 7 |
# config (required) |
|
| 8 |
# autoconf (optional - used by munin-config) |
|
| 9 |
# |
|
| 10 |
# Magic markers (optional - used by munin-config and installation |
|
| 11 |
# scripts): |
|
| 12 |
# |
|
| 13 |
#%# family=auto |
|
| 14 |
#%# capabilities=autoconf |
|
| 15 |
|
|
| 16 |
PATH=/bin:/usr/bin |
|
| 17 |
|
|
| 18 |
if [ "$1" = "autoconf" ]; then |
|
| 19 |
echo yes |
|
| 20 |
exit 0 |
|
| 21 |
fi |
|
| 22 |
|
|
| 23 |
DISKS=`/usr/sbin/iostat -dIn9 | head -1` |
|
| 24 |
|
|
| 25 |
if [ "$1" = "config" ]; then |
|
| 26 |
echo 'graph_title IOstat' |
|
| 27 |
echo 'graph_args --base 1024 -l 0' |
|
| 28 |
echo 'graph_vlabel Bytes per ${graph_period}'
|
|
| 29 |
echo 'graph_category disk' |
|
| 30 |
echo 'graph_info This graph shows disk load on the machine.' |
|
| 31 |
|
|
| 32 |
for D in $DISKS |
|
| 33 |
do |
|
| 34 |
if echo $D | grep -vq '^pass'; then |
|
| 35 |
echo "$D.label $D" |
|
| 36 |
echo "$D.type DERIVE" |
|
| 37 |
echo "$D.min 0" |
|
| 38 |
fi |
|
| 39 |
done |
|
| 40 |
|
|
| 41 |
exit 0 |
|
| 42 |
fi |
|
| 43 |
|
|
| 44 |
VALUES=`/usr/sbin/iostat -dIn9 | tail -1` |
|
| 45 |
COL=3 # 3rd value for each disk is grabbed |
|
| 46 |
|
|
| 47 |
for D in $DISKS |
|
| 48 |
do |
|
| 49 |
if echo $D | grep -vq '^pass'; then |
|
| 50 |
echo -n "$D.value " |
|
| 51 |
VAL=`echo $VALUES | cut -d ' ' -f $COL` |
|
| 52 |
echo "$VAL 1048576 * p" | dc | cut -d '.' -f 1 |
|
| 53 |
fi |
|
| 54 |
COL=$(($COL + 3)) |
|
| 55 |
done |
|
Formats disponibles : Unified diff