Hello Jordi,

Thank you for the really quick response.

Quoting Jordi Sanfeliu <jo...@fibranet.cat>:

As you can see I don't have the 'Idrop' column in my output, and that's
probably is the definitive cause of the problem.

This is the version I have used:
$ uname -a
FreeBSD freebsd.fibranet.lan 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May
  1 08:49:13 UTC 2009
r...@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

Sorry, I should have indicated what version of FreeBSD I am running. My system is running 8.2-RELEASE, which is the latest stable version.

I did a bit of investigation myself. I happen to have 2 other FreeBSD systems, one running 7.2-RELEASE (same as your version) and the other running 8.1-RELEASE. The one running 7.2-RELEASE gives the same results for "netstat -nibd" as your output - no 'Idrop' column. The 8.1-RELEASE one has the 'Idrop' column.

I cannot find anything about this change from either the release notes for FreeBSD 8.0, 8.1 or /usr/src/UPDATING (which is usually where important changes in versions are noted), but based on this post :

http://lists.xymon.com/archive/2011-February/030722.html

it appears that the format of the "netstat -i" output changed in FreeBSD 8 to include that 'Idrop' column.

So, perhaps an easy way to fix this is to use different code to process the output for netstat -nibd based on the version of FreeBSD used? I've attached a patch which seems to do the trick for me.

Best Regards,
Sean
--- monitorix.org       2011-03-15 03:12:42.000000000 +0800
+++ monitorix   2011-03-15 01:24:07.000000000 +0800
@@ -1973,10 +1973,17 @@
                                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(' ', $_);
+                                               # Because FreeBSD 7 and 8 have 
different formats for netstat -nibd command
+                                               if($kernel_branch =~ m/^8/) { 
+                                                       (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(' ', $_);
+                                               }
+                                               else {
+                                                       if($kernel_branch =~ 
m/^7/) {
+                                                               (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(' ', $_);
+                                                       }
+                                               }       
                                                last;
-                                       }
+                                       }                                       
                                }
                                close(IN);
                        }
------------------------------------------------------------------------------
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

Reply via email to