monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

monit 4.4-beta2 problems with FreeBSD 4.10


From: Sebastian Zander
Subject: monit 4.4-beta2 problems with FreeBSD 4.10
Date: Tue, 24 Aug 2004 14:12:24 +1000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

Hi,

when running monit-4.4-beta2 on my FreeBSD 4.10 machine I found that
the cpu and memory stats are completely wrong. I tried to fix that (patch
attached). Because I don't know very much about FreeBSD I'm not sure
if the patch works in general...

Also it seems that for the system cpu stats monit prints the sum of user
and system under user (system is always 0)!?

Cheers,

Sebastian

--
Sebastian Zander
http://caia.swin.edu.au
--- monit-4.4-beta2/process/sysdep_FREEBSD.c    Thu Aug 12 04:35:16 2004
+++ monit-4.4-beta2-dev/process/sysdep_FREEBSD.c        Tue Aug 24 13:26:54 2004
@@ -268,10 +268,13 @@
 
   }
 
-  systeminfo.mem_kbyte_max= (vmm.v_pageout_free_min +
-                            vmm.v_free_count + vmm.v_wire_count +
-                            vmm.v_active_count + vmm.v_inactive_count) *
-                           ( getpagesize() / 1024 ) ;
+  /* Get the data from kvm_* */
+  if (kvm_read (kvm_handle, nlst[1].n_value,
+      &vmm, sizeof (vmm)) != sizeof (vmm)) {
+    return FALSE;
+  }
+
+  systeminfo.mem_kbyte_max = vmm.v_page_count * ( getpagesize() / 1024 ) ;
 
   return TRUE;
 
@@ -368,7 +371,7 @@
       stat_cutime = tv2sec (pstats.p_cru.ru_utime);
       stat_cstime = tv2sec (pstats.p_cru.ru_stime);
 
-      pt[i].cputime= (int)(( stat_utime + stat_stime ) / 1000);
+      pt[i].cputime= (int)(( stat_utime + stat_stime ) / 100000);
 
     } else {
 
@@ -395,7 +398,7 @@
 
       rss_lim = (u_int64_t) (plimit.pl_rlimit [RLIMIT_RSS].rlim_cur);
 
-      vms = &pinfo [0].kp_eproc.e_vm;
+      vms = &pinfo [i].kp_eproc.e_vm;
     
       pt[i].mem_kbyte= (u_int64_t) pagetok (vms->vm_rssize);
                        /* <<LOG1024 removed, we wanna have kb */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]