Hi,
I use some advanced rules to prioritize ou VOIP traffic as described on the doc, but they don't seems to work.
Can anybody tell me how to determine if my rules are effective ? I tried various solution found here and there to monitor tc classes but all of them report nothing - this may be because the rules are simply not applied, I still have to check this.
How do you debug this ? How do you monitor those rules ?
Thanks
Matthieu
I use some advanced rules to prioritize ou VOIP traffic as described on the doc, but they don't seems to work.
Can anybody tell me how to determine if my rules are effective ? I tried various solution found here and there to monitor tc classes but all of them report nothing - this may be because the rules are simply not applied, I still have to check this.
How do you debug this ? How do you monitor those rules ?
Thanks
Matthieu
Share this post:
Responses (5)
-
Accepted Answer
I created a webconfig front end for this in 5.2 but you can use the tc command and tccs script to parse rule bandwidth data
http://tccs.sourceforge.net/
It takes the output from 'tc -s class show dev eth0' or 'tc -s class show dev imq0' and gives you rates of traffic flow. Useful to identify if your bandwidth is falling into the right classes
[root@leonardo ~]# tc -s class show dev eth0 | tccs
2:1 (htb) 3000Kbit 1.3 kb/s ( 7 KB)
2:10 (htb) 1200Kbit-2700Kbit 0.4 kb/s ( 2 KB)
2:20 (htb) 360000bit-3000Kbit 0.0 kb/s ( 0 KB)
2:30 (htb) 360000bit-3000Kbit 0.7 kb/s ( 4 KB)
2:50 (htb) 360000bit-3000Kbit 0.0 kb/s ( 0 KB)
2:60 (htb) 360000bit-3000Kbit 0.1 kb/s ( 1 KB) -
Accepted Answer
Thanks Tim ! It looks exactly what I'm looking for. I already noticed a thread about your tool on the forum but it looks like the repo didn't work so i gave up since the thread was very old.
Now I'm happy to see that you're still in business but the link you provide doesn't work either. The cvs server seems missing files.
Can you help further ? Thanks
Matthieu -
Accepted Answer
Oh that's a shame... I'll repost the GPL code here. (Copy into a new file at /usr/local/sbin/tccs and make executable with command 'chmod +x tccs')
#!/usr/bin/perl -w
# copyright 2005-2008 Tomasz Pala <gotar@pld-linux.org>
# license: GPL
# usage:
# watch -d -n1 'tc -s c ls dev imq1 | tccs -f 10 2>/dev/null'
# tccs.rc file format:
# %translate = ( '1:2' => 'LAN', '1:4076' => 'pc76', '1:b238' => 'VoIP-3_29 );
#use strict;
use Getopt::Long;
#tc -s class show dev eth1 | perl -e 'undef $/; while(<> { while (/class htb (.*?) .*?\n\s*Sent (\d+) .*?\n\s*rate (\d+)/sg) { print "Klasa: $1 Wyslano: $2 ($3bps)\n" }; };'
my $class;
my $classid;
my $parent;
my $rate;
my $ceil;
my $crate;
my $sent;
my $range;
my %tree;
my $recurse=10;
my $speedlevel=0;
my %translate;
eval `cat tccs.rc 2>/dev/null`;
GetOptions('recurse=s'=>\$recurse,
'fastest=s'=>\$speedlevel);
while(<STDIN> {
if(/^ lended: / and $crate) {
if($rate ne $ceil) {
$range="$rate-$ceil";
} else {
$range=$rate;
}
# print "$parent: $class $classid $range $crate kb/s\n";
@{$tree{$parent}}[0]='' unless @{$tree{$parent}}[0];
push @{$tree{$parent}}, $classid;
$crate=sprintf "%8.1lf",$crate;
$sent=sprintf "%10.0lf",$sent/1024;
@{$tree{$classid}}[0]="($class) $range $crate kb/s ($sent KB)";
$crate=0;
next;
}
if(/^ Sent (\d+) bytes /) {
$sent=$1;
next;
}
if(/^ rate (\S+)(bit|bps) /) {
# print "BPS rate!\n" if $2 eq "bps";
if ($2 eq "bps") {
($crate=$1)=~s/K/*1024/;
$crate=~s/M/*1024*1024/;
$crate=eval $crate;
$crate*=8/1000;
} else {
($crate=$1)=~s/K/*1000/;
$crate=~s/M/*1000*1000/;
$crate=eval $crate;
$crate/=1000;
}
next;
}
if(/^class (\S+) (\S+:\S+) (root|parent (\S+:\S+)) .*rate (\S+) ceil (\S+)/) {
$class=$1;
$classid=$2;
$rate=$5;
$ceil=$6;
($parent=$3)=~s/parent //;
next;
}
}
my $level='';
sub my_sort {
return 0 unless $_[0];
return $_[0] cmp $_[1] unless $speedlevel;
return -1 if($a=~/^\(/);
$tree{$_[0]}[0]=~m|\(\S+\)\ \S+ \s*([\d\.]+) kb/s \(|;
my $a=$1;
$tree{$_[1]}[0]=~m|\(\S+\)\ \S+ \s*([\d\.]+) kb/s \(|;
my $b=$1;
return $b <=> $a;
}
sub list {
return if length($level)/2==$recurse;
if($_[0]) {
if(exists $translate{$_[0]}) {
printf "$level%-4s",$translate{$_[0]};
} else {
printf "$level%-4s",$_[0];
}
} else { return; }
$level.=' ';
my $rank=0;
foreach my $id (sort {my_sort($a,$b)} (@{$tree{$_[0]}})) {
if($id=~/^\(/) {
print " $id\n";
next;
} else {
$rank++;
next if $rank>$speedlevel and $speedlevel;
list($id);
}
}
$level=substr($level,2);
}
#@{$tree{'root'}}[0]="\n";
#list('root');
if(defined $tree{'root'}) {
foreach (sort {my_sort($a,$b)} (@{$tree{'root'}})) {
list($_);
}
} -
Accepted Answer
A few years later....
Copying and pasting Tim's code for TCCS from this forum requires an added fix due to a missing closing parenthesis on the While STDIN statement prior to the opening curly bracket (forum code thinking its found smilies?)
while ( < STDIN> ){
Or use the modified script that gives a little more detail with dropped pakets and lists all classes from: https://gist.github.com/jdeblese/8122007
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »