diff --git a/plugins/solaris/io_disk b/plugins/solaris/io_disk index 8ea87e0d..509cf1ca 100755 --- a/plugins/solaris/io_disk +++ b/plugins/solaris/io_disk @@ -12,6 +12,7 @@ busy : similar to iostat %b, %w (%w usually indicates 0 in Sol10,11) queue : similar to iostat actv, wait latency : similar to iostat asvc_t, wsvc_t + size : average io size This plugin is improved from Solaris io_busy_, io_ops_, io_bytes_ plugins. Any device found in /usr/bin/kstat can be monitored. @@ -52,7 +53,7 @@ It may be good to link like ln -s /path/to/io_disk io_nfs if necessary. env.module_regex - kstat module. See man kstat -m option. - example: env.module_regex /^(s?sd|vdc|zvblk|dad|md|nfs|tape)$/ + example: env.module_regex /^(s?sd|vdc|zvblk|dad|md|nfs|st)$/ default: /^(s?sd|vdc|zvblk|dad|md)$/ env.title_type - Device type shown in graph title. @@ -92,7 +93,7 @@ set -o nounset # Like perl use strict; # Set environment variables plugin_name=io -functions='ops bytes busy queue latency' +functions='ops bytes busy queue latency size' : "${class:=disk}" : "${module:=sd}" : "${module_regex:=/^(s?sd|vdc|zvblk|dad|md)\$/}" @@ -120,43 +121,57 @@ preconfig() { case "$func" in ops) conf_title='I/O Operations' - conf_in=reads - conf_out=writes - conf_cdef= conf_gargs='--base 1000' conf_vlabel='Ops per second write (-) / read (+)' + conf_in=reads + conf_out=writes + conf_in_cdef= + conf_out_cdef= ;; bytes) conf_title='I/O Throughput' - conf_in=nread - conf_out=nwritten - conf_cdef= conf_gargs='--base 1024' conf_vlabel='Bytes per second write (-) / read (+)' + conf_in=nread + conf_out=nwritten + conf_in_cdef= + conf_out_cdef= ;; busy) conf_title='Busy & Wait' - conf_in=rtime - conf_out=wtime - conf_cdef=',100,*' conf_gargs='--base 1000 --lower-limit 0 --upper-limit 100' conf_vlabel='% wait (-) / busy (+)' + conf_in=rtime + conf_out=wtime + conf_in_cdef=',100,*' + conf_out_cdef=',100,*' ;; queue) conf_title='Queue Length' - conf_in=rlentime - conf_out=wlentime - conf_cdef= conf_gargs='--base 1000' conf_vlabel='Queue length wait (-) / actv (+)' + conf_in=rlentime + conf_out=wlentime + conf_in_cdef= + conf_out_cdef= ;; latency) conf_title='Latency' - conf_in=rlentime - conf_out=wlentime - conf_cdef= conf_gargs='--base 1000' conf_vlabel='Seconds wsvc_t (-) / asvc_t (+)' + conf_in=rlentime + conf_out=wlentime + conf_in_cdef= + conf_out_cdef= + ;; + size) + conf_title='I/O Size' + conf_gargs='--base 1024' + conf_vlabel='Average size write (-) / read (+)' + conf_in=nread + conf_out=nwritten + conf_in_cdef= + conf_out_cdef= ;; *) echo "Unknown function: $func" @@ -205,8 +220,9 @@ do_config() { ref="name_$dev" devname=${!ref:-} # ${!varname} means indirect evaluation (similar to eval) - # reads and writes are necessary to calculate latency - if [ "$func" = 'latency' ]; then + # reads and writes are necessary to calculate latency, size + case "$func" in + latency|size) for stat in reads writes do echo "${dev}_$stat.label dummy" @@ -214,23 +230,37 @@ do_config() { echo "${dev}_$stat.type DERIVE" echo "${dev}_$stat.min 0" done - # rlentime / ( reads + writes ) - conf_cdef=,${dev}_reads,${dev}_writes,+,/ - fi + ;; + esac + # Set cdef for latency, size + case "$func" in + latency) + # rlentime / ( reads + writes ) + conf_in_cdef=,${dev}_reads,${dev}_writes,+,/ + conf_out_cdef=,${dev}_reads,${dev}_writes,+,/ + ;; + size) + conf_in_cdef=,${dev}_reads,/ + conf_out_cdef=,${dev}_writes,/ + ;; + esac + + # Print data attributes echo "${dev}_${conf_out}.label dummy" echo "${dev}_${conf_out}.graph no" echo "${dev}_${conf_out}.type DERIVE" echo "${dev}_${conf_out}.min 0" + if [ -n "${conf_out_cdef:-}" ]; then + echo "${dev}_${conf_out}.cdef ${dev}_${conf_out}${conf_out_cdef}" + fi echo "${dev}_${conf_in}.label ${devname:-${dev}}" echo "${dev}_${conf_in}.negative ${dev}_${conf_out}" echo "${dev}_${conf_in}.type DERIVE" echo "${dev}_${conf_in}.min 0" - - if [ -n "$conf_cdef" ]; then - echo "${dev}_${conf_out}.cdef ${dev}_${conf_out}${conf_cdef}" - echo "${dev}_${conf_in}.cdef ${dev}_${conf_in}${conf_cdef}" + if [ -n "${conf_in_cdef:-}" ]; then + echo "${dev}_${conf_in}.cdef ${dev}_${conf_in}${conf_in_cdef}" fi done @@ -243,11 +273,14 @@ do_getvalue() { func=$1 preconfig "$func" - if [ "$func" = 'latency' ]; then + case "$func" in + latency|size) stat_regex="/^($conf_in|$conf_out|reads|writes)\$/" - else + ;; + *) stat_regex="/^($conf_in|$conf_out)\$/" - fi + ;; + esac echo "multigraph ${plugin_name}_${func}_${module}"