the following proposed patch for stable (3.0) fixes bug 151 in FreeBSD which
will result in an invalid metric for proc_total if MAC or BSD security levels
are enabled to restrict process visibility as detailed in :

  http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=151

attached original fix committed as r910

Carlo

---
Index: libmetrics/freebsd/metrics.c
===================================================================
--- libmetrics/freebsd/metrics.c        (revision 909)
+++ libmetrics/freebsd/metrics.c        (revision 910)
@@ -31,6 +31,7 @@
 #include <sys/resource.h>
 #endif
 #include <sys/stat.h>
+#include <sys/vmmeter.h>
 #include <vm/vm_param.h>
 
 #include <sys/socket.h>
@@ -486,16 +487,19 @@
 proc_total_func ( void )
 {
    g_val_t val;
-   size_t len = 0;
+   struct vmtotal total;
+   size_t len;
 
-   sysctlbyname("kern.proc.all", NULL, &len, NULL, 0);
+   /* computed every 5 seconds */
+   len = sizeof(total);
+   sysctlbyname("vm.vmtotal", &total, &len, NULL, 0);
 
-   val.uint32 = (len / sizeof (struct kinfo_proc)); 
+   val.uint32 = total.t_rq + \
+      total.t_dw + total.t_pw + total.t_sl + total.t_sw; 
 
    return val;
 }
 
-
 g_val_t
 proc_run_func( void )
 {

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to