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

Add size module

This commit is contained in:
K.Cima 2017-03-29 23:13:34 +09:00
parent 544b2cfb4a
commit c7a7f086ec

View file

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