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

Make awk script more readable

This commit is contained in:
Nye Liu 2016-10-26 14:12:00 -07:00
parent afe87e904e
commit 234a753fea

View File

@ -48,8 +48,21 @@ case $1 in
echo 'graph_vlabel bits per ${graph_period}'
echo 'graph_category network'
echo "graph_info This graph shows the TC classes traffic of the $DEVICE network interface. Please note that the traffic is shown in bits per second, not bytes."
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 ".label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 ".type DERIVE\n" $2 "_" $3 "_" $4 ".min 0\n" $2 "_" $3 "_" $4 ".cdef " $2 "_" $3 "_" $4 ",8,*" }'
# the root(s)
mytc $DEVICE | grep -v " parent " | tr "_" " " | awk '{
print $2 "_" $3 "_" $4 ".label " $2 "/" $3 ":" $4;
print $2 "_" $3 "_" $4 ".type DERIVE";
print $2 "_" $3 "_" $4 ".min 0";
print $2 "_" $3 "_" $4 ".cdef " $2 "_" $3 "_" $4 ",8,*";
}'
# the child(s)
mytc $DEVICE | grep " parent " | tr "_" " " | awk '{
print $2 "_" $3 "_" $4 ".label " $2 "/" $3 ":" $4;
print $2 "_" $3 "_" $4 ".type DERIVE";
print $2 "_" $3 "_" $4 ".min 0";
print $2 "_" $3 "_" $4 ".cdef " $2 "_" $3 "_" $4 ",8,*";
}'
exit 0
;;
esac