1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 22:25:23 +00:00

Using gawk strtonum in place of int so that the script no longer truncates the value, which makes a huge difference if the value is in M or even K.

This commit is contained in:
spleen 2011-03-25 19:34:35 +01:00 committed by Steve Schnepp
parent 36b0898dba
commit fd83f3aa1f

View file

@ -40,9 +40,9 @@ echo $zlist | tr ' ' '\n' | while read iz; do
*) name=`echo $iz | gawk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
esac
echo -n $name'_read.value '
grep '^[ ]*'$zlabel $ztmp|gawk '{print $6}'|gawk '/M/ {print int($1)*1000}; /K/ {print int($1)}; /[0-9]$/ {print int($1)/1000}; /^0/ {print int($1)}'
grep '^[ ]*'$zlabel $ztmp|gawk '{print $6}'|gawk '/M/ {print strtonum($1)*1000}; /K/ {print strtonum($1)}; /[0-9]$/ {print int($1)/1000}; /^0/ {print strtonum($1)}'
echo -n $name'_write.value '
grep '^[ ]*'$zlabel $ztmp|gawk '{print $7}'|gawk '/M/ {print int($1)*1000}; /K/ {print int($1)}; /[0-9]$/ {print int($1)/1000}; /^0/ {print int($1)}'
grep '^[ ]*'$zlabel $ztmp|gawk '{print $7}'|gawk '/M/ {print strtonum($1)*1000}; /K/ {print strtonum($1)}; /[0-9]$/ {print int($1)/1000}; /^0/ {print strtonum($1)}'
done
rm $ztmp; touch $ztmp