diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-09-29 11:18:04 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-09-29 11:18:04 +0200 |
commit | 7386e0856f22802b5971f52ee041e75449a41dfa (patch) | |
tree | b65cffa816e1cc8942a2deae762b1066bc5d5f1d | |
parent | 0f2de06848fce451d730ca81a786481955294511 (diff) | |
download | vyatta-op-qos-7386e0856f22802b5971f52ee041e75449a41dfa.tar.gz vyatta-op-qos-7386e0856f22802b5971f52ee041e75449a41dfa.zip |
Other part of qdisc parsing fix
Handle multi-line message output of 'tc qdisc ls'
-rwxr-xr-x | scripts/vyatta-show-queueing.pl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/scripts/vyatta-show-queueing.pl b/scripts/vyatta-show-queueing.pl index 4065414..837f863 100755 --- a/scripts/vyatta-show-queueing.pl +++ b/scripts/vyatta-show-queueing.pl @@ -76,23 +76,27 @@ sub show_brief { # Read qdisc info open( my $tc, '/sbin/tc -s qdisc ls |' ) or die 'tc command failed'; + + my ( $qdisc, $parent, $interface ); while (<$tc>) { + chomp; + my @fields = split; + if ( $fields[0] eq 'qdisc' ) { + # qdisc sfq 8003: dev eth1 root limit 127p quantum 1514b + ( undef, $qdisc, undef, undef, $interface, $parent ) = @fields; + next; + } - # qdisc sfq 8003: dev eth1 root limit 127p quantum 1514b - my ( undef, $qdisc, undef, undef, $interface, $parent ) = split; + # skip unwanted extra stats + next if ( $fields[0] ne 'Sent' ); # Sent 13860 bytes 88 pkt (dropped 0, overlimits 0 requeues 0) - $_ = <$tc>; - chomp; my ( undef, $sent, undef, undef, undef, undef, $drop, undef, $over ) = - split; + @fields; # punctuation was never jamal's strong suit $drop =~ s/,$//; - # rate 0bit 0pps backlog 0b 0p requeues 0 - <$tc>; - if ( $parent eq 'root' && $interface =~ $match ) { my $shaper = $qdisc_types{$qdisc}; defined $shaper or $shaper = '[' . $qdisc . ']'; |