Bladeren bron

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

Wictor Lund 3 jaren geleden
bovenliggende
commit
c54a577c1b
10 gewijzigde bestanden met toevoegingen van 199 en 67 verwijderingen
  1. 14 3
      symon/CHANGELOG
  2. 1 1
      symon/Makefile.inc
  3. 2 1
      symon/lib/lex.c
  4. 16 15
      symon/lib/lex.h
  5. 13 6
      symon/ports/symon/Makefile
  6. 4 0
      symon/symux/.gdbinit
  7. 6 3
      symon/symux/c_smrrds.sh
  8. 127 4
      symon/symux/readconf.c
  9. 14 20
      symon/symux/symux.8
  10. 2 14
      symon/symux/symux.conf

+ 14 - 3
symon/CHANGELOG

@@ -1,11 +1,22 @@
+25/10/2002 - 2.53
+
+   Henning Brauer suggested a datadir statement for symux configuration -
+   added.
+
+   Henning also reported that c_smrrds.sh cannot create vlan10 and
+   up. c_smrrds.sh now has a special case for pseudo-interfaces (bridge, enc,
+   faith, gif, ppp, sppp, strip, tun, vlan)
+
+   Nick Nauwelaerts helped improve dependency definitions in the port Makefile.
+
 18/10/2002 - 2.52
 
    Julien Touche reported that symon/symux do not report initial cfg errors on
    the commandline - fixed.
 
-   Reinhard Sammer, Julien and Henning Brouwer all noticed that the php
-   code needed globals - fixed. Passing by reference at call time resulted in
-   php warnings - fixed.
+   Reinhard Sammer, Julien and Henning Brauer all noticed that the php code
+   needed globals - fixed. Passing by reference at call time resulted in php
+   warnings - fixed.
 
    Henning thought it was nice to see a single machine at a time. Julien wanted
    clickable magnification for individual graphs. Both options can now be

+ 1 - 1
symon/Makefile.inc

@@ -1,6 +1,6 @@
 # $Id: Makefile.inc,v 1.10 2002/10/18 12:29:09 dijkstra Exp $
 
-V=2.52
+V=2.53
 
 AR=	ar
 CC=	cc

+ 2 - 1
symon/lib/lex.c

@@ -1,4 +1,4 @@
-/* $Id: lex.c,v 1.12 2002/09/20 09:38:11 dijkstra Exp $ */
+/* $Id: lex.c,v 1.13 2002/10/25 15:24:31 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -70,6 +70,7 @@ static struct {
     { ":", LXT_COLON },
     { "accept", LXT_ACCEPT },
     { "cpu", LXT_CPU },
+    { "datadir", LXT_DATADIR },
     { "if", LXT_IF },
     { "in", LXT_IN },
     { "io", LXT_IO },

+ 16 - 15
symon/lib/lex.h

@@ -1,4 +1,4 @@
-/* $Id: lex.h,v 1.12 2002/09/14 15:56:18 dijkstra Exp $ */
+/* $Id: lex.h,v 1.13 2002/10/25 15:24:31 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -50,20 +50,21 @@
 #define LXT_COLON      4
 #define LXT_COMMA      5
 #define LXT_CPU        6
-#define LXT_END        7
-#define LXT_IF         8
-#define LXT_IN         9
-#define LXT_IO        10
-#define LXT_MEM       11
-#define LXT_MONITOR   12
-#define LXT_MUX       13
-#define LXT_OPEN      14
-#define LXT_PF        15
-#define LXT_PORT      16
-#define LXT_SOURCE    17
-#define LXT_STREAM    18
-#define LXT_TO        19
-#define LXT_WRITE     20
+#define LXT_DATADIR    7
+#define LXT_END        8
+#define LXT_IF         9
+#define LXT_IN        10
+#define LXT_IO        11
+#define LXT_MEM       12
+#define LXT_MONITOR   13
+#define LXT_MUX       14
+#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
 
 struct lex {
     char *buffer;          /* current line(s) */

+ 13 - 6
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.52
+V=			2.53
 DISTNAME=		symon-${V}
 CATEGORIES=		net sysutils
 NEED_VERSION=		1.502
@@ -21,15 +21,18 @@ SUBPACKAGE?=
 # client only package
 MULTI_PACKAGES+=	-mon
 COMMENT-mon=		"active host monitor"
-MON_DEPENDS=		
+MON_LIBDEPENDS=
+MON_RUNDEPENDS=		
 # gatherer only package
 MULTI_PACKAGES+=	-mux
 COMMENT-mux=		"symon data gatherer"
-MUX_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
+MUX_LIBDEPENDS=		rrd:rrdtool-*:net/rrdtool 
+MUX_RUNDEPENDS=		rrd:rrdtool-*:net/rrdtool 
 # web frontend only package
 MULTI_PACKAGES+=	-web
 COMMENT-web=		"symon web frontend"
-WEB_DEPENDS=		rrd:rrdtool-*:net/rrdtool php:php4->=4.2.3:www/php4/core
+WEB_LIBDEPENDS=
+WEB_RUNDEPENDS=		rrd:rrdtool-*:net/rrdtool php:php4->=4.2.3:www/php4/core
 
 .for i in ${MULTI_PACKAGES}
 FULLPKGNAME${i}=        symon${i}-${V}
@@ -37,12 +40,16 @@ FULLPKGNAME${i}=        symon${i}-${V}
 
 .if defined(PACKAGING) && !empty(SUBPACKAGE)
 MODULE_NAME=            ${SUBPACKAGE:S/-//g}
-LIB_DEPENDS=            ${${MODULE_NAME:U}_DEPENDS}
+LIB_DEPENDS=            ${${MODULE_NAME:U}_LIBDEPENDS}
+RUN_DEPENDS=		${${MODULE_NAME:U}_RUNDEPENDS}
 MESSAGE=                ${PKGDIR}/MESSAGE${SUBPACKAGE}
+.else
+BUILD_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
+RUN_DEPENDS=		rrd:rrdtool-*:net/rrdtool php:php4->=4.2.3:www/php4/core
+LIB_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
 .endif
 
 WRKDIST=		${WRKDIR}/symon
 SUBST_VARS=		V
-BUILD_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
 
 .include <bsd.port.mk>

+ 4 - 0
symon/symux/.gdbinit

@@ -0,0 +1,4 @@
+file symux
+set args -d -f t
+b readconf.c:217
+r

+ 6 - 3
symon/symux/c_smrrds.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: c_smrrds.sh,v 1.12 2002/09/14 15:54:55 dijkstra Exp $
+# $Id: c_smrrds.sh,v 1.13 2002/10/25 15:24:55 dijkstra Exp $
 
 #
 # Copyright (c) 2001-2002 Willem Dijkstra
@@ -59,7 +59,8 @@ RRD_ARGS="--step=$INTERVAL --start=0"
 # --- user configuration ends here
 
 # All interfaces and disks
-INTERFACES="an|awi|be|bge|bm|bridge|cnw|dc|de|ec|ef|eg|el|enc|ep|ex|faith|fea|fpa|fxp|gem|gif|gm|gre|hme|ie|kue|lc|le|lge|lmc|lo|ne|ne|nge|ray|rl|ppp|qe|qec|sf|sis|sk|skc|sl|sm|siop|sppp|ste|stge|strip|ti|tl|tr|tun|tx|txp|vlan|vme|vr|wb|we|wi|wx|xe|xl"
+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"
+VIRTUALINTERFACES="bridge|enc|faith|gif|ppp|sppp|strip|tun|vlan";
 DISKS="sd|cd|ch|rd|raid|ss|uk|vnc|wd"
 
 # addsuffix adds a suffix to each entry of a list (item|item|...)
@@ -81,14 +82,16 @@ fi
 
 DISKS=`addsuffix $DISKS [0-9]`
 INTERFACES=`addsuffix $INTERFACES [0-9]`
+VIRTUALINTERFACES=`addsuffix $VIRTUALINTERFACES \\.\\*`
 
 for i
 do
 # add if_*.rrd if it is an interface
 if [ `echo $i | egrep -e "^($INTERFACES)$"` ]; then i=if_$i.rrd; fi
+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 or mem
+# add .rrd if it is a cpu, mem, or pf
 if [ `echo $i | egrep -e "^(cpu[0-9]|mem|pf)$"` ]; then i=$i.rrd; fi
 
 if [ -f $i ]; then

+ 127 - 4
symon/symux/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.14 2002/10/18 12:30:48 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.15 2002/10/25 15:25:07 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -31,6 +31,8 @@
  */
 
 #include <sys/queue.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -49,8 +51,49 @@
 __BEGIN_DECLS
 int read_mux(struct muxlist *mul, struct lex *);
 int read_source(struct sourcelist *sol, struct lex *);
+int insert_filename(char *, int, int, char *);
 __END_DECLS
 
+int 
+insert_filename(char *path, int maxlen, int type, char *args) 
+{
+    char *ts;
+    char *ta;
+
+    ts = ta = NULL;
+
+    switch(type) {
+    case MT_CPU:
+	ts = "cpu";
+	ta = args;
+	break;
+    case MT_IF:
+	ts = "if_";
+	ta = args;
+	break;
+    case MT_IO:
+	ts = "io_";
+	ta = args;
+	break;
+    case MT_MEM:
+	ts = "mem";
+	ta = "";
+	break;
+    case MT_PF:
+	ts = "pf";
+	ta = "";
+	break;
+    default:
+	warning("%s:%d: internal error: type (%d) unknown",
+		__FILE__, __LINE__, type);
+	return 0;
+    }
+    
+    if ((snprintf(path, maxlen, "/%s%s.rrd", ts, ta)) >= maxlen) 
+	return 0;
+    else
+	return 1;
+}
 /* mux <host> (port|:|,| ) <number> */
 int 
 read_mux(struct muxlist *mul, struct lex *l)
@@ -94,15 +137,19 @@ read_mux(struct muxlist *mul, struct lex *l)
 
     return 1;
 }
-/* source <host> { accept ... | write ... } */
+/* source <host> { accept ... | write ... | datadir ... } */
 int 
 read_source(struct sourcelist *sol, struct lex *l)
 {
     struct source *source;
     struct stream *stream;
+    struct stat sb;
+    char path[_POSIX2_LINE_MAX];
     char sn[_POSIX2_LINE_MAX];
     char sa[_POSIX2_LINE_MAX];
-    int  st;
+    int st;
+    int pc;
+    int fd;
 
     /* get hostname */
     lex_nexttoken(l);
@@ -169,6 +216,76 @@ read_source(struct sourcelist *sol, struct lex *l)
 		}
 	    }
 	    break; /* LXT_ACCEPT */
+	    /* datadir "path" */
+	case LXT_DATADIR:
+	    lex_nexttoken(l);
+	    /* is path absolute */
+	    if (l->token && l->token[0] != '/') {
+		warning("%s:%d: datadir path '%s' is not absolute",
+			l->filename, l->cline, l->token);
+		return 0;
+	    }
+
+	    /* make sure that directory exists */
+	    bzero(&sb, sizeof(struct stat));
+
+	    if (stat(l->token, &sb) == 0) {
+		if (! (sb.st_mode & S_IFDIR)) {
+		    warning("%s:%d: datadir path '%s' is not a directory",
+			    l->filename, l->cline, l->token);
+		    return 0;
+		}
+	    } else {
+		warning("%s:%d: could not stat datadir path '%s'",
+			l->filename, l->cline, l->token);
+		return 0;
+	    }
+
+	    strncpy(&path[0], l->token, _POSIX2_LINE_MAX);
+	    path[_POSIX2_LINE_MAX-1] = '\0';
+	    
+	    pc = strlen(path);
+	    
+	    if (path[pc-1] == '/') {
+		path[pc-1] = '\0';
+		pc--;
+	    }
+	    
+	    /* add path to empty streams */
+	    SLIST_FOREACH(stream, &source->sl, streams) {
+		if (stream->file == NULL) {
+		    if (!(insert_filename(&path[pc], 
+					  _POSIX2_LINE_MAX - pc, 
+					  stream->type, 
+					  stream->args))) {
+			if (stream->args && strlen(stream->args)) {
+			    warning("%s:%d: failed to construct stream "
+				    "%s(%s) filename using datadir '%s'",
+				    l->filename, l->cline, 
+				    type2str(stream->type), 
+				    stream->args, l->token);
+			} else {
+			    warning("%s:%d: failed to construct stream "
+				    "%s) filename using datadir '%s'",
+				    l->filename, l->cline, 
+				    type2str(stream->type), 
+				    l->token);
+			}
+			return 0;
+		    }
+		    
+		    /* try filename */
+		    if ((fd = open(path, O_RDWR | O_NONBLOCK, 0)) == -1) {
+			warning("%s:%d: file '%s', guessed by datadir,  cannot be opened", 
+				l->filename, l->cline, path);
+			return 0;
+		    } else {
+			close(fd);
+			stream->file = xstrdup(path);
+		    }
+		}
+	    }
+	    break; /* LXT_DATADIR */
 	    /* write cpu(0) in "filename" */
 	case LXT_WRITE:
 	    lex_nexttoken(l);
@@ -216,7 +333,6 @@ read_source(struct sourcelist *sol, struct lex *l)
 			return 0;
 		    }
 		} else {
-		    int fd;
 		    /* try filename */
 		    if ((fd = open(l->token, O_RDWR | O_NONBLOCK, 0)) == -1) {
 			warning("%s:%d: file '%s' cannot be opened", 
@@ -224,6 +340,13 @@ read_source(struct sourcelist *sol, struct lex *l)
 			return 0;
 		    } else {
 			close(fd);
+
+			if (stream->file != NULL) {
+			    warning("%s:%d: file '%s' overwrites previous definition '%s'",
+				    l->filename, l->cline, l->token, stream->file);
+			    xfree(stream->file);
+			}
+
 			stream->file = xstrdup(l->token);
 		    }
 		}

+ 14 - 20
symon/symux/symux.8

@@ -88,31 +88,40 @@ The configuration file contains one mux stanza that defines on what interface an
 .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. Whitespace, newlines and text behind '#' are ignored. The format in BNF:
+accept and where to write that data to. Whitespace, newlines and text behind
+'#' are ignored. The format in BNF:
 .Pp
 .nf
 stmt         = mux-stmt | source-stmt
 mux-stmt     = "mux" host [ port ]
 host         = ip4addr | hostname
 port         = [ "port" | ":" | "," ] portnumber
-source-stmt  = "source" host "{" accept-stmts write-stmts "}"
+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"
 argument     = number | interfacename | diskname
+datadir-stmt = "datadir" dirname
 write-stmts  = write-stmt [write-stmts]
 write-stmt   = "write" resource "in" filename
 .fi
 .Pp
 Note that 
-.Va port 
+.Bl -tag -width Ds
+.It Va port
 in the 
 .Va mux-stmt
 specifies the port-number for both the udp port (incoming 
 .Xr symon 8
 traffic) and the tcp port for incoming listeners.
-
+.It Va datadir
+will guess filenames for all 
+accepted streams. 
+.Va write
+statements always take precendence over a
+.Va datadir
+statement. 
 .Sh EXAMPLE
 Here is an example 
 .Ar symux.conf
@@ -132,22 +141,7 @@ source 127.0.0.1 {
              io(wd0), io(wd1), io(wd2), 
              io(wd3), io(cd0), io(cd1) }
 
-    write cpu(0)   in "/export/symon/localhost/cpu0.rrd"
-    write mem      in "/export/symon/localhost/mem.rrd"
-    write pf       in "/export/symon/localhost/pf.rrd"
-
-    write if(xl0)  in "/export/symon/localhost/if_xl0.rrd"
-    write if(de0)  in "/export/symon/localhost/if_de0.rrd"
-    write if(lo0)  in "/export/symon/localhost/if_lo0.rrd"
-    write if(wi0)  in "/export/symon/localhost/if_wi0.rrd"
-
-    write io(wd0)  in "/export/symon/localhost/io_wd0.rrd"
-    write io(wd1)  in "/export/symon/localhost/io_wd1.rrd"
-    write io(wd2)  in "/export/symon/localhost/io_wd2.rrd"
-    write io(wd3)  in "/export/symon/localhost/io_wd3.rrd"
-
-    write io(cd0)  in "/export/symon/localhost/io_cd0.rrd"
-    write io(cd1)  in "/export/symon/localhost/io_cd1.rrd"
+    datadir "/export/symon/localhost"
 }
 .fi
 .Sh LISTENERS

+ 2 - 14
symon/symux/symux.conf

@@ -1,5 +1,5 @@
 #
-# $Id: symux.conf,v 1.18 2002/10/18 12:30:48 dijkstra Exp $
+# $Id: symux.conf,v 1.19 2002/10/25 15:25:08 dijkstra Exp $
 #
 # Demo symux configuration. See symux(8) for BNF.
 
@@ -10,19 +10,7 @@ source 10.0.0.1 {
 	         if(lo0), io(wd0), io(wd1), 
                  io(wd2), io(wd3), io(cd0)}
 
-	write cpu(0)   in "/export/symon/www/cpu0.rrd"
-	write mem      in "/export/symon/www/mem.rrd"
-
-	write if(xl0)  in "/export/symon/www/if_xl0.rrd"
-	write if(de0)  in "/export/symon/www/if_de0.rrd"
-	write if(lo0)  in "/export/symon/www/if_lo0.rrd"
-	
-	write io(wd0)  in "/export/symon/www/io_wd0.rrd"
-	write io(wd1)  in "/export/symon/www/io_wd1.rrd"
-	write io(wd2)  in "/export/symon/www/io_wd2.rrd"
-	write io(wd3)  in "/export/symon/www/io_wd3.rrd"
-
-	write io(cd0)  in "/export/symon/www/io_cd0.rrd"
+	datadir "/export/symon/www"
 }
 
 source 10.0.0.2 {