Browse Source

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

Wictor Lund 3 years ago
parent
commit
981349cb1c

+ 10 - 1
symon/CHANGELOG

@@ -1,3 +1,12 @@
+05/06/2004 - 2.66
+
+   - arguments in network streams are now bound to 15 characters. symon
+     will use more characters if specified in monitoring, but will only
+     send the first 15 over the network. (Michael)
+
+   - Textual: symux.8 and c_smrrds.sh agree on stream names.
+     (Okan Demirmen)
+
 29/02/2004 - 2.65
 
    - removed erroneous strlen in lex.c (Daniel Hartmeier)
@@ -333,4 +342,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.29 2004/02/29 21:23:18 dijkstra Exp $
+$Id: CHANGELOG,v 1.31 2004/06/05 12:08:53 dijkstra Exp $

+ 2 - 2
symon/Makefile.inc

@@ -1,6 +1,6 @@
-# $Id: Makefile.inc,v 1.22 2004/02/29 21:23:19 dijkstra Exp $
+# $Id: Makefile.inc,v 1.23 2004/06/05 12:08:53 dijkstra Exp $
 
-V=2.65
+V=2.66
 
 AR=	ar
 CC=	cc

+ 19 - 15
symon/lib/data.c

@@ -1,4 +1,4 @@
-/* $Id: data.c,v 1.24 2004/02/26 22:48:08 dijkstra Exp $ */
+/* $Id: data.c,v 1.25 2004/03/20 15:46:27 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Willem Dijkstra
@@ -35,11 +35,12 @@
 /* Terminology:
  *
  * A host carrying a 'symon' is considered a 'source' of information. A single
- * data 'stream' of information has a particular type: <cpu|mem|if|io>. A
- * source can provide multiple 'streams' simultaniously. A source spools
+ * data 'stream' of information has a particular type: cpu, mem, etc. A
+ * source can provide multiple 'streams' simultaneously. A source spools
  * information towards a 'mux'. A 'stream' that has been converted to network
  * representation is called a 'packedstream'.
  */
+#include <sys/param.h>
 #include <assert.h>
 #include <limits.h>
 #include <stdarg.h>
@@ -311,6 +312,7 @@ snpack(char *buf, int maxlen, char *id, int type,...)
     double D;
     int i = 0;
     int offset = 0;
+    int arglen = 0;
 
     if (type > MT_EOT) {
 	warning("stream type (%d) out of range", type);
@@ -324,18 +326,21 @@ snpack(char *buf, int maxlen, char *id, int type,...)
     }
 
     if (id) {
-	if ((strlen(id) + 1) >= maxlen) {
-	    return 0;
-	} else {
-	    strncpy(&buf[offset], id, maxlen - 1);
-	    offset += strlen(id);
-	}
+	arglen = MIN(strlen(id), SYMON_PS_ARGLEN - 1);
+    } else {
+	id = "\0";
+	arglen = 1;
+    }
+
+    if (checklen(maxlen, offset, arglen)) {
+	return offset;
+    } else {
+	strncpy(&buf[offset], id, arglen);
+	offset += arglen + 1;
     }
-    buf[offset++] = '\0';
 
     va_start(ap, type);
     while (streamform[type].form[i] != '\0') {
-	/* check for buffer overflow */
 	if (checklen(maxlen, offset, bytelenvar(streamform[type].form[i])))
 	    return offset;
 
@@ -343,7 +348,7 @@ snpack(char *buf, int maxlen, char *id, int type,...)
 	 * all values smaller than 32 bytes are transferred using ints on the
 	 * stack. This is to ensure that we get the correct value, if the
 	 * compiler decided to upgrade our short to a 32bit int. -- cheers
-	 * dhartmei@
+	 * dhartmei@openbsd.org
 	 */
 	switch (streamform[type].form[i]) {
 	case 'b':
@@ -434,13 +439,12 @@ sunpack(char *buf, struct packedstream * ps)
     if ((*in) != '\0') {
 	strncpy(ps->args, in, sizeof(ps->args));
 	ps->args[sizeof(ps->args) - 1] = '\0';
-	in += strlen(ps->args);
+	in += strlen(ps->args) + 1;
     } else {
 	ps->args[0] = '\0';
+	in++;
     }
 
-    in++;
-
     out = (char *) (&ps->data);
 
     while (streamform[type].form[i] != '\0') {

+ 4 - 5
symon/lib/data.h

@@ -1,4 +1,4 @@
-/* $Id: data.h,v 1.24 2004/02/26 22:48:08 dijkstra Exp $ */
+/* $Id: data.h,v 1.25 2004/03/20 15:46:27 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Willem Dijkstra
@@ -157,12 +157,11 @@ SLIST_HEAD(muxlist, mux);
 /*
  * Unpacking of incoming packets is done via a packedstream structure. This
  * structure defines the maximum amount of data that can be contained in a
- * single network representation of a stream. It is used internally for sizing
- * only and regression testing only. Although the union members are here, they
- * could also read u_int64_t[4] with io, for instance.
+ * single network representation of a stream.
  */
 #define SYMON_UNKMUX   "<unknown mux>"	/* mux nodes without host addr */
-#define SYMON_PS_ARGLEN    16	/* maximum argument length */
+#define SYMON_PS_ARGLEN        16	/* maximum argument length */
+#define SYMON_PS_ARGLENSTR    "15"	/* maximum number of chars in an argument, as str */
 struct packedstream {
     int type;
     int padding;

+ 1 - 1
symon/ports/symon/Makefile

@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.10 2004/02/16 20:09:03 sturm Exp $
 
 COMMENT=		"active monitoring tool"
-V=			2.65
+V=			2.66
 DISTNAME=		symon-${V}
 CATEGORIES=		sysutils net
 

+ 7 - 1
symon/symon/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.19 2004/02/26 22:48:08 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.20 2004/03/20 15:46:27 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Willem Dijkstra
@@ -131,6 +131,12 @@ read_symon_args(struct mux * mux, struct lex * l)
 		sa[0] = '\0';
 	    }
 
+	    if (strlen(sa) > (SYMON_PS_ARGLEN - 1)) {
+		warning("%.200s:%d: argument '%.200s' too long for network format, "
+			"will send leading " SYMON_PS_ARGLENSTR " chars only",
+			l->filename, l->cline, sa);
+	    }
+
 	    if ((add_mux_stream(mux, st, sa)) == NULL) {
 		warning("%.200s:%d: stream %.200s(%.200s) redefined",
 			l->filename, l->cline, sn, sa);

+ 9 - 2
symon/symux/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.23 2004/02/26 22:48:08 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.25 2004/06/05 12:08:53 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Willem Dijkstra
@@ -223,6 +223,13 @@ read_source(struct sourcelist * sol, struct lex * l)
 			sa[0] = '\0';
 		    }
 
+		    if (strlen(sa) > (SYMON_PS_ARGLEN - 1)) {
+			warning("%.200s:%d: argument '%.200s' too long for network format, "
+				"will accept initial " SYMON_PS_ARGLENSTR " chars only",
+				l->filename, l->cline, sa);
+			sa[SYMON_PS_ARGLEN-1]='\0';
+		    }
+
 		    if ((stream = add_source_stream(source, st, sa)) == NULL) {
 			warning("%.200s:%d: stream %.200s(%.200s) redefined",
 				l->filename, l->cline, sn, sa);
@@ -389,7 +396,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 	case LXT_END:
 	    return 1;
 	default:
-	    parse_error(l, "accept|write");
+	    parse_error(l, "accept|datadir|write");
 	    return 0;
 	}
     }

+ 2 - 2
symon/symux/symux.8

@@ -106,7 +106,7 @@ host         = ip4addr | ip6addr | hostname
 port         = [ "port" | "," ] portnumber
 source-stmt  = "source" host "{"
                accept-stmts
-               write-stmts
+               [ write-stmts ]
                [ datadir-stmt ] "}"
 accept-stmts = accept-stmt [accept-stmts]
 accept-stmt  = "accept" "{" resources "}"
@@ -223,7 +223,7 @@ Alias for io2. See below.
 Pre OpenBSD 3.5 io/disk counters ( total_transfers, total_seeks, total_bytes
 ). Values are 64 bit unsigned integers.
 .It io2
-Io/disk counters ( total_rxfers, total_wxfers, total_seeks, total_rbytes,
+Io/disk counters ( total_rxfer, total_wxfer, total_seeks, total_rbytes,
 total_wbytes). Values are 64 bit unsigned integers.
 .It pf
 Packet filter statistics ( bytes_v4_in : bytes_v4_out : bytes_v6_in :

+ 3 - 8
symon/symux/symux.c

@@ -1,4 +1,4 @@
-/* $Id: symux.c,v 1.30 2004/02/26 22:48:08 dijkstra Exp $ */
+/* $Id: symux.c,v 1.31 2004/03/20 15:46:27 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2004 Willem Dijkstra
@@ -252,13 +252,8 @@ main(int argc, char *argv[])
 		stream = find_source_stream(source, ps.type, ps.args);
 
 		if (stream != NULL) {
-		    /* put type in and hide from rrd */
-		    snprintf(stringptr, maxstringlen, "%s:", type2str(ps.type));
-		    maxstringlen -= strlen(stringptr);
-		    stringptr += strlen(stringptr);
-		    /* put arguments in and hide from rrd */
-		    snprintf(stringptr, maxstringlen, "%s:",
-			     ((ps.args == NULL) ? "0" : ps.args));
+		    /* put type and args in and hide from rrd */
+		    snprintf(stringptr, maxstringlen, "%s:%s:", type2str(ps.type), ps.args);
 		    maxstringlen -= strlen(stringptr);
 		    stringptr += strlen(stringptr);
 		    /* put timestamp in and show to rrd */