From 3dd825dd62601a15bb9d685def8c5dd9653728d8 Mon Sep 17 00:00:00 2001 From: Nye Liu Date: Wed, 26 Oct 2016 14:14:26 -0700 Subject: [PATCH] Output fields of tc can vary, possibly causing corrupted data to be gathered. Look specifically for the "bytes" keyword --- plugins/network/tc_ | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/network/tc_ b/plugins/network/tc_ index c912c89d..77000c4e 100755 --- a/plugins/network/tc_ +++ b/plugins/network/tc_ @@ -68,9 +68,15 @@ case $1 in esac # the root(s) -mytc $DEVICE | grep -v " parent " | awk "{ print \$2 \"_\" \$3 \".value \" \$14}" +mytc $DEVICE | grep -v " parent " | awk '{ + split(substr($0, match($0, /[0-9]+ [Bb]ytes/)), a, " "); + print $2 "_" $3 ".value " a[1]; +}' # the child(s) -mytc $DEVICE | grep " parent " | awk "{ print \$2 \"_\" \$3 \".value \" \$19}" +mytc $DEVICE | grep " parent " | awk '{ + split(substr($0, match($0, /[0-9]+ [Bb]ytes/)), a, " "); + print $2 "_" $3 ".value " a[1]; +}' exit 0