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

Fix method to create device maps

because sometimes iostat may hang in process substitution and for readability
This commit is contained in:
K.Cima 2017-03-29 12:09:21 +09:00
parent 13cb4192d9
commit 544b2cfb4a

View File

@ -105,10 +105,11 @@ functions='ops bytes busy queue latency'
# name_sd1=c0t0d0
# name_ssd2=c0tAB_1234d0 (shorten long target)
# ...
declare $( paste -d= \
<( iostat -x | awk '{print $1}' | sed -e '1,2d' -e 's/^/name_/' ) \
<( iostat -xn | awk '{print $NF}' | sed -e '1,2d' -e 's/^\(c[0-9]*\)\(t.\{2\}\).*\(.\{4\}\)\(d[0-9]*\)$/\1\2_\3\4/' ) \
)
instance_names=$( iostat -x | sed -e '1,2d' | awk '{print $1}' | \
sed -e 's/^/name_/' )
logical_device_names=$( iostat -xn | sed -e '1,2d' | awk '{print $NF}' | \
sed -e 's/^\(c[0-9]*\)\(t.\{2\}\).*\(.\{4\}\)\(d[0-9]*\)$/\1\2_\3\4/' )
declare $( paste -d= <( echo "$instance_names" ) <( echo "$logical_device_names" ) )
# Functions