Hello,
First, thank you for creating monitorix. I've used to it monitor
several CentOS servers I administered for a few years and it has
proved to be very useful.
I have no idea if I this is the right way to report a bug so my
apologies if this is the wrong way to go about doing it.
I also happen to administer some FreeBSD systems. I recently found
what I think is a bug in the code for collecting network statistics
under FreeBSD. I noticed that the main graph in the Network Traffic
and Usage graph section is always blank. No traffic is ever logged.
However, the traffic error section always logs data as if my network
interface is continually generating packet errors.
I believe I have found the cause of the problem and enclose a patch for it.
I think some of the columns from netstat -nibd are being logged in the
wrong order -
open(IN, "netstat -nibd |");
while(<IN>) {
if(/Link/ && /$NET_LIST[$n]/) {
(undef, undef, undef, undef, $net_packs_in[$n],
$net_error_in[$n], $net_bytes_in[$n], $net_packs_out[$n],
$net_error_out[$n], $net_bytes_out[$n]) = split(' ', $_);
}
}
compare this with the actual output of a netstat -nibd command :
Name Mtu Network Address Ipkts Ierrs Idrop
Ibytes Opkts Oerrs Obytes Coll Drop
ipfw0 65536 <Link#1> 0 0 0
0 0 0 0 0 0
lo0 16384 <Link#2> 0 0 0
0 0 0 0 0 0
lo0 16384 fe80:2::1/64 fe80:2::1 0 - -
0 0 - 0 - -
lo0 16384 ::1/128 ::1 0 - -
0 0 - 0 - -
lo0 16384 127.0.0.0/8 127.0.0.1 0 - -
0 0 - 0 - -
em0 1500 <Link#3> 08:00:27:09:3e:7c 30976 0 0
43684172 21128 0 1183551 0 0
em0 1500 192.168.10.0/24 192.168.10.15 30970 - -
43248731 21126 - 887703 - -
$net_packs_in[$n] = Ipkts (correct)
$net_packs_error_in[$n] = Ierrs (correct)
$net_bytes_in[$n] = Idrop (should be Ibytes, next column)
$net_packs_out[$n] = Ibytes (should be Opkts, next column)
....
etc
The solution is to add one more "undef" after $net_error_in[$n] thus :
if(/Link/ && /$NET_LIST[$n]/) {
(undef, undef, undef, undef, $net_packs_in[$n],
$net_error_in[$n], undef, $net_bytes_in[$n], $net_packs_out[$n],
$net_error_out[$n], $net_bytes_out[$n]) = split(' ', $_);
}
I first noticed this on version 1.5.1 (FreeBSD ports) and it still
appears to be there in v. 2.0.0 and 2.1.0 (source), which I am now
running.
Best regards,
Sean
--- monitorix.org 2011-03-14 16:38:51.000000000 +0800
+++ monitorix 2011-03-14 16:38:22.000000000 +0800
@@ -1973,7 +1973,7 @@
open(IN, "netstat -nibd |");
while(<IN>) {
if(/Link/ && /$NET_LIST[$n]/) {
- (undef, undef, undef, undef,
$net_packs_in[$n], $net_error_in[$n], $net_bytes_in[$n], $net_packs_out[$n],
$net_error_out[$n], $net_bytes_out[$n]) = split(' ', $_);
+ (undef, undef, undef, undef,
$net_packs_in[$n], $net_error_in[$n], undef, $net_bytes_in[$n],
$net_packs_out[$n], $net_error_out[$n], $net_bytes_out[$n]) = split(' ', $_);
last;
}
}
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Monitorix-general mailing list
Monitorix-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/monitorix-general