root / plugins / disk / iostat-xfrs @ 16d38264
Historique | Voir | Annoter | Télécharger (1,01 ko)
| 1 | b11c9944 | Tarmo Ainsaar | #!/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 xfrs' |
||
| 27 | echo 'graph_args -l 0' |
||
| 28 | echo 'graph_vlabel Transfers 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=2 # 2nd 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 | echo $VALUES | cut -d ' ' -f $COL |
||
| 52 | fi |
||
| 53 | COL=$(($COL + 3)) |
||
| 54 | done |
