* George C <[EMAIL PROTECTED]> [2006-12-19 20:19]:
> Anyone know if symon is able to read stats from multiple CPU's in the
> 4.0 GENERIC.SMP kernel?  I have the following in my symon.conf:
> 
> $ cat /etc/symon.conf
> monitor { cpu(0), cpu(1), cpu(2), cpu(3),  mem, mbuf, pf,
>          if(lo0), if(bnx0), if(bnx1),
>          io(sd0), io(sd1), io(sd2), io(sd3)
> } stream to 127.0.0.1 2100
> 
> 
> But all of the CPU data recorded for each CPU (0-3) is the exact same
> (even the cpu rrd files that the symux client logs to for this host
> are identical).

bug (or missing support, however you call it) in symon.
ran into that earlier today, this seems to fix it

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/symon/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- Makefile    25 Nov 2006 08:41:04 -0000      1.21
+++ Makefile    19 Dec 2006 21:01:51 -0000
@@ -3,7 +3,7 @@
 COMMENT-main=          "active monitoring tool"
 V=                     2.72
 DISTNAME=              symon-${V}
-PKGNAME-main=          ${DISTNAME}p1
+PKGNAME-main=          ${DISTNAME}p2
 CATEGORIES=            sysutils net
 
 HOMEPAGE=              http://www.xs4all.nl/~wpd/symon
@@ -21,7 +21,7 @@ MASTER_SITES=         ${HOMEPAGE}/philes/
 MULTI_PACKAGES=                -main -mon -mux
 
 # client only package
-FULLPKGNAME-mon=       symon-mon-${V}p0
+FULLPKGNAME-mon=       symon-mon-${V}p1
 COMMENT-mon=           "active host monitor"
 LIB_DEPENDS-mon=
 # gatherer only package
Index: patches/patch-platform_OpenBSD_platform_h
===================================================================
RCS file: patches/patch-platform_OpenBSD_platform_h
diff -N patches/patch-platform_OpenBSD_platform_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-platform_OpenBSD_platform_h   19 Dec 2006 21:01:51 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+--- platform/OpenBSD/platform.h.orig   Fri Oct 21 16:58:46 2005
++++ platform/OpenBSD/platform.h        Tue Dec 19 21:08:47 2006
+@@ -18,10 +18,10 @@
+ 
+ union stream_parg {
+     struct {
+-      long time[CPUSTATES];
+-      long old[CPUSTATES];
+-      long diff[CPUSTATES];
+-      int states[CPUSTATES];
++      int64_t time[CPUSTATES];
++      int64_t old[CPUSTATES];
++      int64_t diff[CPUSTATES];
++      int64_t states[CPUSTATES];
+     } cp;
+     struct {
+       char rawdev[SYMON_DFNAMESIZE];
Index: patches/patch-platform_OpenBSD_sm_cpu_c
===================================================================
RCS file: patches/patch-platform_OpenBSD_sm_cpu_c
diff -N patches/patch-platform_OpenBSD_sm_cpu_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-platform_OpenBSD_sm_cpu_c     19 Dec 2006 21:01:51 -0000
@@ -0,0 +1,115 @@
+$OpenBSD$
+--- platform/OpenBSD/sm_cpu.c.orig     Tue Oct 18 21:58:11 2005
++++ platform/OpenBSD/sm_cpu.c  Tue Dec 19 21:18:54 2006
+@@ -59,16 +59,17 @@
+ #include <sys/dkstat.h>
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
++#include <stdlib.h>
+ 
+ #include "error.h"
+ #include "symon.h"
+ 
+ __BEGIN_DECLS
+-int percentages(int, int *, long *, long *, long *);
++int percentages(int, int64_t *, int64_t *, int64_t *, int64_t *);
+ __END_DECLS
+ 
+ /* Globals for this module all start with cp_ */
+-static int cp_time_mib[] = {CTL_KERN, KERN_CPTIME};
++int cp_time_mib[3] = {CTL_KERN, KERN_CPTIME2, 0};
+ static size_t cp_size;
+ /*
+  *  percentages(cnt, out, new, old, diffs) - calculate percentage change
+@@ -79,51 +80,55 @@ static size_t cp_size;
+  *      useful on BSD mchines for calculating cpu state percentages.
+  */
+ int
+-percentages(int cnt, int *out, register long *new, register long *old, long 
*diffs)
++percentages(int cnt, int64_t *out, int64_t *new, int64_t *old, int64_t *diffs)
+ {
+-    register int i;
+-    register long change;
+-    register long total_change;
+-    register long *dp;
+-    long half_total;
++      int64_t change, total_change, *dp, half_total;
++      int i;
+ 
+-    /* initialization */
+-    total_change = 0;
+-    dp = diffs;
++      /* initialization */
++      total_change = 0;
++      dp = diffs;
+ 
+-    /* calculate changes for each state and the overall change */
+-    for (i = 0; i < cnt; i++) {
+-      if ((change = *new - *old) < 0) {
+-          /* this only happens when the counter wraps */
+-          change = ((unsigned int) *new - (unsigned int) *old);
++      /* calculate changes for each state and the overall change */
++      for (i = 0; i < cnt; i++) {
++              if ((change = *new - *old) < 0) {
++                      /* this only happens when the counter wraps */
++                      change = (*new - *old);
++              }
++              total_change += (*dp++ = change);
++              *old++ = *new++;
+       }
+-      total_change += (*dp++ = change);
+-      *old++ = *new++;
+-    }
+ 
+-    /* avoid divide by zero potential */
+-    if (total_change == 0)
+-      total_change = 1;
++      /* avoid divide by zero potential */
++      if (total_change == 0)
++              total_change = 1;
+ 
+-    /* calculate percentages based on overall change, rounding up */
+-    half_total = total_change / 2l;
+-    for (i = 0; i < cnt; i++)
+-      *out++ = ((*diffs++ * 1000 + half_total) / total_change);
++      /* calculate percentages based on overall change, rounding up */
++      half_total = total_change / 2l;
++      for (i = 0; i < cnt; i++)
++              *out++ = ((*diffs++ * 1000 + half_total) / total_change);
+ 
+-    /* return the total in case the caller wants to use it */
+-    return total_change;
++      /* return the total in case the caller wants to use it */
++      return (total_change);
+ }
+ 
+ void
+ init_cpu(struct stream *st)
+ {
+     char buf[SYMON_MAX_OBJSIZE];
++    int cpunum;
++    const char *errstr;
+ 
++    cpunum = strtonum(st->arg, 0, INT_MAX, &errstr);
++    if (errstr)
++      fatal("init_cpu: %s", errstr);
++    cp_time_mib[2] = cpunum;
++
+     cp_size = sizeof(st->parg.cp.time);
+     /* Call get_cpu once to fill the cp_old structure */
+     get_cpu(buf, sizeof(buf), st);
+ 
+-    info("started module cpu(%.200s)", st->arg);
++    info("started module cpu(%i)", cpunum);
+ }
+ void
+ gets_cpu()
+@@ -136,7 +141,7 @@ get_cpu(char *symon_buf, int maxlen, str
+ {
+     int total;
+ 
+-    if (sysctl(cp_time_mib, 2, &st->parg.cp.time, &cp_size, NULL, 0) < 0) {
++    if (sysctl(cp_time_mib, 3, &st->parg.cp.time, &cp_size, NULL, 0) < 0) {
+       warning("%s:%d: sysctl kern.cp_time failed", __FILE__, __LINE__);
+       return 0;
+     }

-- 
Henning Brauer, [EMAIL PROTECTED], [EMAIL PROTECTED]
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting - Hamburg & Amsterdam

Reply via email to