Browse Source

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

Wictor Lund 3 years ago
parent
commit
a1acf9bb0f

+ 9 - 3
symon/CHANGELOG

@@ -1,4 +1,10 @@
-24/01/2002 - 2.58
+26/02/2003 - 2.59
+
+   - mbuf probe (Daniel Hartmeier; depends on 3.2)
+   - example configuration is now installed in to symon/examples +
+     better conflicts in port's PLIST (Christian Weisgerber)
+
+24/01/2003 - 2.58
 
    Gustavo Chamone helped find a rare bug in symon/sm_io.c. strsep()
    would clobber stream information and make the first stream in the
@@ -7,7 +13,7 @@
    Daniel Hartmeier patched symon/sm_pf.c to deal with changes pf. His
    patch should also work for previous versions of pf.
 
-10/01/2002 - 2.57
+10/01/2003 - 2.57
 
    Christian Weisgerber reported that netinet/ip_ipsp.h already defines
    htonq - fixed. Will Wainwright reported 1) a small bug in
@@ -258,4 +264,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.16 2003/01/24 13:33:49 dijkstra Exp $
+$Id: CHANGELOG,v 1.17 2003/01/26 20:40:46 dijkstra Exp $

+ 2 - 1
symon/Makefile.inc

@@ -1,6 +1,6 @@
 # $Id: Makefile.inc,v 1.15 2003/01/24 13:33:50 dijkstra Exp $
 
-V=2.58
+V=2.59
 
 AR=	ar
 CC=	cc
@@ -19,6 +19,7 @@ POD2MAN= pod2man
 BINDIR= libexec
 MANDIR=	man
 SHRDIR= share/symon
+EXADIR= share/examples/symon
 WEBDIR= ${SHRDIR}/web
 CLIENTDIR= ${SHRDIR}/client
 

+ 5 - 2
symon/client/SymuxClient.pm

@@ -58,8 +58,11 @@ my $streamitem =
 	       debug14 => 14, debug15 => 15, debug16 => 16, debug17 => 17,
 	       debug18 => 18, debug19 => 19},
      proc  => {number => 1, uticks => 2, sticks => 3, iticks => 4, cpusec => 5, 
-	       cpupct => 6, procsz => 7, rsssz => 8}};
-
+	       cpupct => 6, procsz => 7, rsssz => 8},
+     mbuf => {totmbufs => 1, mt_data => 2, mt_oobdata => 3, mt_control => 4,
+	      mt_header => 5, mt_ftable => 6, mt_soname => 7, mt_soopts => 8,
+	      pgused => 9, pgtotal => 10, totmem => 11, totpct => 12, 
+	      m_drops => 13, m_wait => 14, m_drain => 15 }};
 sub new {
     my ($class, %arg) = @_;
     my $self;

+ 2 - 0
symon/lib/data.c

@@ -100,6 +100,7 @@ struct {
     { MT_PF, "LLLLLLLLLLLLLLLLLLLLLL" },
     { MT_DEBUG, "llllllllllllllllllll" },
     { MT_PROC, "lLLLlcll" },
+    { MT_MBUF, "lllllllllllllll" },
     { MT_EOT, "" }
 };
 
@@ -114,6 +115,7 @@ struct {
     { MT_PF, LXT_PF },
     { MT_DEBUG, LXT_DEBUG },
     { MT_PROC, LXT_PROC },
+    { MT_MBUF, LXT_MBUF },
     { MT_EOT, LXT_BADTOKEN }
 };
 /* parallel crc32 table */

+ 19 - 1
symon/lib/data.h

@@ -148,7 +148,8 @@ SLIST_HEAD(muxlist, mux);
 #define MT_PF     4
 #define MT_DEBUG  5
 #define MT_PROC   6
-#define MT_EOT    7
+#define MT_MBUF   7
+#define MT_EOT    8
 
 /*
  * Unpacking of incoming packets is done via a packedstream structure. This
@@ -242,6 +243,23 @@ struct packedstream {
 	    u_int32_t debug18;
 	    u_int32_t debug19;
 	}      ps_debug;
+	struct {
+	    u_int32_t totmbufs;
+	    u_int32_t mt_data;
+	    u_int32_t mt_oobdata;
+	    u_int32_t mt_control;
+	    u_int32_t mt_header;
+	    u_int32_t mt_ftable;
+	    u_int32_t mt_soname;
+	    u_int32_t mt_soopts;
+	    u_int32_t pgused;
+	    u_int32_t pgtotal;
+	    u_int32_t totmem;
+	    u_int32_t totpct;
+	    u_int32_t m_drops;
+	    u_int32_t m_wait;
+	    u_int32_t m_drain;
+	}      ps_mbuf;
     }     data;
 };
 

+ 1 - 0
symon/lib/lex.c

@@ -74,6 +74,7 @@ static struct {
     { "if", LXT_IF },
     { "in", LXT_IN },
     { "io", LXT_IO },
+    { "mbuf", LXT_MBUF },
     { "mem", LXT_MEM },
     { "monitor", LXT_MONITOR },
     { "mux", LXT_MUX },

+ 1 - 0
symon/lib/lex.h

@@ -66,6 +66,7 @@
 #define LXT_STREAM    20
 #define LXT_TO        21
 #define LXT_WRITE     22
+#define LXT_MBUF      23
 
 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.58
+V=			2.59
 DISTNAME=		symon-${V}
 CATEGORIES=		net sysutils
 

+ 2 - 2
symon/ports/symon/pkg/INSTALL

@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: INSTALL,v 1.1 2002/11/29 10:59:56 dijkstra Exp $
+# $Id: INSTALL,v 1.2 2003/02/20 20:59:53 dijkstra Exp $
 #
 # Pre/post-installation setup of symon monitor
 
@@ -9,7 +9,7 @@ set -e
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 PREFIX=${PKG_PREFIX:-/usr/local}
 CONFIG_FILE=${SYSCONFDIR}/symon.conf
-SAMPLE_CONFIG_FILE=$PREFIX/share/symon/symon.conf
+SAMPLE_CONFIG_FILE=$PREFIX/share/examples/symon/symon.conf
 
 do_notice()
 {

+ 2 - 2
symon/ports/symon/pkg/INSTALL-mon

@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: INSTALL-mon,v 1.1 2002/10/18 12:26:28 dijkstra Exp $
+# $Id: INSTALL-mon,v 1.2 2003/02/20 20:59:53 dijkstra Exp $
 #
 # Pre/post-installation setup of symon monitor
 
@@ -9,7 +9,7 @@ set -e
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 PREFIX=${PKG_PREFIX:-/usr/local}
 CONFIG_FILE=${SYSCONFDIR}/symon.conf
-SAMPLE_CONFIG_FILE=$PREFIX/share/symon/symon.conf
+SAMPLE_CONFIG_FILE=$PREFIX/share/examples/symon/symon.conf
 
 do_notice()
 {

+ 1 - 1
symon/ports/symon/pkg/MESSAGE

@@ -1,6 +1,6 @@
 +---------------
 | Example configurations for both symon and symux have been installed
-| in ${PREFIX}/share/symon.
+| in ${PREFIX}/share/examples/symon/
 |
 | RRD files can be obtained by running
 | ${PREFIX}/share/symon/c_smrrds.sh

+ 1 - 1
symon/ports/symon/pkg/MESSAGE-mon

@@ -1,4 +1,4 @@
 +---------------
 | An example configuration for symon has been installed in
-| ${PREFIX}/share/symon.
+| ${PREFIX}/share/examples/symon.
 +---------------

+ 1 - 1
symon/ports/symon/pkg/MESSAGE-mux

@@ -1,6 +1,6 @@
 +---------------
 | An example configuration for symux has been installed in
-| ${PREFIX}/share/symon.
+| ${PREFIX}/share/examples/symon.
 |
 | RRD files can be obtained by running
 | ${PREFIX}/share/symon/c_smrrds.sh

+ 6 - 3
symon/ports/symon/pkg/PLIST

@@ -1,12 +1,13 @@
-@comment $Id: PLIST,v 1.5 2003/01/18 09:55:34 dijkstra Exp $
 @comment $OpenBSD: PLIST,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+@pkgcfl symon-*
 libexec/symon
 libexec/symux
 man/cat8/symon.0
 man/cat8/symux.0
 share/symon/c_smrrds.sh
-share/symon/symon.conf
-share/symon/symux.conf
+share/symon/c_config.sh
+share/examples/symon/symon.conf
+share/examples/symon/symux.conf
 share/symon/web/class_cpu.inc        
 share/symon/web/class_graph.inc      
 share/symon/web/class_if.inc         
@@ -29,5 +30,7 @@ share/symon/web/test_config.php
 share/symon/client/getsymonitem.pl
 share/symon/client/SymuxClient.pm
 share/symon/client/SymuxClient.0
+@dirrm share/examples/symon
+@dirrm share/symon/client
 @dirrm share/symon/web
 @dirrm share/symon

+ 3 - 2
symon/ports/symon/pkg/PLIST-mon

@@ -1,7 +1,8 @@
-@comment $Id: PLIST-mon,v 1.1 2002/10/18 12:26:28 dijkstra Exp $
 @comment $OpenBSD: PLIST-mon,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+@pkgcfl symon-[0-9]*
 libexec/symon
 man/cat8/symon.0
-share/symon/symon.conf
 share/symon/c_config.sh
+share/examples/symon/symon.conf
+@dirrm share/examples/symon
 @dirrm share/symon

+ 4 - 2
symon/ports/symon/pkg/PLIST-mux

@@ -1,10 +1,12 @@
-@comment $Id: PLIST-mux,v 1.3 2002/11/08 15:39:40 dijkstra Exp $
 @comment $OpenBSD: PLIST-mux,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+@pkgcfl symon-[0-9]*
 libexec/symux
 man/cat8/symux.0
 share/symon/c_smrrds.sh
-share/symon/symux.conf
+share/examples/symon/symux.conf
 share/symon/client/getsymonitem.pl
 share/symon/client/SymuxClient.pm
 share/symon/client/SymuxClient.0
+@dirrm share/examples/symon
+@dirrm share/symon/client
 @dirrm share/symon

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

@@ -1,5 +1,5 @@
-@comment $Id: PLIST-web,v 1.5 2003/01/18 09:55:34 dijkstra Exp $
 @comment $OpenBSD: PLIST-web,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+@pkgcfl symon-[0-9]*
 share/symon/web/class_cpu.inc        
 share/symon/web/class_graph.inc      
 share/symon/web/class_if.inc         

+ 8 - 3
symon/symon/Makefile

@@ -2,7 +2,7 @@
 .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 sm_proc.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_mbuf.c sm_proc.c readconf.c symonnet.c 
 OBJS+=	${SRCS:R:S/$/.o/g}
 CFLAGS+=-I../lib
 
@@ -21,15 +21,20 @@ install: symon symon.cat8 symon.conf
 	${INSTALL} -c -m 555  -g wheel -o root symon      ${PREFIX}/${BINDIR}
 	${INSTALL} -c -m 444  -g wheel -o root symon.cat8 ${PREFIX}/${MANDIR}/cat8/symon.0
 	${INSTALL} -d -m 555  -g bin   -o root ${PREFIX}/${SHRDIR}
-	${INSTALL} -c -m 444  -g bin   -o root symon.conf ${PREFIX}/${SHRDIR}
 	${INSTALL} -c -m 555  -g wheel -o root c_config.sh ${PREFIX}/${SHRDIR}
+	${INSTALL} -d -m 555  -g bin   -o root ${PREFIX}/${EXADIR}
+	${INSTALL} -c -m 444  -g bin   -o root symon.conf ${PREFIX}/${EXADIR}
 
 conf.h:  Makefile
 	@echo Generating conf.h
 	@echo "/* This file was automagically generated by make */" > $@
 	@echo "#define SYMON_CONFIG_FILE \"$(SYSCONFDIR)/symon.conf\""  >> $@
 	@echo "#define SYMON_VERSION \"$(V)\"" >> $@
+	@case `grep -c KERN_MBSTAT /usr/include/sys/sysctl.h` in	\
+	1)	echo "#define HAS_KERN_MBSTAT	1" >> $@;;		\
+	0)	echo "#undef HAS_KERN_MBSTAT" >> $@;;			\
+	esac;
 
 symon.h: conf.h
 
-symon.o: symon.h
+symon.o: symon.h

+ 2 - 1
symon/symon/readconf.c

@@ -105,6 +105,7 @@ read_symon_args(struct mux * mux, struct lex * l)
 	case LXT_IO:
 	case LXT_MEM:
 	case LXT_PF:
+	case LXT_MBUF:
 	case LXT_DEBUG:
 	case LXT_PROC:
 	    st = token2type(l->op);
@@ -136,7 +137,7 @@ read_symon_args(struct mux * mux, struct lex * l)
 		return 0;
 	    }
 
-	    break;		/* LXT_CPU/IF/IO/MEM/PF/DEBUG/PROC */
+	    break;		/* LXT_CPU/IF/IO/MEM/PF/MBUF/DEBUG/PROC */
 	case LXT_COMMA:
 	    break;
 	default:

+ 171 - 0
symon/symon/sm_mbuf.c

@@ -0,0 +1,171 @@
+/* $Id: sm_mbuf.c,v 1.0 2003/01/28 19:51:00 dhartmei Exp $ */
+
+/*
+ * Copyright (c) 2003 Daniel Hartmeier
+ * 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.
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/mbuf.h>
+#include <sys/sysctl.h>
+#include <sys/errno.h>
+
+#include <string.h>
+#include <unistd.h>
+
+#include "error.h"
+#include "symon.h"
+#include "conf.h"
+
+#ifndef HAS_KERN_MBSTAT
+void 
+init_mbuf(char *s)
+{
+    fatal("mbuf module requires system upgrade (sysctl.h/KERN_MBSTAT)");
+}
+int 
+get_mbuf(char *symon_buf, int maxlen, char *arg)
+{
+    fatal("mbuf module requires system upgrade (sysctl.h/KERN_MBSTAT)");
+}
+#else
+/* Prepare if module for first use */
+void 
+init_mbuf(char *s)
+{
+    info("started module mbuf(%s)", s);
+}
+
+/* Get mbuf statistics */
+int 
+get_mbuf(char *symon_buf, int maxlen, char *arg)
+{
+    struct mbstat mbstat;
+    int npools;
+    struct pool pool, mbpool, mclpool;
+    int mib[4];
+    size_t size;
+    int i;
+    char name[32];
+    int flag = 0;
+    int nmbtypes = sizeof(mbstat.m_mtypes) / sizeof(short);
+    int page_size = getpagesize();
+    int totmem, totused, totmbufs, totpct;
+    u_int32_t stats[15];
+    
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_MBSTAT;
+    size = sizeof(mbstat);
+    if (sysctl(mib, 2, &mbstat, &size, NULL, 0) < 0) {
+	warning("mbuf(%s) failed (sysctl() %s)", arg, strerror(errno));
+	return (0);
+    }
+    
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_POOL;
+    mib[2] = KERN_POOL_NPOOLS;
+    size = sizeof(npools);
+    if (sysctl(mib, 3, &npools, &size, NULL, 0) < 0) {
+	warning("mbuf(%s) failed (sysctl() %s)", arg, strerror(errno));
+	return (0);
+    }
+    
+    for (i = 1; npools; ++i) {
+	mib[0] = CTL_KERN;
+	mib[1] = KERN_POOL;
+	mib[2] = KERN_POOL_POOL;
+	mib[3] = i;
+	size = sizeof(pool);
+	if (sysctl(mib, 4, &pool, &size, NULL, 0) < 0) {
+	    warning("mbuf(%s) failed (sysctl() %s)", arg, strerror(errno));
+	    return (0);
+	}
+	npools--;
+	mib[2] = KERN_POOL_NAME;
+	size = sizeof(name);
+	if (sysctl(mib, 4, name, &size, NULL, 0) < 0) {
+	    warning("mbuf(%s) failed (sysctl() %s)", arg, strerror(errno));
+	    return (0);
+	}
+	if (!strcmp(name, "mbpl")) {
+	    bcopy(&pool, &mbpool, sizeof(pool));
+	    flag |= 1;
+	} else if (!strcmp(name, "mclpl")) {
+	    bcopy(&pool, &mclpool, sizeof(pool));
+	    flag |= 2;
+	}
+	if (flag == 3)
+	    break;
+    }
+    if (flag != 3) {
+	warning("mbuf(%s) failed (flag != 3)", arg);
+	return (0);
+    }
+    
+    totmbufs = 0;
+    for (i = 0; i < nmbtypes; ++i)
+	totmbufs += mbstat.m_mtypes[i];
+    totmem = (mbpool.pr_npages + mclpool.pr_npages) * page_size;
+    totused = (mbpool.pr_nget - mbpool.pr_nput) * mbpool.pr_size +
+	(mclpool.pr_nget - mclpool.pr_nput) * mclpool.pr_size;
+    totpct = (totmem == 0) ? 0 : ((totused * 100) / totmem);
+    
+    stats[0] = totmbufs;
+    stats[1] = mbstat.m_mtypes[MT_DATA];
+    stats[2] = mbstat.m_mtypes[MT_OOBDATA];
+    stats[3] = mbstat.m_mtypes[MT_CONTROL];
+    stats[4] = mbstat.m_mtypes[MT_HEADER];
+    stats[5] = mbstat.m_mtypes[MT_FTABLE];
+    stats[6] = mbstat.m_mtypes[MT_SONAME];
+    stats[7] = mbstat.m_mtypes[MT_SOOPTS];
+    stats[8] = mclpool.pr_nget - mclpool.pr_nput;
+    stats[9] = mclpool.pr_npages * mclpool.pr_itemsperpage;
+    stats[10] = totmem;
+    stats[11] = totpct;
+    stats[12] = mbstat.m_drops;
+    stats[13] = mbstat.m_wait;
+    stats[14] = mbstat.m_drain;
+    
+    return snpack(symon_buf, maxlen, arg, MT_MBUF,
+		  stats[0],
+		  stats[1],
+		  stats[2],
+		  stats[3],
+		  stats[4],
+		  stats[5],
+		  stats[6],
+		  stats[7],
+		  stats[8],
+		  stats[9],
+		  stats[10],
+		  stats[11],
+		  stats[12],
+		  stats[13],
+		  stats[14]);
+}
+#endif /* HAS_KERN_MBSTAT */

+ 1 - 1
symon/symon/sm_pf.c

@@ -1,4 +1,4 @@
-/* $Id: sm_pf.c,v 1.4 2002/11/29 10:48:53 dijkstra Exp $ */
+/* $Id: sm_pf.c,v 1.5 2003/01/26 20:41:00 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2002 Daniel Hartmeier

+ 18 - 12
symon/symon/symon.8

@@ -40,23 +40,26 @@
 .Pp
 .Sh DESCRIPTION
 .Nm
-is a lightweight system monitor that measures cpu, memory, debug, process,
-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
 .Nm
-has been designed to inflict minimal performance and security impact on the system it monitors. 
+has been designed to inflict minimal performance and security impact on
+the system it monitors.
 .Xr symux 8
-has performance impact proportional to the amount of streams it needs to manage. Ideally 
+has performance impact proportional to the amount of streams it needs to
+manage. Ideally
 .Xr symux 
 should live on a different system and collect data from several 
 .Nm
 instances in a LAN. 
 .Lp
 .Nm
-priviledge needs depend on the probes used. The cpu, mem, disk, debug and interface probes will work even when symon runs as 
+priviledge needs depend on the probes used. The cpu, mem, mbuf, disk,
+debug and interface probes will work even when symon runs as
 .Ar "nobody" . 
 For pf, read and write access to 
 .Pa /dev/pf
@@ -83,16 +86,18 @@ instead of
 .Nm
 obtains configuration data from 
 .Pa /etc/symon.conf .
-The configuration file contains monitor stanzas that define what resources should be monitored and to which 
+The configuration file contains monitor stanzas that define what
+resources should be monitored and to which
 .Xr symux 8
 the information should be streamed to.
 .Pp
-Multiple monitor statements to different muxes are allowed. Whitespace, newlines and text behind '#' are ignored. The format in BNF:
+Multiple monitor statements to different muxes are allowed. Whitespace,
+newlines and text behind '#' are ignored. The format in BNF:
 .Pp
 .nf
 monitor-rule = "monitor" "{" resources "}" "stream" ["to"] host [ port ]
 resources    = resource ["(" argument ")"] [ ","|" " resources ]
-resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc"
+resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc" | "mbuf"
 host         = ip4addr | ip6addr | hostname
 port         = [ "port" | "," ] portnumber
 argument     = number | interfacename | diskname
@@ -101,8 +106,8 @@ argument     = number | interfacename | diskname
 Here is an example 
 .Ar symon.conf
 that monitors cpu, memory, pf, interfaces xl0/de0/lo0/wi0, disks
-wd[0-3]/cd[0-1], debug variables debug0 to debug19 and streams that information
-to localhost on port 2100.
+wd[0-3]/cd[0-1], debug variables debug0 to debug19 and streams that
+information to localhost on port 2100.
 .Pp
 .nf
 monitor { cpu(0),  mem, pf, if(xl0), if(de0),
@@ -118,7 +123,8 @@ Causes
 to read 
 .Pa /etc/symon.conf .
 .Nm
-will keep the old configuration if errors occured during parsing of the configuration file.
+will keep the old configuration if errors occured during parsing of the
+configuration file.
 .Sh FILES
 .Bl -tag -width Ds
 .It Pa /var/run/symon.pid

+ 1 - 0
symon/symon/symon.c

@@ -68,6 +68,7 @@ struct funcmap streamfunc[] = {
     {MT_PF, init_pf, NULL, get_pf},
     {MT_DEBUG, init_debug, NULL, get_debug},
     {MT_PROC, init_proc, gets_proc, get_proc},
+    {MT_MBUF, init_mbuf, NULL, get_mbuf},
     {MT_EOT, NULL, NULL}
 };
 

+ 5 - 1
symon/symon/symon.h

@@ -42,7 +42,7 @@
 #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 allocation; local limit per
+#define SYMON_MAX_DOBJECTS  200	/* max dynamic allocation; local limit per
 				 * measurement module */
 #define SYMON_MAX_OBJSIZE  (_POSIX2_LINE_MAX)	/* max allocation unit =
 						 * _POSIX2_LINE_MAX */
@@ -77,6 +77,10 @@ extern int get_io(char *, int, char *);
 extern void init_pf(char *);
 extern int get_pf(char *, int, char *);
 
+/* sm_mbuf.c */
+extern void init_mbuf(char *);
+extern int get_mbuf(char *, int, char *);
+
 /* sm_debug.c */
 extern void init_debug(char *);
 extern int get_debug(char *, int, char *);

+ 1 - 1
symon/symon2web/test_config.php

@@ -4,7 +4,7 @@
  </head>
  <body>
 <?php
-// $Id: test_config.php,v 1.2 2003/01/08 16:02:34 dijkstra Exp $
+// $Id: test_config.php,v 1.3 2003/01/26 20:41:02 dijkstra Exp $
 //
 // Test configuration variables
 require_once('datasources.inc');

+ 2 - 1
symon/symux/Makefile

@@ -22,7 +22,8 @@ install: symux symux.cat8 c_smrrds.sh symux.conf
 	${INSTALL} -c -m 444 -g wheel -o root symux.cat8 ${PREFIX}/${MANDIR}/cat8/symux.0
 	${INSTALL} -d -m 555 -g bin   -o root ${PREFIX}/${SHRDIR}
 	${INSTALL} -c -m 544 -g bin   -o root c_smrrds.sh  ${PREFIX}/${SHRDIR}
-	${INSTALL} -c -m 444 -g bin   -o root symux.conf   ${PREFIX}/${SHRDIR}
+	${INSTALL} -d -m 555 -g bin   -o root ${PREFIX}/${EXADIR}
+	${INSTALL} -c -m 444 -g bin   -o root symux.conf   ${PREFIX}/${EXADIR}
 
 cleanipc:
 	ipcs | egrep "^m" | awk '{print $$2}' | xargs -n1 ipcrm -m &

+ 20 - 3
symon/symux/c_smrrds.sh

@@ -34,6 +34,7 @@
 #       mem      Make memory file
 #       cpu?     Make cpu file
 #       pf       Make pf file
+#       mbuf     Make mbuf file
 
 # --- user configuration starts here
 INTERVAL=`grep SYMON_INTERVAL ../symon/symon.h 2>/dev/null | cut -f3 -d\ `
@@ -119,7 +120,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$|proc_)"` ]; then i=$i.rrd; fi
+if [ `echo $i | egrep -e "^(cpu[0-9]$|mem$|pf$|mbuf$|debug$|proc_)"` ]; then i=$i.rrd; fi
 
 if [ -f $i ]; then
     echo "$i exists - ignoring"
@@ -129,11 +130,12 @@ fi
 case $i in
 
 all)
-    echo "Creating rrd files for {cpu0|mem|disks|interfaces|pf}"
+    echo "Creating rrd files for {cpu0|mem|disks|interfaces|pf|mbuf}"
     sh $this child $config cpu0 mem
     sh $this child $config interfaces
     sh $this child $config disks
     sh $this child $config pf
+    sh $this child $config mbuf
     ;;
 
 if|interfaces)
@@ -232,6 +234,21 @@ pf.rrd)
     echo "$i created"
     ;;
 
+mbuf.rrd)
+    # Build mbuf file
+    rrdtool create $i $RRD_ARGS \
+	DS:totmbufs:GAUGE:5:0:U DS:mt_data:GAUGE:5:0:U \
+	DS:mt_oobdata:GAUGE:5:0:U DS:mt_control:GAUGE:5:0:U \
+	DS:mt_header:GAUGE:5:0:U DS:mt_ftable:GAUGE:5:0:U \
+	DS:mt_soname:GAUGE:5:0:U DS:mt_soopts:GAUGE:5:0:U \
+	DS:pgused:GAUGE:5:0:U DS:pgtotal:GAUGE:5:0:U \
+	DS:totmem:GAUGE:5:0:U DS:totpct:GAUGE:5:0:100 \
+	DS:m_drops:COUNTER:5:0:U DS:m_wait:COUNTER:5:0:U \
+	DS:m_drain:COUNTER:5:0:U \
+	$RRA_SETUP
+    echo "$i created"
+    ;;
+
 io_*.rrd)
     # Build disk files
     rrdtool create $i $RRD_ARGS \
@@ -249,7 +266,7 @@ io_*.rrd)
     # Default match
     cat <<EOF
 Usage: $0 [oneday] all
-       $0 [oneday] cpu0|mem|pf|debug|proc|<if>|<io>
+       $0 [oneday] cpu0|mem|pf|mbuf|debug|proc|<if>|<io>
 
 Where:
 if=	`echo $INTERFACES|

+ 8 - 2
symon/symux/readconf.c

@@ -81,6 +81,10 @@ insert_filename(char *path, int maxlen, int type, char *args)
 	ts = "pf";
 	ta = "";
 	break;
+    case MT_MBUF:
+	ts = "mbuf";
+	ta = "";
+	break;
     case MT_DEBUG:
 	ts = "debug";
 	ta = "";
@@ -183,6 +187,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 		case LXT_IO:
 		case LXT_MEM:
 		case LXT_PF:
+		case LXT_MBUF:
 		case LXT_DEBUG:
 		case LXT_PROC:
 		    st = token2type(l->op);
@@ -216,7 +221,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 			return 0;
 		    }
 
-		    break;	/* LXT_CPU/IF/IO/MEM/PF/DEBUG/PROC */
+		    break;	/* LXT_CPU/IF/IO/MEM/PF/MBUF/DEBUG/PROC */
 		case LXT_COMMA:
 		    break;
 		default:
@@ -309,6 +314,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 	    case LXT_IO:
 	    case LXT_MEM:
 	    case LXT_PF:
+	    case LXT_MBUF:
 	    case LXT_DEBUG:
 	    case LXT_PROC:
 		st = token2type(l->op);
@@ -370,7 +376,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 			stream->file = xstrdup(l->token);
 		    }
 		}
-		break;		/* LXT_CPU/IF/IO/MEM/PF/DEBUG/PROC */
+		break;		/* LXT_CPU/IF/IO/MEM/PF/MBUF/DEBUG/PROC */
 	    default:
 		parse_error(l, "{cpu|mem|if|io|debug|proc}");
 		return 0;

+ 27 - 21
symon/symux/symux.8

@@ -40,32 +40,33 @@
 .Pp
 .Sh DESCRIPTION
 .Xr symon 8
-is a lightweight system monitor that measures cpu, memory, debug, process,
-interface and disk statistics every 5 seconds. This information is then spooled
-to
+is a lightweight system monitor that measures cpu, memory, mbuf, debug,
+process, interface and disk statistics every 5 seconds. This information
+is then spooled to
 .Nm
 for further processing. 
 .Pp
 .Xr symon 8
-has been designed to inflict minimal performance and security impact on the
-system it monitors.
+has been designed to inflict minimal performance and security impact on
+the system it monitors.
 .Nm
 has performance impact proportional to the amount of streams it needs to
-manage. Ideally 
+manage. Ideally
 .Nm 
 should live on a different system and collect data from several
 .Xr symon 8
 instances in a LAN.
 .Nm 
-stores the incoming streams in .rrd files and distributes the information to
-connected listeners. Listeners can connect to
+stores the incoming streams in .rrd files and distributes the
+information to connected listeners. Listeners can connect to
 .Nm
 on a tcp port and receive incoming 
 .Xr symon 8
 transmissions decoded into ascii.
 .Lp
 .Nm
-needs no specific priviledges besides being able to open it's ports and the rrd files. It should be run as
+needs no specific priviledges besides being able to open it's ports and
+the rrd files. It should be run as
 .Ar "nobody" .
 .Lp
 The options:
@@ -85,15 +86,16 @@ instead of
 .Nm
 obtains configuration data from 
 .Pa /etc/symux.conf .
-The configuration file contains one mux stanza that defines on what host address and port
+The configuration file contains one mux stanza that defines on what host
+address and port
 .Nm 
-should listen to for incoming monitored data. There is a source section for
-every host that is to be monitored. The source section defines what data to
-accept and where to write that data to. In the case that a source is of another
-address family than the mux stanza, i.e. source = ipv6 with mux = ipv4, a
-listen port of the sources' family is opened using the unspecified
-address. Whitespace, newlines and text behind '#' are ignored. The format in
-BNF:
+should listen to for incoming monitored data. There is a source section
+for every host that is to be monitored. The source section defines what
+data to accept and where to write that data to. In the case that a
+source is of another address family than the mux stanza, i.e. source =
+ipv6 with mux = ipv4, a listen port of the sources' family is opened
+using the unspecified address. Whitespace, newlines and text behind '#'
+are ignored. The format in BNF:
 .Pp
 .nf
 stmt         = mux-stmt | source-stmt
@@ -104,7 +106,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" | "proc"
+resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc" | "mbuf"
 argument     = number | interfacename | diskname
 datadir-stmt = "datadir" dirname
 write-stmts  = write-stmt [write-stmts]
@@ -129,8 +131,8 @@ statement.
 .Sh EXAMPLE
 Here is an example 
 .Ar symux.conf
-that listens to udp port 2100 on lo0, and accepts cpu, memory, pf, interfaces
-xl0/de0/lo0/wi0, disks wd[0-3]/cd[0-1] streams from a
+that listens to udp port 2100 on lo0, and accepts cpu, memory, pf,
+interfaces xl0/de0/lo0/wi0, disks wd[0-3]/cd[0-1] streams from a
 .Xr symon 8
 on localhost. 
 .Nm
@@ -181,7 +183,7 @@ The format is
 :
 .Va symon-host-ip
 :
-.Va io|if|cpu|mem|pf
+.Va io|if|cpu|mem|pf|mbuf|proc|debug
 :
 .Va stream-argument
 :
@@ -219,6 +221,10 @@ bit unsigned integers.
 .It proc
 Process statistics ( number : uticks : sticks : iticks : cpusec : cpupct :
 procsz : rsssz ).
+.It mbuf
+Mbuf statistics ( totmbufs : mt_data : mt_oobdata : mt_control :
+mt_header : mt_ftable : mt_soname : mt_soopts : pgused : pgtotal :
+totmem : totpct : m_drops : m_wait : m_drain ).
 .El
 .Sh SIGNALS
 .Bl -tag -width Ds