Project

General

Profile

Bug #879

Correct parsing of output by rate

Added by Torben Hørup over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
09/06/2010
Due date:
% Done:

100%

Estimated time:
Affected Version:
2.0
Affected Architecture:

Description

The formating of /usr/local/bin/rate output (called in bandwidth_by_ip.php) sometimes mess up the parser.
For instance this line
192.168.0.2 1.66M 1.31k| 44.31k 756.22 | 1.66M 1.31k| 44.31k 756.22
where there is no space between the "1.31k" and the first pipe character. This both messes with the AWK call and a posibility of sending a extra pipe character to the javascript parser in status_graph.php

this patch fixes the issue:

--- _bandwidth_by_ip.php 2010-09-06 17:49:00.000000000 0200
+
+ bandwidth_by_ip.php 2010-09-06 17:50:18.000000000 +0200
@ -30,7 +30,7 @
//use class A subnet to make sure we capture all traffic on specified interface
$intsubnet = $intip0 . ".0.0.0/8";

-exec("/usr/local/bin/rate -i {$real_interface} -nlq 1 -Aba 20 -c {$intsubnet} | awk '{ printf \"%s:%s:%s:%s:%s\\n\", $1, $2, $5, $8, $11 }'", $listedIPs);
+exec("/usr/local/bin/rate -i {$real_interface} -nlq 1 -Aba 20 -c {$intsubnet} | tr \"|\" \" \" | awk '{ printf \"%s:%s:%s:%s:%s\\n\", $1, $2, $4, $6, $8 }'", $listedIPs);

unset($bandwidthinfo);
unset($receivebytesarray);
bandwidth_by_ip.patch (680 Bytes) bandwidth_by_ip.patch Torben Hørup, 09/07/2010 04:53 AM

Associated revisions

Revision f1aad4d1 (diff)
Added by Ermal Luçi over 8 years ago

Resolves #879. Commit patch referenced in ticket to properly parse rate output.

History

#1 Updated by Torben Hørup over 8 years ago

Heres the patch as an attachment instead

#2 Updated by Ermal Luçi over 8 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#3 Updated by Torben Hørup over 8 years ago

Thanks. Just close this ticket.

#4 Updated by Jim Pingle over 8 years ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF