Package: mrtg-contrib
Severity: normal
Tags: patch

The regular expression in the linux_stats.pl script requires the line in
/proc/net/dev to start with a space, but if the interface name is long
enough this isn't true.

(Normally interface names are right-adjusted with spaces to fill up to
the left, but if you use vlan interfaces like ethX.YYYY then the name is
long enought that no spaces are prependend....)

Changing the regex on line 54 to use * instead of + fixes the problem...
Patch attached.


Regards,
Andreas Henriksson
--- /usr/share/doc/mrtg/examples/linux_stat/linux_stats.pl      2006-09-26 
05:42:34.000000000 +0200
+++ /tmp/linux_stats.pl 2006-10-10 13:56:03.000000000 +0200
@@ -51,7 +51,7 @@
                        $found++;
                }
        } else {
-               if ($line =~ 
/^\s+$interface:\s*(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+$/)
 {
+               if ($line =~ 
/^\s*$interface:\s*(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+$/)
 {
                        $in = $1;
                        $out = $2;
                        $found = 1;

Reply via email to