Forráskód Böngészése

Add ./tarball_archive/symon-2.56.tar.gz

Wictor Lund 3 éve
szülő
commit
ce3de976b5

+ 17 - 1
symon/CHANGELOG

@@ -1,3 +1,19 @@
+29/12/2002 - 2.56
+
+   Added proc and debug symon2web frontends. Debug has limited useability, you
+   are better of defining one for yourself.
+
+14/12/2002 - 
+
+   Added the proc module. This can be used to retrieve accumulated information
+   about processes with the same name. A proc(httpd) statement in symon.conf,
+   for instance, will result in the reporting of the number of processes called
+   "httpd" and the amounts of cpu and memory that they take.
+  
+   Added em device to c_smrrds.sh - thanks to Jung.
+   Fixed typo in SymuxClient.pm - thanks Tobias Gresch.
+   c_config.sh did not deal with type mfs devices - thanks Dom De Vitto.
+
 29/11/2002 - 2.55
 
    Markus Friedl reported that unresolvable ip addresses cannot be used in the
@@ -218,4 +234,4 @@
 29/09/2001 - Lexer had trouble dealing with ip-addresses. Cleaned up the number	
              parsing code and removed a second comment reader.
 
-$Id: CHANGELOG,v 1.10 2002/11/29 10:50:28 dijkstra Exp $
+$Id: CHANGELOG,v 1.13 2002/12/29 16:23:40 dijkstra Exp $

+ 2 - 2
symon/Makefile.inc

@@ -1,6 +1,6 @@
-# $Id: Makefile.inc,v 1.12 2002/11/29 10:50:28 dijkstra Exp $
+# $Id: Makefile.inc,v 1.13 2002/12/15 14:28:35 dijkstra Exp $
 
-V=2.55
+V=2.56
 
 AR=	ar
 CC=	cc

+ 5 - 1
symon/TODO

@@ -1,6 +1,10 @@
 TODO:
 
 == current problems / short term
+- check that cpupct from proc is not broken. (got the feeling that %c handling
+  might not be correct)
+- rewrite sm_proc.c, don't count shared pages twice
+- rewrite index.php, allow rrds in same dir as phps
 - rewrite symon2web to allow use on internet websites
 - allow editing of graphing parameters in symon2web
 - add symon2web manual page / readme, explain weird format
@@ -11,4 +15,4 @@ TODO:
 - write a muxer that supports unix pipes
 - write a client that drives a crystal fontz lcd
 
-$Id: TODO,v 1.20 2002/10/18 12:29:09 dijkstra Exp $
+$Id: TODO,v 1.23 2002/12/29 16:23:40 dijkstra Exp $

+ 5 - 3
symon/client/SymuxClient.pm

@@ -1,4 +1,4 @@
-# $Id: SymuxClient.pm,v 1.2 2002/11/29 10:47:35 dijkstra Exp $
+# $Id: SymuxClient.pm,v 1.4 2002/12/29 16:21:31 dijkstra Exp $
 #
 # Copyright (c) 2001-2002 Willem Dijkstra
 # All rights reserved.
@@ -52,11 +52,13 @@ my $streamitem =
 	       counters_badoffset => 18, counters_fragment => 19,
 	       counters_short => 20, counters_normalize => 21, 
 	       counters_memory => 22},
-     debug => {debug0 => 1, debug1 => 2, debug3 => 3, debug4 => 4, debug5 = 5,
+     debug => {debug0 => 1, debug1 => 2, debug3 => 3, debug4 => 4, debug5 => 5,
 	       debug6 => 6, debug7 => 7, debug8 => 8, debug9 => 9, 
 	       debug10 => 10, debug11 => 11, debug12 => 12, debug13 => 13,
 	       debug14 => 14, debug15 => 15, debug16 => 16, debug17 => 17,
-	       debug18 => 18, debug19 => 19}};
+	       debug18 => 18, debug19 => 19},
+     proc  => {number => 1, uticks => 2, sticks => 3, iticks => 4, cpusec => 5, 
+	       cpupct => 6, procsz => 7, rsssz => 8}};
 
 sub new {
     my ($class, %arg) = @_;

+ 3 - 1
symon/lib/data.c

@@ -1,4 +1,4 @@
-/* $Id: data.c,v 1.17 2002/11/29 10:44:21 dijkstra Exp $ */
+/* $Id: data.c,v 1.19 2002/12/15 15:00:01 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -99,6 +99,7 @@ struct {
     { MT_IF, "llllllllll" },
     { MT_PF, "LLLLLLLLLLLLLLLLLLLLLL" },
     { MT_DEBUG, "llllllllllllllllllll" },
+    { MT_PROC, "lLLLlcll" },
     { MT_EOT, "" }
 };
 
@@ -112,6 +113,7 @@ struct {
     { MT_IF, LXT_IF },
     { MT_PF, LXT_PF },
     { MT_DEBUG, LXT_DEBUG },
+    { MT_PROC, LXT_PROC },
     { MT_EOT, LXT_BADTOKEN }
 };
 /* parallel crc32 table */

+ 3 - 2
symon/lib/data.h

@@ -1,4 +1,4 @@
-/* $Id: data.h,v 1.17 2002/11/29 10:46:59 dijkstra Exp $ */
+/* $Id: data.h,v 1.18 2002/12/15 14:27:43 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -145,7 +145,8 @@ SLIST_HEAD(muxlist, mux);
 #define MT_IF     3
 #define MT_PF     4
 #define MT_DEBUG  5
-#define MT_EOT    6
+#define MT_PROC   6
+#define MT_EOT    7
 
 /*
  * Unpacking of incoming packets is done via a packedstream structure. This

+ 2 - 1
symon/lib/lex.c

@@ -1,4 +1,4 @@
-/* $Id: lex.c,v 1.14 2002/11/29 10:44:21 dijkstra Exp $ */
+/* $Id: lex.c,v 1.15 2002/12/15 14:27:43 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -79,6 +79,7 @@ static struct {
     { "mux", LXT_MUX },
     { "pf", LXT_PF },
     { "port", LXT_PORT },
+    { "proc", LXT_PROC },
     { "source", LXT_SOURCE },
     { "stream", LXT_STREAM },
     { "to", LXT_TO },

+ 6 - 5
symon/lib/lex.h

@@ -1,4 +1,4 @@
-/* $Id: lex.h,v 1.14 2002/11/29 10:50:29 dijkstra Exp $ */
+/* $Id: lex.h,v 1.15 2002/12/15 14:27:43 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -61,10 +61,11 @@
 #define LXT_OPEN      15
 #define LXT_PF        16
 #define LXT_PORT      17
-#define LXT_SOURCE    18
-#define LXT_STREAM    19
-#define LXT_TO        20
-#define LXT_WRITE     21
+#define LXT_PROC      18
+#define LXT_SOURCE    19
+#define LXT_STREAM    20
+#define LXT_TO        21
+#define LXT_WRITE     22
 
 struct lex {
     char *buffer;		/* current line(s) */

+ 1 - 1
symon/ports/symon/Makefile

@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
 
 COMMENT=		"active monitoring tool"
-V=			2.55
+V=			2.56
 DISTNAME=		symon-${V}
 CATEGORIES=		net sysutils
 

+ 1 - 1
symon/ports/symon/pkg/PLIST

@@ -1,4 +1,4 @@
-@comment $Id: PLIST,v 1.3 2002/11/08 15:39:40 dijkstra Exp $
+@comment $Id: PLIST,v 1.4 2002/12/14 14:03:47 dijkstra Exp $
 @comment $OpenBSD: PLIST,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
 libexec/symon
 libexec/symux

+ 1 - 1
symon/ports/symon/pkg/PLIST-web

@@ -1,4 +1,4 @@
-@comment $Id: PLIST-web,v 1.3 2002/10/18 12:26:28 dijkstra Exp $
+@comment $Id: PLIST-web,v 1.4 2002/12/14 14:03:47 dijkstra Exp $
 @comment $OpenBSD: PLIST-web,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
 share/symon/web/class_cpu.inc        
 share/symon/web/class_graph.inc      

+ 2 - 2
symon/symon/Makefile

@@ -1,8 +1,8 @@
-# $Id: Makefile,v 1.28 2002/11/29 10:48:53 dijkstra Exp $
+# $Id: Makefile,v 1.29 2002/12/15 14:23:27 dijkstra Exp $
 .include "../Makefile.inc"
 
 LIBS=	-L../lib -lsymon
-SRCS=	symon.c sm_cpu.c sm_debug.c sm_mem.c sm_if.c sm_io.c sm_pf.c readconf.c symonnet.c 
+SRCS=	symon.c sm_cpu.c sm_debug.c sm_mem.c sm_if.c sm_io.c sm_pf.c sm_proc.c readconf.c symonnet.c 
 OBJS+=	${SRCS:R:S/$/.o/g}
 CFLAGS+=-I../lib
 

+ 2 - 2
symon/symon/c_config.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: c_config.sh,v 1.2 2002/11/29 10:48:53 dijkstra Exp $
+# $Id: c_config.sh,v 1.3 2002/12/14 14:03:48 dijkstra Exp $
 #
 # Create an example configuration file for symon on a host and print to stdout
 
@@ -26,7 +26,7 @@ bridge*|enc*|gif*|gre*|lo*|pflog*|ppp*|sl*|tun*|vlan*)
 	;;
 esac
 done
-io=`mount | sed '1,1d;s/^\/dev\/\([a-z]*[0-9]\).*$/io(\1), /g' | uniq | tr -d \\\n`
+io=`mount | grep -v ' type mfs ' | sed '1,1d;s/^\/dev\/\([a-z]*[0-9]\).*$/io(\1), /g' | uniq | tr -d \\\n`
 host=${1:-127.0.0.1}
 port=${2:-2100}
 cat <<EOF

+ 4 - 3
symon/symon/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.12 2002/11/29 10:48:53 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.13 2002/12/15 14:23:27 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -89,7 +89,7 @@ read_host_port(struct muxlist * mul, struct mux * mux, struct lex * l)
 
     return 1;
 }
-/* parse "<cpu(arg)|mem|if(arg)|io(arg)|debug|pf>", end condition == "}" */
+/* parse "<cpu(arg)|mem|if(arg)|io(arg)|debug|pf|proc(arg)>", end condition == "}" */
 int 
 read_symon_args(struct mux * mux, struct lex * l)
 {
@@ -106,6 +106,7 @@ read_symon_args(struct mux * mux, struct lex * l)
 	case LXT_MEM:
 	case LXT_PF:
 	case LXT_DEBUG:
+	case LXT_PROC:
 	    st = token2type(l->op);
 	    strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 
@@ -135,7 +136,7 @@ read_symon_args(struct mux * mux, struct lex * l)
 		return 0;
 	    }
 
-	    break;		/* LXT_CPU/IF/IO/MEM/PF/DEBUG */
+	    break;		/* LXT_CPU/IF/IO/MEM/PF/DEBUG/PROC */
 	case LXT_COMMA:
 	    break;
 	default:

+ 3 - 3
symon/symon/sm_debug.c

@@ -1,4 +1,4 @@
-/* $Id: sm_debug.c,v 1.1 2002/11/29 10:44:18 dijkstra Exp $ */
+/* $Id: sm_debug.c,v 1.2 2002/12/15 14:22:36 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -48,8 +48,8 @@
 #define SYMON_MAXDEBUGID      20/* = CTL_DEBUG_MAXID; depends lib/data.h */
 
 /* Globals for this module start with db_ */
-int db_mib[] = {CTL_DEBUG, 0, CTL_DEBUG_VALUE};
-int db_v[SYMON_MAXDEBUGID];
+static int db_mib[] = {CTL_DEBUG, 0, CTL_DEBUG_VALUE};
+static int db_v[SYMON_MAXDEBUGID];
 /* Prepare if module for first use */
 void 
 init_debug(char *s)

+ 2 - 2
symon/symon/sm_if.c

@@ -1,4 +1,4 @@
-/* $Id: sm_if.c,v 1.7 2002/11/29 10:48:53 dijkstra Exp $ */
+/* $Id: sm_if.c,v 1.8 2002/12/15 14:22:36 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -63,7 +63,7 @@
 #include "symon.h"
 
 /* Globals for this module start with if_ */
-int if_s = -1;
+static int if_s = -1;
 /* Prepare if module for first use */
 void 
 init_if(char *s)

+ 7 - 7
symon/symon/sm_io.c

@@ -1,4 +1,4 @@
-/* $Id: sm_io.c,v 1.9 2002/11/29 10:48:53 dijkstra Exp $ */
+/* $Id: sm_io.c,v 1.10 2002/12/15 14:22:36 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -50,12 +50,12 @@
 #include "xmalloc.h"
 
 /* Globals for this module start with io_ */
-char *io_dkstr = NULL;
-struct diskstats *io_dkstats = NULL;
-char **io_dknames = NULL;
-int io_dks = 0;
-int io_maxdks = 0;
-int io_maxstr = 0;
+static char *io_dkstr = NULL;
+static struct diskstats *io_dkstats = NULL;
+static char **io_dknames = NULL;
+static int io_dks = 0;
+static int io_maxdks = 0;
+static int io_maxstr = 0;
 
 void 
 gets_io()

+ 182 - 0
symon/symon/sm_proc.c

@@ -0,0 +1,182 @@
+/* $Id: sm_proc.c,v 1.2 2002/12/15 15:00:01 dijkstra Exp $ */
+
+/*
+ * Copyright (c) 2001-2002 Willem Dijkstra
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *    - Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    - Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials provided
+ *      with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Get process statistics from kernel and return them in symon_buf as
+ *
+ * number of processes : ticks_user : ticks_system : ticks_interrupt : 
+ * cpuseconds : procsizes : resident segment sizes
+ *
+ * Non re-entrant code: gets_proc messes with globals r/w without a semaphore.
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "error.h"
+#include "symon.h"
+#include "xmalloc.h"
+
+#define pagetob(size) ((size) << proc_pageshift)
+
+/* Globals for this module start with proc_ */
+static struct kinfo_proc *proc_ps = NULL;
+static int proc_max = 0;
+static int proc_cur = 0;
+static int proc_stathz = 0;
+static int proc_pageshift;
+static int proc_pagesize;
+
+/* get scale factor cpu percentage counter */
+#define FIXED_PCTCPU FSCALE
+typedef long pctcpu;
+#define pctdouble(p) ((double)(p) / FIXED_PCTCPU)
+
+void 
+gets_proc()
+{
+    int mib[3];
+    int procs;
+    size_t size;
+	
+    /* how much memory is needed */
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_NPROCS;
+    size = sizeof(procs);
+    if (sysctl(mib, 2, &procs, &size, NULL, 0) < 0) {
+        fatal("%s:%d: sysctl failed: can't get kern.nproc",
+	      __FILE__, __LINE__);
+    }
+
+    /* increase buffers if necessary */
+    if (procs > proc_max) {
+        proc_max = (procs * 5) / 4;
+
+	if (proc_max > SYMON_MAX_DOBJECTS) {
+	    fatal("%s:%d: dynamic object limit (%d) exceeded for kinfo_proc structures",
+		  __FILE__, __LINE__, SYMON_MAX_DOBJECTS);
+	}
+	
+	proc_ps = xrealloc(proc_ps, proc_max * sizeof(struct kinfo_proc));
+    }
+
+    /* read data in anger */
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_KTHREAD;
+    size = proc_max * sizeof(struct kinfo_proc);
+    if (sysctl(mib, 3, proc_ps, &size, NULL, 0) < 0) {
+	warning("proc probe cannot get processes");
+	proc_cur = 0;
+	return;
+    }
+
+    if (size % sizeof(struct kinfo_proc) != 0) {
+        warning("proc size mismatch: got %d bytes, not dividable by sizeof(kinfo_proc) %d",
+		size, sizeof(struct kinfo_proc));
+	proc_cur = 0;
+    } else {
+        proc_cur = size / sizeof(struct kinfo_proc);
+    }
+}
+/* Prepare io module for first use */
+void 
+init_proc(char *s)
+{
+    int mib[2] = {CTL_KERN, KERN_CLOCKRATE};
+    struct clockinfo cinf;
+    size_t size = sizeof(cinf);
+
+    /* get clockrate */
+    if (sysctl(mib, 2, &cinf, &size, NULL, 0) == -1)
+        fatal("%s:%d: could not get clockrate", __FILE__, __LINE__);
+
+    proc_stathz = cinf.stathz;
+
+    /* get pagesize */
+    proc_pagesize = sysconf(_SC_PAGESIZE);
+    proc_pageshift = 0;
+    while (proc_pagesize > 1) {
+	proc_pageshift++;
+	proc_pagesize >>= 1;
+    }
+
+    info("started module proc(%s)", s);
+}
+/* Get new io statistics */
+int 
+get_proc(char *symon_buf, int maxlen, char *process)
+{
+    int i;
+    struct kinfo_proc *pp;
+    u_quad_t  cpu_ticks = 0;
+    u_quad_t  cpu_uticks = 0;
+    u_quad_t  cpu_iticks = 0;
+    u_quad_t  cpu_sticks =0;
+    u_int32_t cpu_secs = 0;
+    double    cpu_pct = 0;
+    u_int16_t cpu_pcti = 0;
+    u_int32_t mem_procsize = 0;
+    u_int32_t mem_rss = 0;
+    int n = 0;
+
+    for (pp = proc_ps, i = 0; i < proc_cur; pp++, i++) {
+	 if (strncmp(process, pp->kp_proc.p_comm, strlen(process)) == 0) {
+	     /* cpu time - accumulated */
+	     cpu_uticks += pp->kp_proc.p_uticks;  /* user */
+	     cpu_sticks += pp->kp_proc.p_sticks;  /* sys  */
+	     cpu_iticks += pp->kp_proc.p_iticks;  /* int  */
+	     /* cpu time - percentage since last measurement */
+	     cpu_pct = pctdouble(pp->kp_proc.p_pctcpu) * 100.0;
+	     cpu_pcti += cpu_pct * 10;
+	     /* memory size - shared pages are counted multiple times */
+	     mem_procsize += pagetob(pp->kp_eproc.e_vm.vm_tsize + /* text pages */
+				     pp->kp_eproc.e_vm.vm_dsize + /* data */
+				     pp->kp_eproc.e_vm.vm_ssize); /* stack */
+	     mem_rss += pagetob(pp->kp_eproc.e_vm.vm_rssize);     /* rss  */
+	     n++;
+	 }
+    }
+    
+    /* calc total cpu_secs spent */ 
+    cpu_ticks = cpu_uticks + cpu_sticks + cpu_iticks;
+    cpu_secs = cpu_ticks / proc_stathz;  
+
+    return snpack(symon_buf, maxlen, process, MT_PROC,
+		  n, 
+		  cpu_uticks, cpu_sticks, cpu_iticks, cpu_secs, cpu_pcti,
+		  mem_procsize, mem_rss );
+}

+ 11 - 6
symon/symon/symon.8

@@ -40,8 +40,9 @@
 .Pp
 .Sh DESCRIPTION
 .Nm
-is a lightweight system monitor that measures cpu, memory, interface and disk
-statistics every 5 seconds. This information is then spooled to
+is a lightweight system monitor that measures cpu, memory, debug, process,
+interface and disk statistics every 5 seconds. This information is then spooled
+to
 .Xr symux 8
 for further processing. 
 .Pp
@@ -91,7 +92,7 @@ Multiple monitor statements to different muxes are allowed. Whitespace, newlines
 .nf
 monitor-rule = "monitor" "{" resources "}" "stream" ["to"] host [ port ]
 resources    = resource ["(" argument ")"] [ ","|" " resources ]
-resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug"
+resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc"
 host         = ip4addr | ip6addr | hostname
 port         = [ "port" | "," ] portnumber
 argument     = number | interfacename | diskname
@@ -107,7 +108,7 @@ to localhost on port 2100.
 monitor { cpu(0),  mem, pf, if(xl0), if(de0),
           if(lo0), if(wi0), io(wd0), io(wd1), 
           io(wd2), io(wd3), io(cd0), io(cd1), 
-          io(ccd0), debug } stream to 127.0.0.1 2100
+          io(ccd0), debug, proc(httpd) } stream to 127.0.0.1 2100
 .fi
 .Sh SIGNALS
 .Bl -tag -width Ds
@@ -129,9 +130,13 @@ daemon.
 system wide configuration file. 
 .El
 .Sh BUGS
-Every monitored resource mentioned 
+Every monitored resource mentioned
 .Pa /etc/symon.conf 
-gets queried. Mentioning, for example, cpu(0) twice for different muxes will result in two distinct cpu(0) measurement actions. 
+gets queried. Mentioning, for example, cpu(0) twice for different muxes will
+result in two distinct cpu(0) measurement actions.
+.Pp
+The proc module is too simple: memory shared between two instances of the same
+process is simply counted twice.
 .Pp
 .Nm 
 does not check whether resources mentioned in 

+ 2 - 1
symon/symon/symon.c

@@ -1,4 +1,4 @@
-/* $Id: symon.c,v 1.27 2002/11/29 10:45:21 dijkstra Exp $ */
+/* $Id: symon.c,v 1.28 2002/12/15 14:23:27 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -67,6 +67,7 @@ struct funcmap streamfunc[] = {
     {MT_IF, init_if, NULL, get_if},
     {MT_PF, init_pf, NULL, get_pf},
     {MT_DEBUG, init_debug, NULL, get_debug},
+    {MT_PROC, init_proc, gets_proc, get_proc},
     {MT_EOT, NULL, NULL}
 };
 

+ 14 - 8
symon/symon/symon.h

@@ -1,4 +1,4 @@
-/* $Id: symon.h,v 1.22 2002/11/29 10:45:21 dijkstra Exp $ */
+/* $Id: symon.h,v 1.23 2002/12/15 14:23:27 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -42,7 +42,8 @@
 #define SYMON_PID_FILE    "/var/run/symon.pid"
 #define SYMON_INTERVAL 5	/* measurement interval */
 #define SYMON_WARN_SENDERR 50	/* warn every x errors */
-#define SYMON_MAX_DOBJECTS  100	/* max dynamic alloction = 100 objects */
+#define SYMON_MAX_DOBJECTS  100	/* max dynamic allocation; local limit per
+				 * measurement module */
 #define SYMON_MAX_OBJSIZE  (_POSIX2_LINE_MAX)	/* max allocation unit =
 						 * _POSIX2_LINE_MAX */
 struct funcmap {
@@ -55,30 +56,35 @@ extern struct funcmap streamfunc[];
 
 /* prototypes */
 __BEGIN_DECLS
-/* cpu.c */
+/* sm_cpu.c */
 extern void init_cpu(char *);
 extern int get_cpu(char *, int, char *);
 
-/* mem.c */
+/* sm_mem.c */
 extern void init_mem(char *);
 extern int get_mem(char *, int, char *);
 
-/* if.c */
+/* sm_if.c */
 extern void init_if(char *);
 extern int get_if(char *, int, char *);
 
-/* io.c */
+/* sm_io.c */
 extern void init_io(char *);
 extern void gets_io();
 extern int get_io(char *, int, char *);
 
-/* pf.c */
+/* sm_pf.c */
 extern void init_pf(char *);
 extern int get_pf(char *, int, char *);
 
-/* debug.c */
+/* sm_debug.c */
 extern void init_debug(char *);
 extern int get_debug(char *, int, char *);
+
+/* sm_proc.c */
+extern void init_proc(char *);
+extern void gets_proc();
+extern int get_proc(char *, int, char *);
 __END_DECLS
 
 #endif				/* _SYMON_SYMON_H */

+ 1 - 1
symon/symon2web/Makefile

@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.2 2002/09/14 15:55:54 dijkstra Exp $
+# $Id: Makefile,v 1.3 2002/12/14 14:03:49 dijkstra Exp $
 .include "../Makefile.inc"
 
 all:

+ 158 - 0
symon/symon2web/class_debug.inc

@@ -0,0 +1,158 @@
+<?php
+// $Id: class_debug.inc,v 1.1 2002/12/29 16:19:36 dijkstra Exp $
+require_once("class_graph.inc");
+
+class DEBUG_Graph extends Graph {
+    function DEBUG_Graph() {
+	// get all the sensible defaults from our parent class
+	$this->init();
+    }
+
+    function execute($url) {	
+	$this->url2options($url);
+	// Four major display modes:
+	// if=brief|bits|packets|all
+	$this->shortcut = array_merge($this->shortcut, array(
+	    "debug" => array(
+		"brief" => array(
+		    "dsdefinition" => array(
+			'DEF:d0='.$this->get("rrdfile").':debug0:AVERAGE'),
+		    "graphdefinition" => array(
+			'COMMENT:"               min          avg          max          last\n"',
+			'LINE1:d0#000000:"d0   "',
+			'GPRINT:d0:MIN:" %6.2lf "',
+			'GPRINT:d0:AVERAGE:"%6.2lf "',
+			'GPRINT:d0:MAX:"%6.2lf "',
+			'GPRINT:d0:LAST:"%6.2lf \n"')),
+		"detailed" => array(
+		    "dsdefinition" => array(
+			'DEF:d0='.$this->get("rrdfile").':debug0:AVERAGE',
+			'DEF:d1='.$this->get("rrdfile").':debug1:AVERAGE',
+			'DEF:d2='.$this->get("rrdfile").':debug2:AVERAGE',
+			'DEF:d3='.$this->get("rrdfile").':debug3:AVERAGE',
+			'DEF:d4='.$this->get("rrdfile").':debug4:AVERAGE',
+			'DEF:d5='.$this->get("rrdfile").':debug5:AVERAGE',
+			'DEF:d6='.$this->get("rrdfile").':debug6:AVERAGE',
+			'DEF:d7='.$this->get("rrdfile").':debug7:AVERAGE',
+			'DEF:d8='.$this->get("rrdfile").':debug8:AVERAGE',
+			'DEF:d9='.$this->get("rrdfile").':debug9:AVERAGE',
+			'DEF:d10='.$this->get("rrdfile").':debug10:AVERAGE',
+			'DEF:d11='.$this->get("rrdfile").':debug11:AVERAGE',
+			'DEF:d12='.$this->get("rrdfile").':debug12:AVERAGE',
+			'DEF:d13='.$this->get("rrdfile").':debug13:AVERAGE',
+			'DEF:d14='.$this->get("rrdfile").':debug14:AVERAGE',
+			'DEF:d15='.$this->get("rrdfile").':debug15:AVERAGE',
+			'DEF:d16='.$this->get("rrdfile").':debug16:AVERAGE',
+			'DEF:d17='.$this->get("rrdfile").':debug17:AVERAGE',
+			'DEF:d18='.$this->get("rrdfile").':debug18:AVERAGE',
+			'DEF:d19='.$this->get("rrdfile").':debug19:AVERAGE'),
+		    "graphdefinition" => array(
+			'COMMENT:"               min          avg          max          last\n"',
+			'LINE1:d0#000000:"d0   "',
+			'GPRINT:d0:MIN:" %6.2lf "',
+			'GPRINT:d0:AVERAGE:"%6.2lf "',
+			'GPRINT:d0:MAX:"%6.2lf "',
+			'GPRINT:d0:LAST:"%6.2lf \n"',
+			'LINE1:d1#000111:"d1   "',
+			'GPRINT:d1:MIN:" %6.2lf "',
+			'GPRINT:d1:AVERAGE:"%6.2lf "',
+			'GPRINT:d1:MAX:"%6.2lf "',
+			'GPRINT:d1:LAST:"%6.2lf \n"',
+			'LINE1:d2#000222:"d2   "',
+			'GPRINT:d2:MIN:" %6.2lf "',
+			'GPRINT:d2:AVERAGE:"%6.2lf "',
+			'GPRINT:d2:MAX:"%6.2lf "',
+			'GPRINT:d2:LAST:"%6.2lf \n"',
+			'LINE1:d3#000333:"d3   "',
+			'GPRINT:d3:MIN:" %6.2lf "',
+			'GPRINT:d3:AVERAGE:"%6.2lf "',
+			'GPRINT:d3:MAX:"%6.2lf "',
+			'GPRINT:d3:LAST:"%6.2lf \n"',
+			'LINE1:d4#000444:"d4   "',
+			'GPRINT:d4:MIN:" %6.2lf "',
+			'GPRINT:d4:AVERAGE:"%6.2lf "',
+			'GPRINT:d4:MAX:"%6.2lf "',
+			'GPRINT:d4:LAST:"%6.2lf \n"',
+			'LINE1:d5#000555:"d5   "',
+			'GPRINT:d5:MIN:" %6.2lf "',
+			'GPRINT:d5:AVERAGE:"%6.2lf "',
+			'GPRINT:d5:MAX:"%6.2lf "',
+			'GPRINT:d5:LAST:"%6.2lf \n"',
+			'LINE1:d6#000666:"d6   "',
+			'GPRINT:d6:MIN:" %6.2lf "',
+			'GPRINT:d6:AVERAGE:"%6.2lf "',
+			'GPRINT:d6:MAX:"%6.2lf "',
+			'GPRINT:d6:LAST:"%6.2lf \n"',
+			'LINE1:d7#000777:"d7   "',
+			'GPRINT:d7:MIN:" %6.2lf "',
+			'GPRINT:d7:AVERAGE:"%6.2lf "',
+			'GPRINT:d7:MAX:"%6.2lf "',
+			'GPRINT:d7:LAST:"%6.2lf \n"',
+			'LINE1:d8#000888:"d8   "',
+			'GPRINT:d8:MIN:" %6.2lf "',
+			'GPRINT:d8:AVERAGE:"%6.2lf "',
+			'GPRINT:d8:MAX:"%6.2lf "',
+			'GPRINT:d8:LAST:"%6.2lf \n"',
+			'LINE1:d9#000999:"d9   "',
+			'GPRINT:d9:MIN:" %6.2lf "',
+			'GPRINT:d9:AVERAGE:"%6.2lf "',
+			'GPRINT:d9:MAX:"%6.2lf "',
+			'GPRINT:d9:LAST:"%6.2lf \n"',
+			'LINE1:d10#111999:"d10  "',
+			'GPRINT:d10:MIN:" %6.2lf "',
+			'GPRINT:d10:AVERAGE:"%6.2lf "',
+			'GPRINT:d10:MAX:"%6.2lf "',
+			'GPRINT:d10:LAST:"%6.2lf \n"',
+			'LINE1:d11#222999:"d11  "',
+			'GPRINT:d11:MIN:" %6.2lf "',
+			'GPRINT:d11:AVERAGE:"%6.2lf "',
+			'GPRINT:d11:MAX:"%6.2lf "',
+			'GPRINT:d11:LAST:"%6.2lf \n"',
+			'LINE1:d12#333999:"d12  "',
+			'GPRINT:d12:MIN:" %6.2lf "',
+			'GPRINT:d12:AVERAGE:"%6.2lf "',
+			'GPRINT:d12:MAX:"%6.2lf "',
+			'GPRINT:d12:LAST:"%6.2lf \n"',
+			'LINE1:d13#444999:"d13  "',
+			'GPRINT:d13:MIN:" %6.2lf "',
+			'GPRINT:d13:AVERAGE:"%6.2lf "',
+			'GPRINT:d13:MAX:"%6.2lf "',
+			'GPRINT:d13:LAST:"%6.2lf \n"',
+			'LINE1:d14#555999:"d14  "',
+			'GPRINT:d14:MIN:" %6.2lf "',
+			'GPRINT:d14:AVERAGE:"%6.2lf "',
+			'GPRINT:d14:MAX:"%6.2lf "',
+			'GPRINT:d14:LAST:"%6.2lf \n"',
+			'LINE1:d15#666999:"d15  "',
+			'GPRINT:d15:MIN:" %6.2lf "',
+			'GPRINT:d15:AVERAGE:"%6.2lf "',
+			'GPRINT:d15:MAX:"%6.2lf "',
+			'GPRINT:d15:LAST:"%6.2lf \n"',
+			'LINE1:d16#777999:"d16  "',
+			'GPRINT:d16:MIN:" %6.2lf "',
+			'GPRINT:d16:AVERAGE:"%6.2lf "',
+			'GPRINT:d16:MAX:"%6.2lf "',
+			'GPRINT:d16:LAST:"%6.2lf \n"',
+			'LINE1:d17#888999:"d17  "',
+			'GPRINT:d17:MIN:" %6.2lf "',
+			'GPRINT:d17:AVERAGE:"%6.2lf "',
+			'GPRINT:d17:MAX:"%6.2lf "',
+			'GPRINT:d17:LAST:"%6.2lf \n"',
+			'LINE1:d18#999999:"d18  "',
+			'GPRINT:d18:MIN:" %6.2lf "',
+			'GPRINT:d18:AVERAGE:"%6.2lf "',
+			'GPRINT:d18:MAX:"%6.2lf "',
+			'GPRINT:d18:LAST:"%6.2lf \n"',
+			'LINE1:d19#aaa999:"d19  "',
+			'GPRINT:d19:MIN:" %6.2lf "',
+			'GPRINT:d19:AVERAGE:"%6.2lf "',
+			'GPRINT:d19:MAX:"%6.2lf "',
+			'GPRINT:d19:LAST:"%6.2lf \n"' )))));
+
+	$this->graphdefaults = array_merge($this->graphdefaults,
+					   $this->shortcut["debug"]["brief"]);
+	$this->graphsettings["rawcmdline"] .=" -v 'debug'";
+	$this->url2options($url);
+    }
+}
+?>

+ 87 - 0
symon/symon2web/class_proc.inc

@@ -0,0 +1,87 @@
+<?php
+// $Id: class_proc.inc,v 1.1 2002/12/29 16:19:36 dijkstra Exp $
+require_once("class_graph.inc");
+
+class PROC_Graph extends Graph {
+    function PROC_Graph() {
+	// get all the sensible defaults from our parent class
+	$this->init();
+    }
+    function execute($url) {
+	$this->url2options($url);
+	// and add a few private things
+	$this->graphsettings["rawcmdline"] .=" -v '% cpu proc(".$this->get("name").")' -u 100 --rigid ";
+
+	$this->shortcut = array_merge($this->shortcut, array(
+	    "proc" => array(
+		"brief" => array(
+		    "dsdefinition" => array(
+			"DEF:pct=".$this->get("rrdfile").":cpupct:AVERAGE",
+			"DEF:num=".$this->get("rrdfile").":number:AVERAGE",
+			"CDEF:inum=0,num,-"),
+		    "graphdefinition" => array(
+			"AREA:pct#00FF00:'cpupct'",
+			"GPRINT:pct:AVERAGE:'%.0lf\g'",
+			"AREA:inum#0000FF:'number'",
+			"GPRINT:num:AVERAGE:'%.0lf\g'")),
+		"detailed" => array(
+		    "dsdefinition" => array(
+			"DEF:number=".$this->get("rrdfile").":number:AVERAGE",
+			"DEF:uticks=".$this->get("rrdfile").":uticks:AVERAGE",
+			"DEF:sticks=".$this->get("rrdfile").":sticks:AVERAGE",
+			"DEF:iticks=".$this->get("rrdfile").":iticks:AVERAGE",
+			"DEF:cpusec=".$this->get("rrdfile").":cpusec:AVERAGE",
+			"DEF:cpupct=".$this->get("rrdfile").":cpupct:AVERAGE",
+			"DEF:procsz=".$this->get("rrdfile").":procsz:AVERAGE",
+			"DEF:rsssz=".$this->get("rrdfile").":rsssz:AVERAGE",
+			"CDEF:null=number,number,-",
+			"CDEF:inumber=0,number,-"),
+		    "graphdefinition" => array(
+			'COMMENT:"                 min       avg       max       last\n"',
+			"AREA:cpupct#00FF00:'cpupct     '",
+			'GPRINT:cpupct:MIN:" %3.2lf %%"',
+			'GPRINT:cpupct:AVERAGE:"%3.2lf %%"',
+			'GPRINT:cpupct:MAX:"%3.2lf %%"',
+			'GPRINT:cpupct:LAST:"%3.2lf %%\n"',
+			"AREA:inumber#0000FF:'number     '",
+			'GPRINT:number:MIN:" %5.0lf "',
+			'GPRINT:number:AVERAGE:"%5.0lf "',
+			'GPRINT:number:MAX:"%5.0lf "',
+			'GPRINT:number:LAST:"%5.0lf \n"',
+			"STACK:null#000000:'uticks    '",
+			'GPRINT:uticks:MIN:" %3.2lf %s"',
+			'GPRINT:uticks:AVERAGE:"%3.2lf %s"',
+			'GPRINT:uticks:MAX:"%3.2lf %s"',
+			'GPRINT:uticks:LAST:"%3.2lf %s\n"',
+			"STACK:null#000000:'sticks    '",
+			'GPRINT:sticks:MIN:" %3.2lf %s"',
+			'GPRINT:sticks:AVERAGE:"%3.2lf %s"',
+			'GPRINT:sticks:MAX:"%3.2lf %s"',
+			'GPRINT:sticks:LAST:"%3.2lf %s\n"',
+			"STACK:null#000000:'iticks   '",
+			'GPRINT:iticks:MIN:" %3.2lf %s"',
+			'GPRINT:iticks:AVERAGE:"%3.2lf %s"',
+			'GPRINT:iticks:MAX:"%3.2lf %s"',
+			'GPRINT:iticks:LAST:"%3.2lf %s\n"',
+			"STACK:null#000000:'cpusec   '",
+			'GPRINT:cpusec:MIN:" %5.0lf "',
+			'GPRINT:cpusec:AVERAGE:"%5.0lf "',
+			'GPRINT:cpusec:MAX:"%5.0lf "',
+			'GPRINT:cpusec:LAST:"%5.0lf \n"',
+			"STACK:null#000000:'procsz    '", 
+			'GPRINT:procsz:MIN:" %3.2lf %s"',
+			'GPRINT:procsz:AVERAGE:"%3.2lf %s"',
+			'GPRINT:procsz:MAX:"%3.2lf %s"',
+			'GPRINT:procsz:LAST:"%3.2lf %s\n"',
+			"STACK:null#000000:'rsssz     '",
+			'GPRINT:rsssz:MIN:" %3.2lf %s"',
+			'GPRINT:rsssz:AVERAGE:"%3.2lf %s"',
+			'GPRINT:rsssz:MAX:"%3.2lf %s"',
+			'GPRINT:rsssz:LAST:"%3.2lf %s\n"')))));
+	$this->graphdefaults = array_merge($this->graphdefaults, 
+					   $this->shortcut["proc"]["brief"]);
+	$this->url2options($url);
+
+    }
+}
+?>

+ 8 - 0
symon/symon2web/graph_debug.php

@@ -0,0 +1,8 @@
+<?php
+// $Id: graph_debug.php,v 1.1 2002/12/29 16:19:36 dijkstra Exp $
+require_once("datasources.inc");
+require_once("class_debug.inc");
+$g = new DEBUG_Graph();
+$g->execute($HTTP_SERVER_VARS["QUERY_STRING"]);
+$g->sendimage();
+?>

+ 8 - 0
symon/symon2web/graph_proc.php

@@ -0,0 +1,8 @@
+<?php
+// $Id: graph_proc.php,v 1.1 2002/12/29 16:19:36 dijkstra Exp $
+require_once("datasources.inc");
+require_once("class_proc.inc");
+$g = new PROC_Graph();
+$g->execute($HTTP_SERVER_VARS["QUERY_STRING"]);
+$g->sendimage();
+?>

+ 20 - 3
symon/symon2web/index.php

@@ -1,19 +1,21 @@
 <?php
-// $Id: index.php,v 1.14 2002/11/29 10:45:46 dijkstra Exp $
+// $Id: index.php,v 1.16 2002/12/29 16:19:36 dijkstra Exp $
 require_once('datasources.inc');
 require_once('class_cpu.inc');
 require_once('class_if.inc');
 require_once('class_io.inc');
 require_once('class_mem.inc');
 require_once('class_pf.inc');
+require_once('class_debug.inc');
+require_once('class_proc.inc');
 
 if (!empty($HTTP_SERVER_VARS["QUERY_STRING"])) {
     $args = $HTTP_SERVER_VARS["QUERY_STRING"];
     // rework args to contain ony last set 'command' 
-    $selected_machine = "";
     $options = array();
     $allargs = explode('&', $args);
     $i = 0;
+    $selected_machine = "";
     while ($i < count($allargs)) {
 	$operand = split('=', $allargs[$i]);
 	if (count($operand) == 2) {
@@ -37,6 +39,7 @@ if (!empty($HTTP_SERVER_VARS["QUERY_STRING"])) {
     }
 } else {
     $args = "";
+    $selected_machine = "";
 }
 function make_graph_url($type, $new_args) {
     global $args;
@@ -63,6 +66,13 @@ function make_graph_url($type, $new_args) {
 	break;
     case 'pf':
 	$g = new PF_Graph();
+	break;
+    case 'debug':
+	$g = new DEBUG_Graph();
+	break;
+    case 'proc':
+	$g = new PROC_Graph();
+	break;
     }
     $g->execute($allargs);
     return ($url . $g->settings2url());
@@ -140,6 +150,12 @@ function print_index_url($new_args) {
 	 <a href="<? print_index_url("pf=state")?> ">state</a>,
 	 <a href="<? print_index_url("pf=performance")?> ">performance</a>,
 	 <a href="<? print_index_url("pf=all")?> ">all</a><br />
+	 Proc:
+	 <a href="<? print_index_url("proc=brief")?> ">brief</a>,
+	 <a href="<? print_index_url("proc=detailed")?> ">detailed</a><br />
+	 Debug:
+	 <a href="<? print_index_url("debug=brief")?> ">brief</a>,
+	 <a href="<? print_index_url("debug=detailed")?> ">detailed</a><br />
         </div>
        </div>
       </td>
@@ -195,6 +211,7 @@ function print_index_url($new_args) {
 <?php
 // traverse through the symonrrd tree
   $found_machine = 0;
+// TODO : check if machine is a list
   reset($symon2web["machine"]);
 // only allow a single machine in the machine array if selected machine is set
   if ($symon2web["view"] == "one" && $selected_machine != "all" ) {
@@ -215,7 +232,7 @@ function print_index_url($new_args) {
       while ($filename = $machine_dir->read()) {
 	  $file = $dir."/".$filename;
 	  if (is_file($file) && 
-	      preg_match("/^(cpu|if|io|mem|pf)(_([a-z]+))?([0-9]?).rrd$/", 
+	      preg_match("/^(cpu|if|io|mem|pf|proc|debug)(_([a-z]+))?([0-9]?).rrd$/", 
 			 $filename, $match)) {
 	      $rrdtype = $match[1];
 	      $rrdwhat = $match[3];

+ 23 - 13
symon/symux/c_smrrds.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: c_smrrds.sh,v 1.14 2002/11/29 10:49:20 dijkstra Exp $
+# $Id: c_smrrds.sh,v 1.17 2002/12/29 16:20:31 dijkstra Exp $
 
 #
 # Copyright (c) 2001-2002 Willem Dijkstra
@@ -59,7 +59,7 @@ RRD_ARGS="--step=$INTERVAL --start=0"
 # --- user configuration ends here
 
 # All interfaces and disks
-INTERFACES="an|awi|be|bge|bm|cnw|dc|de|ec|ef|eg|el|ep|ex|fea|fpa|fxp|gem|gm|gre|hme|ie|kue|lc|le|lge|lmc|lo|ne|ne|nge|ray|rl|qe|qec|sf|sis|sk|skc|sl|sm|siop|ste|stge|ti|tl|tr|tx|txp|vme|vr|wb|we|wi|wx|xe|xl"
+INTERFACES="an|awi|be|bge|bm|cnw|dc|de|ec|ef|eg|el|em|ep|ex|fea|fpa|fxp|gem|gm|gre|hme|ie|kue|lc|le|lge|lmc|lo|ne|ne|nge|ray|rl|qe|qec|sf|sis|sk|skc|sl|sm|siop|ste|stge|ti|tl|tr|tx|txp|vme|vr|wb|we|wi|wx|xe|xl"
 VIRTUALINTERFACES="bridge|enc|faith|gif|ppp|sppp|strip|tun|vlan";
 DISKS="sd|cd|ch|rd|raid|ss|uk|vnc|wd"
 
@@ -92,7 +92,7 @@ if [ `echo $i | egrep -e "^($VIRTUALINTERFACES)$"` ]; then i=if_$i.rrd; fi
 # add io_*.rrd if it is a disk
 if [ `echo $i | egrep -e "^($DISKS)$"` ]; then i=io_$i.rrd; fi
 # add .rrd if it is a cpu, etc.
-if [ `echo $i | egrep -e "^(cpu[0-9]|mem|pf|debug)$"` ]; then i=$i.rrd; fi
+if [ `echo $i | egrep -e "^(cpu[0-9]$|mem$|pf$|debug$|proc_)"` ]; then i=$i.rrd; fi
 
 if [ -f $i ]; then
     echo "$i exists - ignoring"
@@ -158,16 +158,26 @@ if_*.rrd)
 debug.rrd)
     # Build debug file
     rrdtool create $i $RRD_ARGS \
-	DS:debug0:COUNTER:5:U:U DS:debug1:COUNTER:5:U:U \
-	DS:debug2:COUNTER:5:U:U DS:debug3:COUNTER:5:U:U \
-	DS:debug4:COUNTER:5:U:U DS:debug5:COUNTER:5:U:U \
-	DS:debug6:COUNTER:5:U:U DS:debug7:COUNTER:5:U:U \
-	DS:debug8:COUNTER:5:U:U DS:debug9:COUNTER:5:U:U \
-	DS:debug10:COUNTER:5:U:U DS:debug11:COUNTER:5:U:U \
-	DS:debug12:COUNTER:5:U:U DS:debug13:COUNTER:5:U:U \
-	DS:debug14:COUNTER:5:U:U DS:debug15:COUNTER:5:U:U \
-	DS:debug16:COUNTER:5:U:U DS:debug17:COUNTER:5:U:U \
-	DS:debug18:COUNTER:5:U:U DS:debug19:COUNTER:5:U:U \
+	DS:debug0:GAUGE:5:U:U DS:debug1:GAUGE:5:U:U \
+	DS:debug2:GAUGE:5:U:U DS:debug3:GAUGE:5:U:U \
+	DS:debug4:GAUGE:5:U:U DS:debug5:GAUGE:5:U:U \
+	DS:debug6:GAUGE:5:U:U DS:debug7:GAUGE:5:U:U \
+	DS:debug8:GAUGE:5:U:U DS:debug9:GAUGE:5:U:U \
+	DS:debug10:GAUGE:5:U:U DS:debug11:GAUGE:5:U:U \
+	DS:debug12:GAUGE:5:U:U DS:debug13:GAUGE:5:U:U \
+	DS:debug14:GAUGE:5:U:U DS:debug15:GAUGE:5:U:U \
+	DS:debug16:GAUGE:5:U:U DS:debug17:GAUGE:5:U:U \
+	DS:debug18:GAUGE:5:U:U DS:debug19:GAUGE:5:U:U \
+	$RRA_SETUP
+    echo "$i created"
+    ;;
+proc_*.rrd)
+    # Build proc file
+    rrdtool create $i $RRD_ARGS \
+	DS:number:GAUGE:5:0:U DS:uticks:GAUGE:5:0:U \
+	DS:sticks:GAUGE:5:0:U DS:iticks:GAUGE:5:0:U \
+	DS:cpusec:GAUGE:5:0:U DS:cpupct:GAUGE:5:0:100 \
+        DS:procsz:GAUGE:5:0:U DS:rsssz:GAUGE:5:0:U \
 	$RRA_SETUP
     echo "$i created"
     ;;

+ 9 - 3
symon/symux/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.16 2002/11/29 10:49:35 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.17 2002/12/15 14:28:10 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -85,6 +85,10 @@ insert_filename(char *path, int maxlen, int type, char *args)
 	ts = "debug";
 	ta = "";
 	break;
+    case MT_PROC:
+	ts = "proc_";
+	ta = args;
+	break;
     default:
 	warning("%s:%d: internal error: type (%d) unknown",
 		__FILE__, __LINE__, type);
@@ -180,6 +184,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 		case LXT_MEM:
 		case LXT_PF:
 		case LXT_DEBUG:
+		case LXT_PROC:
 		    st = token2type(l->op);
 		    strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 
@@ -211,7 +216,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 			return 0;
 		    }
 
-		    break;	/* LXT_CPU/IF/IO/MEM/PF/DEBUG */
+		    break;	/* LXT_CPU/IF/IO/MEM/PF/DEBUG/PROC */
 		case LXT_COMMA:
 		    break;
 		default:
@@ -305,6 +310,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 	    case LXT_MEM:
 	    case LXT_PF:
 	    case LXT_DEBUG:
+	    case LXT_PROC:
 		st = token2type(l->op);
 		strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 
@@ -364,7 +370,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 			stream->file = xstrdup(l->token);
 		    }
 		}
-		break;		/* LXT_CPU/IF/IO/MEM/PF/DEBUG */
+		break;		/* LXT_CPU/IF/IO/MEM/PF/DEBUG/PROC */
 	    default:
 		parse_error(l, "{cpu|mem|if|io|debug}");
 		return 0;

+ 9 - 4
symon/symux/symux.8

@@ -40,8 +40,9 @@
 .Pp
 .Sh DESCRIPTION
 .Xr symon 8
-is a lightweight system monitor that measures cpu, memory, interface and disk
-statistics every 5 seconds. This information is then spooled to
+is a lightweight system monitor that measures cpu, memory, debug, process,
+interface and disk statistics every 5 seconds. This information is then spooled
+to
 .Nm
 for further processing. 
 .Pp
@@ -103,7 +104,7 @@ source-stmt  = "source" host "{" accept-stmts write-stmts [ datadir-stmt ] "}"
 accept-stmts = accept-stmt [accept-stmts]
 accept-stmt  = "accept" "{" resources "}"
 resources    = resource ["(" argument ")"] [ ","|" " resources ]
-resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug"
+resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc"
 argument     = number | interfacename | diskname
 datadir-stmt = "datadir" dirname
 write-stmts  = write-stmt [write-stmts]
@@ -213,7 +214,11 @@ states_inserts : states_removals : counters_match : counters_badoffset :
 counters_fragment : counters_short : counters_normalize : counters_memory
 ). Values are 64 bit unsigned integers internally.
 .It debug
-Kernel variables debug0 to debug19. ( debug0 : ... : debug19 ). Values are 32 bit unsigned integers. 
+Kernel variables debug0 to debug19. ( debug0 : ... : debug19 ). Values are 32
+bit unsigned integers.
+.It proc
+Process statistics ( number : uticks : sticks : iticks : cpusec : cpupct :
+procsz : rsssz ).
 .El
 .Sh SIGNALS
 .Bl -tag -width Ds