فهرست منبع

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

Wictor Lund 3 سال پیش
والد
کامیت
e2df478f12
63فایلهای تغییر یافته به همراه352 افزوده شده و 2088 حذف شده
  1. 22 4
      symon/CHANGELOG
  2. 9 39
      symon/INSTALL
  3. 2 3
      symon/Makefile
  4. 2 2
      symon/Makefile.inc
  5. 3 8
      symon/TODO
  6. 3 2
      symon/client/SymuxClient.pm
  7. 45 12
      symon/lib/data.c
  8. 17 4
      symon/lib/data.h
  9. 3 2
      symon/lib/lex.c
  10. 8 7
      symon/lib/lex.h
  11. 4 9
      symon/ports/symon/Makefile
  12. 3 0
      symon/ports/symon/distinfo
  13. 1 1
      symon/ports/symon/pkg/DEINSTALL
  14. 1 1
      symon/ports/symon/pkg/DEINSTALL-mon
  15. 0 1
      symon/ports/symon/pkg/DESCR
  16. 0 6
      symon/ports/symon/pkg/DESCR-web
  17. 2 2
      symon/ports/symon/pkg/INSTALL
  18. 2 2
      symon/ports/symon/pkg/INSTALL-mon
  19. 1 1
      symon/ports/symon/pkg/MESSAGE
  20. 1 1
      symon/ports/symon/pkg/MESSAGE-mon
  21. 1 1
      symon/ports/symon/pkg/MESSAGE-mux
  22. 0 8
      symon/ports/symon/pkg/MESSAGE-web
  23. 2 24
      symon/ports/symon/pkg/PLIST
  24. 2 3
      symon/ports/symon/pkg/PLIST-mon
  25. 1 2
      symon/ports/symon/pkg/PLIST-mux
  26. 0 23
      symon/ports/symon/pkg/PLIST-web
  27. 8 4
      symon/symon/Makefile
  28. 1 1
      symon/symon/c_config.sh
  29. 4 3
      symon/symon/readconf.c
  30. 5 5
      symon/symon/sm_cpu.c
  31. 1 1
      symon/symon/sm_io.c
  32. 1 1
      symon/symon/sm_mbuf.c
  33. 118 0
      symon/symon/sm_sensor.c
  34. 2 1
      symon/symon/symon.8
  35. 36 21
      symon/symon/symon.c
  36. 12 5
      symon/symon/symon.h
  37. 0 29
      symon/symon2web/Makefile
  38. 0 75
      symon/symon2web/class_cpu.inc
  39. 0 158
      symon/symon2web/class_debug.inc
  40. 0 233
      symon/symon2web/class_graph.inc
  41. 0 212
      symon/symon2web/class_if.inc
  42. 0 56
      symon/symon2web/class_io.inc
  43. 0 76
      symon/symon2web/class_mem.inc
  44. 0 240
      symon/symon2web/class_pf.inc
  45. 0 87
      symon/symon2web/class_proc.inc
  46. 0 17
      symon/symon2web/datasources.inc
  47. 0 8
      symon/symon2web/graph_cpu.php
  48. 0 8
      symon/symon2web/graph_debug.php
  49. 0 8
      symon/symon2web/graph_if.php
  50. 0 8
      symon/symon2web/graph_io.php
  51. 0 8
      symon/symon2web/graph_mem.php
  52. 0 8
      symon/symon2web/graph_pf.php
  53. 0 8
      symon/symon2web/graph_proc.php
  54. 0 294
      symon/symon2web/index.php
  55. BIN
      symon/symon2web/spacer.png
  56. 0 255
      symon/symon2web/symon.css
  57. BIN
      symon/symon2web/symon.png
  58. 0 78
      symon/symon2web/test_config.php
  59. 1 1
      symon/symux/Makefile
  60. 11 3
      symon/symux/c_smrrds.sh
  61. 10 5
      symon/symux/readconf.c
  62. 2 2
      symon/symux/share.c
  63. 5 1
      symon/symux/symux.8

+ 22 - 4
symon/CHANGELOG

@@ -1,3 +1,21 @@
+03/10/2003 - 2.61
+
+   - added sensor probe
+
+   - removed symon2web from base source package. symon2web (or the new syweb
+     package) can be downloaded from the main website. 
+
+   - symux churnbuffer calculation now deals with ipv6 hostnames too
+
+   - symux now allows file-less streams to be accepted
+
+   - removed bug in display of incoming client connections on symux
+
+   - symon uses group probes only for configured streams
+
+   - c_config.sh was not included in the PLIST for the symon package 
+     (Andrew Dalgleish)
+
 23/03/2003 - 2.60
 23/03/2003 - 2.60
 
 
    - sm_io was broken on sparc64
    - sm_io was broken on sparc64
@@ -52,8 +70,8 @@
 
 
    Overhauled the networking code. Everything is now ip6 aware. This
    Overhauled the networking code. Everything is now ip6 aware. This
    does mean that the ':' is no longer a keyword in the lexer;
    does mean that the ':' is no longer a keyword in the lexer;
-   i.e. '<host>:<port>' statements should now be written as '<host>
-   <port>' or '<host> port <port>'.
+   i.e. 'host:port' statements should now be written as 'host
+   port' or 'host "port" port'.
 
 
    Added the debug module. This can be used to retrieve debug0
    Added the debug module. This can be used to retrieve debug0
    ... debug19 variables from the kernel.
    ... debug19 variables from the kernel.
@@ -109,7 +127,7 @@
    Someone at www.deadly.org pointed out that symon is no longer
    Someone at www.deadly.org pointed out that symon is no longer
    compatible with OpenBSD 3.0 - removed claim from the website.
    compatible with OpenBSD 3.0 - removed claim from the website.
 
 
-   Added -f <file> switch to symon.
+   Added -f file switch to symon.
 
 
    The lexer started parsing from character position 1 instead of 0.
    The lexer started parsing from character position 1 instead of 0.
 
 
@@ -272,4 +290,4 @@
 29/09/2001 - Lexer had trouble dealing with ip-addresses. Cleaned up the number	
 29/09/2001 - Lexer had trouble dealing with ip-addresses. Cleaned up the number	
              parsing code and removed a second comment reader.
              parsing code and removed a second comment reader.
 
 
-$Id: CHANGELOG,v 1.17 2003/01/26 20:40:46 dijkstra Exp $
+$Id: CHANGELOG,v 1.19 2003/09/22 10:58:59 dijkstra Exp $

+ 9 - 39
symon/INSTALL

@@ -6,12 +6,8 @@ Priviledges
 symux needs read and write access to it's rrdfiles.
 symux needs read and write access to it's rrdfiles.
 
 
 monitoring needs:
 monitoring needs:
-cpu, if, mem, io, debug, proc  - symon can run as nobody
-pf                             - symon needs r/w on /dev/pf
-
-symon2web is a php4 application and needs access to the rrdfiles. Note that
-symon2web interprets the url for graphing parameters. It should never be exposed
-to untrusted users | the outside world.
+cpu, debug, if, io, mbuf, mem, proc, sensor - symon can run as nobody
+pf                                          - symon needs r/w on /dev/pf
 
 
 Real quick 
 Real quick 
 ==========
 ==========
@@ -24,16 +20,14 @@ or grab the port and do
 make package
 make package
 pkg_add symon-mon-version.tgz on all monitored hosts
 pkg_add symon-mon-version.tgz on all monitored hosts
 pkg_add symon-mux-version.tgz on the loghost
 pkg_add symon-mux-version.tgz on the loghost
-pkg_add symon-web-version.tgz on the loghost
+
+Install the seperate syweb package to show the data stored in the rrd files.
 
 
 Less quick, but more verbose
 Less quick, but more verbose
 ============================
 ============================
 - Install rrdtool where you want to run the gatherer. 
 - Install rrdtool where you want to run the gatherer. 
 	cd /usr/ports/net/rrdtool && make install
 	cd /usr/ports/net/rrdtool && make install
 
 
-- Install php4 where you want to run the web frontend. 
-	cd /usr/ports/www/php4 && make install
-
 - Building by hand: Check Makefile.inc for settings. Things to watch out for
 - Building by hand: Check Makefile.inc for settings. Things to watch out for
   are:
   are:
 
 
@@ -58,44 +52,20 @@ Less quick, but more verbose
 	cd /usr/ports/packages/$ARCH/All/
 	cd /usr/ports/packages/$ARCH/All/
 	pkg_add symon-mon-version.tgz               on monitored hosts
 	pkg_add symon-mon-version.tgz               on monitored hosts
 	pkg_add symon-mux-version.tgz               on the loghost | gatherer
 	pkg_add symon-mux-version.tgz               on the loghost | gatherer
-	pkg_add symon-web-version.tgz               on the loghost | webfrontend
 
 
 - Create an '/etc/symon.conf'. Note that there is an example configuration in
 - Create an '/etc/symon.conf'. Note that there is an example configuration in
   $PREFIX/$SHRDIR. 
   $PREFIX/$SHRDIR. 
 
 
 - Create a symux.conf on the gatherer host. You can specify alternative
 - Create a symux.conf on the gatherer host. You can specify alternative
-  locations than '/etc/symux.conf' using 'symux -f <symux.conf>'.
+  locations than '/etc/symux.conf' using 'symux -f symux.conf'.
 
 
 - Create the rrd files where the incoming symon data is to be
 - Create the rrd files where the incoming symon data is to be
-  stored. $PREFIX/$SHRDIR/c_smrrds.sh is your friend. Note that 'symon2web'
-  expects an '.../machine/*.rrd' style directory structure.
+  stored. $PREFIX/$SHRDIR/c_smrrds.sh is your friend. Note that syweb expects
+  an '.../machine/*.rrd' style directory structure somewhere under /var/www.
 
 
 - Fire up symon, symux. Check system logs for any failures.
 - Fire up symon, symux. Check system logs for any failures.
 
 
-- Only if you need the webinterface: symon2web is installed in
-  $PREFIX/$SHRDIR/. Copy the files to a convenient apache directory and modify
-  the symon2web/datasources.inc to reflect your filelocations. datasources.inc
-  also contains some settings on how the data is displayed.
-
-  symon2web runs 'rrdtool' to generate graphs as requests for pictures come
-  in. As of OpenBSD 3.2 apache is chrooted at /var/www. The easiest way around
-  this is to break the chroot. You were not planning of running this software
-  on a machine tied to the internet anyway.
-
-     + $symon2web["view"] = show all graphs for all machines ('all') or show
-       only graphs for a single selected machine ('one').
-
-     + $symon2web["magnify"] = to which format should the graph be magnified if
-       clicked on. Values are:
-          '' for no magnification, 
-          'tiny'   =  100 x  75, 
-          'small'  =  200 x 125,
-          'normal' =  300 x 225, 
-          'big'    =  600 x 450, 
-          'huge'   = 1024 x 640.
-
-     + test your setup with test_config.php - this will try to run rrdtool and
-       see if your rrd files are accessable by symon2web.
+- Only if you need the webinterface: download and install syweb. 
 
 
 Getting measurements without the web
 Getting measurements without the web
 ====================================
 ====================================
@@ -118,7 +88,7 @@ This package is an OpenBSD application. You might be able to make symux and
 symon2web run on POSIX compliant unixes, but the monitoring application itself
 symon2web run on POSIX compliant unixes, but the monitoring application itself
 (symon) is OpenBSD specific.
 (symon) is OpenBSD specific.
 
 
-Willem Dijkstra <wpd@xs4all.nl>
+Willem Dijkstra - wpd@xs4all.nl
 
 
 $Id: INSTALL,v 1.10 2003/01/08 16:04:40 dijkstra Exp $
 $Id: INSTALL,v 1.10 2003/01/08 16:04:40 dijkstra Exp $
 
 

+ 2 - 3
symon/Makefile

@@ -1,6 +1,6 @@
 # $Id: Makefile,v 1.11 2003/01/18 09:55:31 dijkstra Exp $
 # $Id: Makefile,v 1.11 2003/01/18 09:55:31 dijkstra Exp $
 
 
-SUBDIR=	lib symon symux symon2web client
+SUBDIR=	lib symon symux client
 
 
 .if make(clean)
 .if make(clean)
 SUBDIR+= ports/symon
 SUBDIR+= ports/symon
@@ -12,7 +12,6 @@ all: _SUBDIRUSE
 clean: _SUBDIRUSE
 clean: _SUBDIRUSE
 install: _SUBDIRUSE
 install: _SUBDIRUSE
 
 
-# Not all the stuff that I'm working on is ready for release
 dist: clean
 dist: clean
 	@workdir=`basename ${.CURDIR}`; \
 	@workdir=`basename ${.CURDIR}`; \
 	cd ports/symon; \
 	cd ports/symon; \
@@ -20,7 +19,7 @@ dist: clean
 	${MAKE} clean; \
 	${MAKE} clean; \
 	cd ../../..; \
 	cd ../../..; \
 	echo Exporting symon-${V}.tar.gz; \
 	echo Exporting symon-${V}.tar.gz; \
-	find $${workdir} -type f -print | egrep -v 'CVS|doc|README|regress|#'| \
+	find $${workdir} -type f -print | egrep -v 'CVS|README|regress|#'| \
 		tar -czvf /tmp/symon-${V}.tar.gz -I -; \
 		tar -czvf /tmp/symon-${V}.tar.gz -I -; \
 	cp /tmp/symon-${V}.tar.gz /usr/ports/distfiles/; \
 	cp /tmp/symon-${V}.tar.gz /usr/ports/distfiles/; \
 	cd $${workdir}/ports/symon; \
 	cd $${workdir}/ports/symon; \

+ 2 - 2
symon/Makefile.inc

@@ -1,6 +1,6 @@
-# $Id: Makefile.inc,v 1.15 2003/01/24 13:33:50 dijkstra Exp $
+# $Id: Makefile.inc,v 1.16 2003/06/20 08:41:00 dijkstra Exp $
 
 
-V=2.60
+V=2.61
 
 
 AR=	ar
 AR=	ar
 CC=	cc
 CC=	cc

+ 3 - 8
symon/TODO

@@ -1,18 +1,13 @@
 TODO:
 TODO:
 
 
 == current problems / short term
 == 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 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
 - remove mon packet limit
 - remove mon packet limit
+- check shared memory for hackable bugs. (master should only write, clients
+  should only read. clients should check incoming data for sanity.)
 
 
 == longer term
 == longer term
 - change rrd to accommodate batch updates
 - change rrd to accommodate batch updates
 - write a muxer that supports unix pipes
 - write a muxer that supports unix pipes
-- write a client that drives a crystal fontz lcd
 
 
-$Id: TODO,v 1.23 2002/12/29 16:23:40 dijkstra Exp $
+$Id: TODO,v 1.24 2003/06/20 08:41:00 dijkstra Exp $

+ 3 - 2
symon/client/SymuxClient.pm

@@ -1,4 +1,4 @@
-# $Id: SymuxClient.pm,v 1.4 2002/12/29 16:21:31 dijkstra Exp $
+# $Id: SymuxClient.pm,v 1.5 2003/06/20 08:41:03 dijkstra Exp $
 #
 #
 # Copyright (c) 2001-2002 Willem Dijkstra
 # Copyright (c) 2001-2002 Willem Dijkstra
 # All rights reserved.
 # All rights reserved.
@@ -62,7 +62,8 @@ my $streamitem =
      mbuf => {totmbufs => 1, mt_data => 2, mt_oobdata => 3, mt_control => 4,
      mbuf => {totmbufs => 1, mt_data => 2, mt_oobdata => 3, mt_control => 4,
 	      mt_header => 5, mt_ftable => 6, mt_soname => 7, mt_soopts => 8,
 	      mt_header => 5, mt_ftable => 6, mt_soname => 7, mt_soopts => 8,
 	      pgused => 9, pgtotal => 10, totmem => 11, totpct => 12, 
 	      pgused => 9, pgtotal => 10, totmem => 11, totpct => 12, 
-	      m_drops => 13, m_wait => 14, m_drain => 15 }};
+	      m_drops => 13, m_wait => 14, m_drain => 15 },
+     sensor => {value => 1}};
 sub new {
 sub new {
     my ($class, %arg) = @_;
     my ($class, %arg) = @_;
     my $self;
     my $self;

+ 45 - 12
symon/lib/data.c

@@ -1,4 +1,4 @@
-/* $Id: data.c,v 1.19 2002/12/15 15:00:01 dijkstra Exp $ */
+/* $Id: data.c,v 1.20 2003/06/20 08:41:07 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -68,6 +68,7 @@ __END_DECLS
  * Format specifications are strings of characters:
  * Format specifications are strings of characters:
  *
  *
  * L = u_int64
  * L = u_int64
+ * D = 7.6f <= int64
  * l = u_int32
  * l = u_int32
  * s = u_int16
  * s = u_int16
  * c = 3.2f <= u_int14 <= u_int16  (used in percentages)
  * c = 3.2f <= u_int14 <= u_int16  (used in percentages)
@@ -82,6 +83,7 @@ struct {
     u_int64_t max;
     u_int64_t max;
 }      streamvar[] = {
 }      streamvar[] = {
     { 'L', ":%llu", " %20llu", 22, sizeof(u_int64_t), (u_int64_t) 0xffffffffffffffff },
     { 'L', ":%llu", " %20llu", 22, sizeof(u_int64_t), (u_int64_t) 0xffffffffffffffff },
+    { 'D', ":%7.6f", " %7.6f", 23, sizeof(int64_t), (u_int64_t) 0xffffffffffffffff },
     { 'l', ":%lu", " %10lu", 12, sizeof(u_int32_t), (u_int64_t) 0xffffffff },
     { 'l', ":%lu", " %10lu", 12, sizeof(u_int32_t), (u_int64_t) 0xffffffff },
     { 's', ":%u", " %5u", 7, sizeof(u_int16_t), (u_int64_t) 0xffff },
     { 's', ":%u", " %5u", 7, sizeof(u_int16_t), (u_int64_t) 0xffff },
     { 'c', ":%3.2f", " %3.2f", 8, sizeof(u_int16_t), (u_int64_t) 100 },
     { 'c', ":%3.2f", " %3.2f", 8, sizeof(u_int16_t), (u_int64_t) 100 },
@@ -101,6 +103,8 @@ struct {
     { MT_DEBUG, "llllllllllllllllllll" },
     { MT_DEBUG, "llllllllllllllllllll" },
     { MT_PROC, "lLLLlcll" },
     { MT_PROC, "lLLLlcll" },
     { MT_MBUF, "lllllllllllllll" },
     { MT_MBUF, "lllllllllllllll" },
+    { MT_SENSOR, "D" },
+    { MT_TEST, "LLLLDDDDllllssssccccbbbb" },
     { MT_EOT, "" }
     { MT_EOT, "" }
 };
 };
 
 
@@ -116,6 +120,7 @@ struct {
     { MT_DEBUG, LXT_DEBUG },
     { MT_DEBUG, LXT_DEBUG },
     { MT_PROC, LXT_PROC },
     { MT_PROC, LXT_PROC },
     { MT_MBUF, LXT_MBUF },
     { MT_MBUF, LXT_MBUF },
+    { MT_SENSOR, LXT_SENSOR },
     { MT_EOT, LXT_BADTOKEN }
     { MT_EOT, LXT_BADTOKEN }
 };
 };
 /* parallel crc32 table */
 /* parallel crc32 table */
@@ -301,6 +306,8 @@ snpack(char *buf, int maxlen, char *id, int type,...)
     u_int16_t c;
     u_int16_t c;
     u_int32_t l;
     u_int32_t l;
     u_int64_t q;
     u_int64_t q;
+    int64_t d;
+    double D;
     int i = 0;
     int i = 0;
     int offset = 0;
     int offset = 0;
 
 
@@ -346,7 +353,8 @@ snpack(char *buf, int maxlen, char *id, int type,...)
 	    break;
 	    break;
 
 
 	case 'c':
 	case 'c':
-	    c = va_arg(ap, int);
+	    D = va_arg(ap, double);
+	    c = (u_int16_t) (D * 100.0);
 	    c = htons(c);
 	    c = htons(c);
 	    bcopy(&c, buf + offset, sizeof(u_int16_t));
 	    bcopy(&c, buf + offset, sizeof(u_int16_t));
 	    offset += sizeof(u_int16_t);
 	    offset += sizeof(u_int16_t);
@@ -354,7 +362,7 @@ snpack(char *buf, int maxlen, char *id, int type,...)
 
 
 	case 's':
 	case 's':
 	    s = va_arg(ap, int);
 	    s = va_arg(ap, int);
-	    s = htons(c);
+	    s = htons(s);
 	    bcopy(&s, buf + offset, sizeof(u_int16_t));
 	    bcopy(&s, buf + offset, sizeof(u_int16_t));
 	    offset += sizeof(u_int16_t);
 	    offset += sizeof(u_int16_t);
 	    break;
 	    break;
@@ -372,7 +380,15 @@ snpack(char *buf, int maxlen, char *id, int type,...)
 	    bcopy(&q, buf + offset, sizeof(u_int64_t));
 	    bcopy(&q, buf + offset, sizeof(u_int64_t));
 	    offset += sizeof(u_int64_t);
 	    offset += sizeof(u_int64_t);
 	    break;
 	    break;
-
+	    
+	case 'D':
+	    D = va_arg(ap, double);
+	    d = (int64_t) (D * 1000 * 1000);
+	    d = htonq(d);
+	    bcopy(&d, buf + offset, sizeof(int64_t));
+	    offset += sizeof(int64_t);
+	    break;
+	    
 	default:
 	default:
 	    warning("unknown stream format identifier");
 	    warning("unknown stream format identifier");
 	    return 0;
 	    return 0;
@@ -401,6 +417,7 @@ sunpack(char *buf, struct packedstream * ps)
     u_int16_t c;
     u_int16_t c;
     u_int32_t l;
     u_int32_t l;
     u_int64_t q;
     u_int64_t q;
+    int64_t d;
 
 
     bzero(ps, sizeof(struct packedstream));
     bzero(ps, sizeof(struct packedstream));
 
 
@@ -466,6 +483,14 @@ sunpack(char *buf, struct packedstream * ps)
 	    out += sizeof(u_int64_t);
 	    out += sizeof(u_int64_t);
 	    break;
 	    break;
 
 
+	case 'D':
+	    bcopy((void *) in, &d, sizeof(int64_t));
+	    d = ntohq(d);
+	    bcopy(&d, (void *) out, sizeof(int64_t));
+	    in += sizeof(int64_t);
+	    out += sizeof(int64_t);
+	    break;
+
 	default:
 	default:
 	    warning("unknown stream format identifier");
 	    warning("unknown stream format identifier");
 	    return 0;
 	    return 0;
@@ -478,12 +503,13 @@ sunpack(char *buf, struct packedstream * ps)
 int 
 int 
 ps2strn(struct packedstream * ps, char *buf, const int maxlen, int pretty)
 ps2strn(struct packedstream * ps, char *buf, const int maxlen, int pretty)
 {
 {
-    float f;
     u_int16_t b;
     u_int16_t b;
     u_int16_t s;
     u_int16_t s;
     u_int16_t c;
     u_int16_t c;
     u_int64_t q;
     u_int64_t q;
     u_int32_t l;
     u_int32_t l;
+    int64_t d;
+    double D;
     int i = 0;
     int i = 0;
     char *formatstr;
     char *formatstr;
     char *in, *out;
     char *in, *out;
@@ -518,8 +544,8 @@ ps2strn(struct packedstream * ps, char *buf, const int maxlen, int pretty)
 
 
 	case 'c':
 	case 'c':
 	    bcopy(in, &c, sizeof(u_int16_t));
 	    bcopy(in, &c, sizeof(u_int16_t));
-	    f = (float) c / 10.0;
-	    snprintf(out, strlenvar(vartype), formatstr, f);
+	    D = (double) c / 100.0;
+	    snprintf(out, strlenvar(vartype), formatstr, D);
 	    in += sizeof(u_int16_t);
 	    in += sizeof(u_int16_t);
 	    break;
 	    break;
 
 
@@ -541,6 +567,14 @@ ps2strn(struct packedstream * ps, char *buf, const int maxlen, int pretty)
 	    in += sizeof(u_int64_t);
 	    in += sizeof(u_int64_t);
 	    break;
 	    break;
 
 
+	case 'D':
+	    bcopy(in, &d, sizeof(int64_t));
+	    D = (double) (d / 1000.0 / 1000.0);
+	    snprintf(out, strlenvar(vartype), formatstr, D);
+	    in += sizeof(int64_t);
+	    break;
+
+	    
 	default:
 	default:
 	    warning("Unknown stream format identifier");
 	    warning("Unknown stream format identifier");
 	    return 0;
 	    return 0;
@@ -828,26 +862,25 @@ free_sourcelist(struct sourcelist * sol)
 int 
 int 
 calculate_churnbuffer(struct sourcelist * sol)
 calculate_churnbuffer(struct sourcelist * sol)
 {
 {
+    char buf[_POSIX2_LINE_MAX];
     struct source *source;
     struct source *source;
     struct stream *stream;
     struct stream *stream;
-    int prefixlen;
     int maxlen;
     int maxlen;
     int len;
     int len;
     int n;
     int n;
 
 
-    /* determine length of a timestamp + ip as strings */
-    prefixlen = (sizeof(time_t) * 3) + strlen(":") + 15 + strlen(":");
-
     len = n = 0;
     len = n = 0;
     source = NULL;
     source = NULL;
     stream = NULL;
     stream = NULL;
     maxlen = 0;
     maxlen = 0;
+
     /* determine maximum string size for a single source */
     /* determine maximum string size for a single source */
     SLIST_FOREACH(source, sol, sources) {
     SLIST_FOREACH(source, sol, sources) {
-	len = prefixlen;
+	len = snprintf(&buf[0], _POSIX2_LINE_MAX, "%s;", source->addr);
 	SLIST_FOREACH(stream, &source->sl, streams) {
 	SLIST_FOREACH(stream, &source->sl, streams) {
 	    len += strlen(type2str(stream->type)) + strlen(":");
 	    len += strlen(type2str(stream->type)) + strlen(":");
 	    len += strlen(stream->args) + strlen(":");
 	    len += strlen(stream->args) + strlen(":");
+	    len += (sizeof(time_t) * 3) + strlen(":"); /* 3 =~ ln(255) / ln(10) */
 	    len += strlentype(stream->type);
 	    len += strlentype(stream->type);
 	    n++;
 	    n++;
 	}
 	}

+ 17 - 4
symon/lib/data.h

@@ -1,4 +1,4 @@
-/* $Id: data.h,v 1.19 2003/01/08 16:04:12 dijkstra Exp $ */
+/* $Id: data.h,v 1.20 2003/06/20 08:41:07 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -149,14 +149,16 @@ SLIST_HEAD(muxlist, mux);
 #define MT_DEBUG  5
 #define MT_DEBUG  5
 #define MT_PROC   6
 #define MT_PROC   6
 #define MT_MBUF   7
 #define MT_MBUF   7
-#define MT_EOT    8
+#define MT_SENSOR 8
+#define MT_TEST   9
+#define MT_EOT    10
 
 
 /*
 /*
  * Unpacking of incoming packets is done via a packedstream structure. This
  * Unpacking of incoming packets is done via a packedstream structure. This
  * structure defines the maximum amount of data that can be contained in a
  * 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
  * single network representation of a stream. It is used internally for sizing
- * only. Although the union members are here, they could also read u_int64_t[4]
- * with io, for instance.
+ * only and regression testing only. Although the union members are here, they
+ * could also read u_int64_t[4] with io, for instance.
  */
  */
 #define SYMON_UNKMUX   "<unknown mux>"	/* mux nodes without host addr */
 #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 */
@@ -260,6 +262,17 @@ struct packedstream {
 	    u_int32_t m_wait;
 	    u_int32_t m_wait;
 	    u_int32_t m_drain;
 	    u_int32_t m_drain;
 	}      ps_mbuf;
 	}      ps_mbuf;
+	struct {
+	    int64_t value;
+	}      ps_sensor;
+	struct {
+	    u_int64_t L[4];
+	    int64_t D[4];
+	    u_int32_t l[4];
+	    u_int16_t s[4];
+	    u_int16_t c[4];
+	    u_int8_t b[4];
+	}      ps_test;
     }     data;
     }     data;
 };
 };
 
 

+ 3 - 2
symon/lib/lex.c

@@ -1,7 +1,7 @@
-/* $Id: lex.c,v 1.15 2002/12/15 14:27:43 dijkstra Exp $ */
+/* $Id: lex.c,v 1.16 2003/06/20 08:41:07 dijkstra Exp $ */
 
 
 /*
 /*
- * Copyright (c) 2001-2002 Willem Dijkstra
+ * Copyright (c) 2001-2003 Willem Dijkstra
  * All rights reserved.
  * All rights reserved.
  *
  *
  * Redistribution and use in source and binary forms, with or without
  * Redistribution and use in source and binary forms, with or without
@@ -81,6 +81,7 @@ static struct {
     { "pf", LXT_PF },
     { "pf", LXT_PF },
     { "port", LXT_PORT },
     { "port", LXT_PORT },
     { "proc", LXT_PROC },
     { "proc", LXT_PROC },
+    { "sensor", LXT_SENSOR },
     { "source", LXT_SOURCE },
     { "source", LXT_SOURCE },
     { "stream", LXT_STREAM },
     { "stream", LXT_STREAM },
     { "to", LXT_TO },
     { "to", LXT_TO },

+ 8 - 7
symon/lib/lex.h

@@ -1,7 +1,7 @@
-/* $Id: lex.h,v 1.15 2002/12/15 14:27:43 dijkstra Exp $ */
+/* $Id: lex.h,v 1.16 2003/06/20 08:41:07 dijkstra Exp $ */
 
 
 /*
 /*
- * Copyright (c) 2001-2002 Willem Dijkstra
+ * Copyright (c) 2001-2003 Willem Dijkstra
  * All rights reserved.
  * All rights reserved.
  *
  *
  * Redistribution and use in source and binary forms, with or without
  * Redistribution and use in source and binary forms, with or without
@@ -62,11 +62,12 @@
 #define LXT_PF        16
 #define LXT_PF        16
 #define LXT_PORT      17
 #define LXT_PORT      17
 #define LXT_PROC      18
 #define LXT_PROC      18
-#define LXT_SOURCE    19
-#define LXT_STREAM    20
-#define LXT_TO        21
-#define LXT_WRITE     22
-#define LXT_MBUF      23
+#define LXT_SENSOR    19
+#define LXT_SOURCE    20
+#define LXT_STREAM    21
+#define LXT_TO        22
+#define LXT_WRITE     23
+#define LXT_MBUF      24
 
 
 struct lex {
 struct lex {
     char *buffer;		/* current line(s) */
     char *buffer;		/* current line(s) */

+ 4 - 9
symon/ports/symon/Makefile

@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+# $OpenBSD: Makefile,v 1.7 2003/03/31 22:13:51 dhartmei Exp $
 
 
 COMMENT=		"active monitoring tool"
 COMMENT=		"active monitoring tool"
-V=			2.60
+V=			2.61
 DISTNAME=		symon-${V}
 DISTNAME=		symon-${V}
-CATEGORIES=		sysutils net 
+CATEGORIES=		sysutils net
 
 
 HOMEPAGE=		http://www.xs4all.nl/~wpd/symon/
 HOMEPAGE=		http://www.xs4all.nl/~wpd/symon/
 MAINTAINER=		Willem Dijkstra <wpd@xs4all.nl>
 MAINTAINER=		Willem Dijkstra <wpd@xs4all.nl>
@@ -28,11 +28,6 @@ MULTI_PACKAGES+=	-mux
 COMMENT-mux=		"symon data gatherer"
 COMMENT-mux=		"symon data gatherer"
 MUX_LIBDEPENDS=		rrd:rrdtool-*:net/rrdtool 
 MUX_LIBDEPENDS=		rrd:rrdtool-*:net/rrdtool 
 MUX_RUNDEPENDS=		rrd:rrdtool-*:net/rrdtool 
 MUX_RUNDEPENDS=		rrd:rrdtool-*:net/rrdtool 
-# web frontend only package
-MULTI_PACKAGES+=	-web
-COMMENT-web=		"symon web frontend"
-WEB_LIBDEPENDS=
-WEB_RUNDEPENDS=		rrd:rrdtool-*:net/rrdtool php:php4->=4.2.3:www/php4/core
 
 
 .for i in ${MULTI_PACKAGES}
 .for i in ${MULTI_PACKAGES}
 FULLPKGNAME${i}=        symon${i}-${V}
 FULLPKGNAME${i}=        symon${i}-${V}
@@ -45,7 +40,7 @@ RUN_DEPENDS=		${${MODULE_NAME:U}_RUNDEPENDS}
 MESSAGE=                ${PKGDIR}/MESSAGE${SUBPACKAGE}
 MESSAGE=                ${PKGDIR}/MESSAGE${SUBPACKAGE}
 .else
 .else
 BUILD_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
 BUILD_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
-RUN_DEPENDS=		rrd:rrdtool-*:net/rrdtool php:php4->=4.2.3:www/php4/core
+RUN_DEPENDS=		rrd:rrdtool-*:net/rrdtool
 LIB_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
 LIB_DEPENDS=		rrd:rrdtool-*:net/rrdtool 
 .endif
 .endif
 
 

+ 3 - 0
symon/ports/symon/distinfo

@@ -0,0 +1,3 @@
+MD5 (symon-2.61.tar.gz) = bd1fd1f30aa9b6801206cc2bc89f2f4c
+RMD160 (symon-2.61.tar.gz) = 57ea98c81961340f7eecd8b64c0b7f9b2b2d4b00
+SHA1 (symon-2.61.tar.gz) = 716d72510f58f3b06426beedcb26a4ca9d332473

+ 1 - 1
symon/ports/symon/pkg/DEINSTALL

@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-# $Id: DEINSTALL,v 1.1 2002/11/29 10:59:56 dijkstra Exp $
+# $OpenBSD: DEINSTALL,v 1.2 2003/02/04 22:59:48 naddy Exp $
 #
 #
 # symon de-installation
 # symon de-installation
 
 

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

@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-# $Id: DEINSTALL-mon,v 1.2 2002/11/29 10:50:32 dijkstra Exp $
+# $OpenBSD: DEINSTALL-mon,v 1.2 2003/02/17 23:54:49 naddy Exp $
 #
 #
 # symon de-installation
 # symon de-installation
 
 

+ 0 - 1
symon/ports/symon/pkg/DESCR

@@ -5,6 +5,5 @@ then spooled over "the network" to symux for further processing.
 The port will yield 4 packages: 
 The port will yield 4 packages: 
 symon-mon-${V}.tgz : symon daemon and manual
 symon-mon-${V}.tgz : symon daemon and manual
 symon-mux-${V}.tgz : symux daemon, manual and auxiliary scripts
 symon-mux-${V}.tgz : symux daemon, manual and auxiliary scripts
-symon-web-${V}.tgz : web frontend
 symon-${V}.tgz     : all of the above rolled into a single package
 symon-${V}.tgz     : all of the above rolled into a single package
 
 

+ 0 - 6
symon/ports/symon/pkg/DESCR-web

@@ -1,6 +0,0 @@
-symon is a lightweight system monitor that measures cpu, memory,
-interface and disk statistics every 5 seconds. This information is
-then spooled over "the network" to symux for further processing.
-
-symon2web is a set of php scripts that provide a view on the data that
-symux gathered.

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

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

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

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

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

@@ -1,6 +1,6 @@
 +---------------
 +---------------
 | Example configurations for both symon and symux have been installed
 | Example configurations for both symon and symux have been installed
-| in ${PREFIX}/share/examples/symon/
+| in ${PREFIX}/share/symon.
 |
 |
 | RRD files can be obtained by running
 | RRD files can be obtained by running
 | ${PREFIX}/share/symon/c_smrrds.sh
 | ${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
 | An example configuration for symon has been installed in
-| ${PREFIX}/share/examples/symon.
+| ${PREFIX}/share/symon.
 +---------------
 +---------------

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

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

+ 0 - 8
symon/ports/symon/pkg/MESSAGE-web

@@ -1,8 +0,0 @@
-+---------------
-| The webapplication has been installed in 
-| ${PREFIX}/share/symon/web.
-|
-| Edit datasources.inc to point to the place where symux deposits the
-| rrd files. This should point to a directory that contains rrd files
-| in the following form: '.../machine/*.rrd'.
-+---------------

+ 2 - 24
symon/ports/symon/pkg/PLIST

@@ -1,36 +1,14 @@
-@comment $OpenBSD: PLIST,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+@comment $OpenBSD: PLIST,v 1.5 2003/03/31 22:13:51 dhartmei Exp $
 @pkgcfl symon-*
 @pkgcfl symon-*
 libexec/symon
 libexec/symon
 libexec/symux
 libexec/symux
 man/cat8/symon.0
 man/cat8/symon.0
 man/cat8/symux.0
 man/cat8/symux.0
-share/symon/c_smrrds.sh
-share/symon/c_config.sh
 share/examples/symon/symon.conf
 share/examples/symon/symon.conf
 share/examples/symon/symux.conf
 share/examples/symon/symux.conf
-share/symon/web/class_cpu.inc        
-share/symon/web/class_graph.inc      
-share/symon/web/class_if.inc         
-share/symon/web/class_io.inc         
-share/symon/web/class_mem.inc        
-share/symon/web/class_pf.inc         
-share/symon/web/class_debug.inc
-share/symon/web/class_proc.inc
-share/symon/web/datasources.inc      
-share/symon/web/graph_cpu.php        
-share/symon/web/graph_if.php         
-share/symon/web/graph_io.php         
-share/symon/web/graph_mem.php        
-share/symon/web/graph_pf.php         
-share/symon/web/index.php            
-share/symon/web/symon.css              
-share/symon/web/symon.png              
-share/symon/web/spacer.png           
-share/symon/web/test_config.php
+share/symon/c_smrrds.sh
 share/symon/client/getsymonitem.pl
 share/symon/client/getsymonitem.pl
 share/symon/client/SymuxClient.pm
 share/symon/client/SymuxClient.pm
 share/symon/client/SymuxClient.0
 share/symon/client/SymuxClient.0
-@dirrm share/examples/symon
 @dirrm share/symon/client
 @dirrm share/symon/client
-@dirrm share/symon/web
 @dirrm share/symon
 @dirrm share/symon

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

@@ -1,8 +1,7 @@
-@comment $OpenBSD: PLIST-mon,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+@comment $OpenBSD: PLIST-mon,v 1.5 2003/03/31 22:13:51 dhartmei Exp $
 @pkgcfl symon-[0-9]*
 @pkgcfl symon-[0-9]*
 libexec/symon
 libexec/symon
 man/cat8/symon.0
 man/cat8/symon.0
-share/symon/c_config.sh
 share/examples/symon/symon.conf
 share/examples/symon/symon.conf
-@dirrm share/examples/symon
+share/symon/c_config.sh
 @dirrm share/symon
 @dirrm share/symon

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

@@ -1,4 +1,4 @@
-@comment $OpenBSD: PLIST-mux,v 1.1 2002/10/08 07:56:42 dhartmei Exp $
+@comment $OpenBSD: PLIST-mux,v 1.4 2003/03/31 22:13:51 dhartmei Exp $
 @pkgcfl symon-[0-9]*
 @pkgcfl symon-[0-9]*
 libexec/symux
 libexec/symux
 man/cat8/symux.0
 man/cat8/symux.0
@@ -7,6 +7,5 @@ share/examples/symon/symux.conf
 share/symon/client/getsymonitem.pl
 share/symon/client/getsymonitem.pl
 share/symon/client/SymuxClient.pm
 share/symon/client/SymuxClient.pm
 share/symon/client/SymuxClient.0
 share/symon/client/SymuxClient.0
-@dirrm share/examples/symon
 @dirrm share/symon/client
 @dirrm share/symon/client
 @dirrm share/symon
 @dirrm share/symon

+ 0 - 23
symon/ports/symon/pkg/PLIST-web

@@ -1,23 +0,0 @@
-@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         
-share/symon/web/class_io.inc         
-share/symon/web/class_mem.inc        
-share/symon/web/class_pf.inc         
-share/symon/web/class_debug.inc
-share/symon/web/class_proc.inc
-share/symon/web/datasources.inc      
-share/symon/web/graph_cpu.php        
-share/symon/web/graph_if.php         
-share/symon/web/graph_io.php         
-share/symon/web/graph_mem.php        
-share/symon/web/graph_pf.php         
-share/symon/web/index.php            
-share/symon/web/symon.css              
-share/symon/web/symon.png              
-share/symon/web/spacer.png           
-share/symon/web/test_config.php
-@dirrm share/symon/web
-@dirrm share/symon

+ 8 - 4
symon/symon/Makefile

@@ -1,8 +1,8 @@
-# $Id: Makefile,v 1.29 2002/12/15 14:23:27 dijkstra Exp $
+# $Id: Makefile,v 1.30 2003/06/20 08:41:19 dijkstra Exp $
 .include "../Makefile.inc"
 .include "../Makefile.inc"
 
 
 LIBS=	-L../lib -lsymon
 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_mbuf.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 sm_sensor.c readconf.c symonnet.c 
 OBJS+=	${SRCS:R:S/$/.o/g}
 OBJS+=	${SRCS:R:S/$/.o/g}
 CFLAGS+=-I../lib
 CFLAGS+=-I../lib
 
 
@@ -30,10 +30,14 @@ conf.h:  Makefile
 	@echo "/* This file was automagically generated by make */" > $@
 	@echo "/* This file was automagically generated by make */" > $@
 	@echo "#define SYMON_CONFIG_FILE \"$(SYSCONFDIR)/symon.conf\""  >> $@
 	@echo "#define SYMON_CONFIG_FILE \"$(SYSCONFDIR)/symon.conf\""  >> $@
 	@echo "#define SYMON_VERSION \"$(V)\"" >> $@
 	@echo "#define SYMON_VERSION \"$(V)\"" >> $@
-	@case `grep -c KERN_MBSTAT /usr/include/sys/sysctl.h` in	\
+	@case `grep -csq KERN_MBSTAT /usr/include/sys/sysctl.h` in	\
 	1)	echo "#define HAS_KERN_MBSTAT	1" >> $@;;		\
 	1)	echo "#define HAS_KERN_MBSTAT	1" >> $@;;		\
-	0)	echo "#undef HAS_KERN_MBSTAT" >> $@;;			\
+	*)	echo "#undef HAS_KERN_MBSTAT" >> $@;;			\
 	esac;
 	esac;
+	@case `grep -csq "struct sensor" /usr/include/sys/sensors.h` in \
+	1)	echo "#define HAS_SENSOR_H	1" >> $@;;		\
+	*)	echo "#undef HAS_SENSOR_H" >> $@;;			\
+	esac
 
 
 symon.h: conf.h
 symon.h: conf.h
 
 

+ 1 - 1
symon/symon/c_config.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-# $Id: c_config.sh,v 1.3 2002/12/14 14:03:48 dijkstra Exp $
+# $Id: c_config.sh,v 1.4 2003/06/20 08:41:19 dijkstra Exp $
 #
 #
 # Create an example configuration file for symon on a host and print to stdout
 # Create an example configuration file for symon on a host and print to stdout
 
 

+ 4 - 3
symon/symon/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.13 2002/12/15 14:23:27 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.14 2003/06/20 08:41:19 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -108,6 +108,7 @@ read_symon_args(struct mux * mux, struct lex * l)
 	case LXT_MBUF:
 	case LXT_MBUF:
 	case LXT_DEBUG:
 	case LXT_DEBUG:
 	case LXT_PROC:
 	case LXT_PROC:
+	case LXT_SENSOR:
 	    st = token2type(l->op);
 	    st = token2type(l->op);
 	    strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 	    strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 
 
@@ -137,11 +138,11 @@ read_symon_args(struct mux * mux, struct lex * l)
 		return 0;
 		return 0;
 	    }
 	    }
 
 
-	    break;		/* LXT_CPU/IF/IO/MEM/PF/MBUF/DEBUG/PROC */
+	    break;		/* LXT_CPU/IF/IO/MEM/PF/MBUF/DEBUG/PROC/SENSOR */
 	case LXT_COMMA:
 	case LXT_COMMA:
 	    break;
 	    break;
 	default:
 	default:
-	    parse_error(l, "{cpu|mem|if|io|pf|debug}");
+	    parse_error(l, "{cpu|mem|if|io|pf|debug|sensor}");
 	    return 0;
 	    return 0;
 	    break;
 	    break;
 	}
 	}

+ 5 - 5
symon/symon/sm_cpu.c

@@ -142,9 +142,9 @@ get_cpu(char *symon_buf, int maxlen, char *s)
     total = percentages(CPUSTATES, cp_states, cp_time, cp_old, cp_diff);
     total = percentages(CPUSTATES, cp_states, cp_time, cp_old, cp_diff);
 
 
     return snpack(symon_buf, maxlen, s, MT_CPU,
     return snpack(symon_buf, maxlen, s, MT_CPU,
-		  cp_states[CP_USER],
-		  cp_states[CP_NICE],
-		  cp_states[CP_SYS],
-		  cp_states[CP_INTR],
-		  cp_states[CP_IDLE]);
+		  (double) (cp_states[CP_USER] / 10.0),
+		  (double) (cp_states[CP_NICE] / 10.0),
+		  (double) (cp_states[CP_SYS] / 10.0),
+		  (double) (cp_states[CP_INTR] / 10.0),
+		  (double) (cp_states[CP_IDLE] / 10.0));
 }
 }

+ 1 - 1
symon/symon/sm_io.c

@@ -1,4 +1,4 @@
-/* $Id: sm_io.c,v 1.11 2003/01/24 13:33:52 dijkstra Exp $ */
+/* $Id: sm_io.c,v 1.12 2003/06/20 08:41:19 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
  * Copyright (c) 2001-2002 Willem Dijkstra

+ 1 - 1
symon/symon/sm_mbuf.c

@@ -1,4 +1,4 @@
-/* $Id: sm_mbuf.c,v 1.0 2003/01/28 19:51:00 dhartmei Exp $ */
+/* $Id: sm_mbuf.c,v 1.1 2003/06/20 08:42:03 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2003 Daniel Hartmeier
  * Copyright (c) 2003 Daniel Hartmeier

+ 118 - 0
symon/symon/sm_sensor.c

@@ -0,0 +1,118 @@
+/* $Id: $ */
+
+/*
+ * Copyright (c) 2001-2003 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 sensor data from the kernel and return in symon_buf as
+ *
+ * num : value
+ *
+ * This code is not re-entrant. It uses sysctl and can be run as any user.
+ */
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+#ifdef HAS_SENSORS_H
+#include <sys/sensors.h>
+#endif HAS_SENSORS_H
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "error.h"
+#include "symon.h"
+#include "conf.h"
+
+#ifndef HAS_SENSORS_H
+void
+init_sensor(char *s)
+{
+    fatal("sensor module requires system upgrade to OpenBSD 3.4");
+}
+int 
+get_sensor(char *symon_buf, int maxlen, char *s)
+{
+    fatal("sensor module requires system upgrade to OpenBSD 3.4");
+}
+#else
+/* Globals for this module start with sn_ */
+static int sn_mib[] = {CTL_HW, HW_SENSORS, 0};
+static struct sensor sn_sensor;
+
+/* Prepare if module for first use */
+void 
+init_sensor(char *s)
+{
+    info("started module sensors(%s)", s);
+}
+/* Get sensor statistics */
+int 
+get_sensor(char *symon_buf, int maxlen, char *s)
+{
+    size_t len;
+    long l;
+    int i;
+    double t;
+
+    bzero((void *) &sn_sensor, sizeof(sn_sensor));
+    l = strtol(s, NULL, 10);
+    i = (int) (l & SYMON_SENSORMASK);
+    sn_mib[2] = i;
+    
+    len = sizeof(sn_sensor);
+
+    if (sysctl(sn_mib, 3, &sn_sensor, &len, NULL, 0) == -1) {
+	warning("%s:%d: sensor can't get sensor %.200s -- %.200s", 
+		__FILE__, __LINE__, s, strerror(errno));
+
+	return 0;
+    } else {
+	switch (sn_sensor.type) {
+	case SENSOR_TEMP:
+	    t = (double) (sn_sensor.value / 1000.0 / 1000.0) - 273.16;
+	    break;
+	case SENSOR_FANRPM:
+	    t = (double) sn_sensor.value;
+	    break;
+	case SENSOR_VOLTS_DC:
+	    t = (double) (sn_sensor.value / 1000.0 / 1000.0);
+	    break;
+	default:
+	    t = (double) sn_sensor.value;
+	}
+
+	return snpack(symon_buf, maxlen, s, MT_SENSOR, t);
+    }
+}
+#endif /* HAS_SENSORS_H */

+ 2 - 1
symon/symon/symon.8

@@ -97,7 +97,8 @@ newlines and text behind '#' are ignored. The format in BNF:
 .nf
 .nf
 monitor-rule = "monitor" "{" resources "}" "stream" ["to"] host [ port ]
 monitor-rule = "monitor" "{" resources "}" "stream" ["to"] host [ port ]
 resources    = resource ["(" argument ")"] [ ","|" " resources ]
 resources    = resource ["(" argument ")"] [ ","|" " resources ]
-resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc" | "mbuf"
+resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | 
+               "proc" | "mbuf" | "sensor"
 host         = ip4addr | ip6addr | hostname
 host         = ip4addr | ip6addr | hostname
 port         = [ "port" | "," ] portnumber
 port         = [ "port" | "," ] portnumber
 argument     = number | interfacename | diskname
 argument     = number | interfacename | diskname

+ 36 - 21
symon/symon/symon.c

@@ -1,4 +1,4 @@
-/* $Id: symon.c,v 1.28 2002/12/15 14:23:27 dijkstra Exp $ */
+/* $Id: symon.c,v 1.29 2003/06/20 08:41:19 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -54,24 +54,42 @@ __BEGIN_DECLS
 void alarmhandler(int);
 void alarmhandler(int);
 void exithandler(int);
 void exithandler(int);
 void huphandler(int);
 void huphandler(int);
+void set_stream_use(struct muxlist *);
 __END_DECLS
 __END_DECLS
 
 
 int flag_hup = 0;
 int flag_hup = 0;
 
 
 /* map stream types to inits and getters */
 /* map stream types to inits and getters */
 struct funcmap streamfunc[] = {
 struct funcmap streamfunc[] = {
-    {MT_IO, init_io, gets_io, get_io},	/* gets_io obtains entire io state,
-					 * get_io = just a copy */
-    {MT_CPU, init_cpu, NULL, get_cpu},
-    {MT_MEM, init_mem, NULL, get_mem},
-    {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_MBUF, init_mbuf, NULL, get_mbuf},
-    {MT_EOT, NULL, NULL}
+    {MT_IO, 0, init_io, gets_io, get_io},	/* gets_io obtains entire io state,
+					         * get_io = just a copy */
+    {MT_CPU, 0, init_cpu, NULL, get_cpu},
+    {MT_MEM, 0, init_mem, NULL, get_mem},
+    {MT_IF, 0, init_if, NULL, get_if},
+    {MT_PF, 0, init_pf, NULL, get_pf},
+    {MT_DEBUG, 0, init_debug, NULL, get_debug},
+    {MT_PROC, 0, init_proc, gets_proc, get_proc},
+    {MT_MBUF, 0, init_mbuf, NULL, get_mbuf},
+    {MT_SENSOR, 0, init_sensor, NULL, get_sensor},
+    {MT_EOT, 0, NULL, NULL}
 };
 };
 
 
+void
+set_stream_use(struct muxlist *mul) {
+    struct mux *mux;
+    struct stream *stream;
+    int i;
+
+    for (i = 0; i < MT_EOT; i++)
+	streamfunc[i].used = 0;
+
+
+    SLIST_FOREACH(mux, mul, muxes) {
+	SLIST_FOREACH(stream, &mux->sl, streams)
+	    streamfunc[stream->type].used = 1;
+    }
+}
+
 /* alarmhandler that gets called every SYMON_INTERVAL */
 /* alarmhandler that gets called every SYMON_INTERVAL */
 void 
 void 
 alarmhandler(int s)
 alarmhandler(int s)
@@ -98,13 +116,8 @@ huphandler(int s)
  * - with minimal performance impact
  * - with minimal performance impact
  * - in a secure way.
  * - in a secure way.
  *
  *
- * Measuring system parameters (e.g. interfaces) sometimes means traversing
- * lists in kernel memory. Because of this the measurement of data has been
- * decoupled from the processing and storage of data. Storing the measured
- * information that symon provides is done by a second program, called symux.
- *
- * Symon can keep track of cpu, memory, disk and network interface
- * interactions. Symon was built specifically for OpenBSD.
+ * Measurements are processed by a second program called symux. symon and symux
+ * communicate via udp.
  */
  */
 int 
 int 
 main(int argc, char *argv[])
 main(int argc, char *argv[])
@@ -205,7 +218,8 @@ main(int argc, char *argv[])
 	    (streamfunc[stream->type].init) (stream->args);
 	    (streamfunc[stream->type].init) (stream->args);
 	}
 	}
     }
     }
-
+    set_stream_use(&mul);
+    
     /* setup alarm */
     /* setup alarm */
     timerclear(&alarminterval.it_interval);
     timerclear(&alarminterval.it_interval);
     timerclear(&alarminterval.it_value);
     timerclear(&alarminterval.it_value);
@@ -217,7 +231,7 @@ main(int argc, char *argv[])
     }
     }
 
 
     for (;;) {			/* FOREVER */
     for (;;) {			/* FOREVER */
-	sleep(SYMON_INTERVAL * 2);	/* alarm will always interrupt sleep */
+	sleep(SYMON_INTERVAL);	/* alarm will always interrupt sleep */
 
 
 	if (flag_hup == 1) {
 	if (flag_hup == 1) {
 	    flag_hup = 0;
 	    flag_hup = 0;
@@ -240,13 +254,14 @@ main(int argc, char *argv[])
 			(streamfunc[stream->type].init) (stream->args);
 			(streamfunc[stream->type].init) (stream->args);
 		    }
 		    }
 		}
 		}
+		set_stream_use(&mul);
 	    }
 	    }
 	}
 	}
 	else {
 	else {
 
 
 	    /* populate for modules that get all their measurements in one go */
 	    /* populate for modules that get all their measurements in one go */
 	    for (i = 0; i < MT_EOT; i++)
 	    for (i = 0; i < MT_EOT; i++)
-		if (streamfunc[i].gets != NULL)
+		if (streamfunc[i].used && (streamfunc[i].gets != NULL))
 		    (streamfunc[i].gets) ();
 		    (streamfunc[i].gets) ();
 
 
 	    SLIST_FOREACH(mux, &mul, muxes) {
 	    SLIST_FOREACH(mux, &mul, muxes) {

+ 12 - 5
symon/symon/symon.h

@@ -1,4 +1,4 @@
-/* $Id: symon.h,v 1.23 2002/12/15 14:23:27 dijkstra Exp $ */
+/* $Id: symon.h,v 1.24 2003/06/20 08:41:19 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -40,14 +40,17 @@
 #include "conf.h"
 #include "conf.h"
 
 
 #define SYMON_PID_FILE    "/var/run/symon.pid"
 #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  200	/* max dynamic allocation; local limit per
-				 * measurement module */
+#define SYMON_INTERVAL 5	        /* measurement interval */
+#define SYMON_WARN_SENDERR 50	        /* warn every x errors */
+#define SYMON_MAX_DOBJECTS  2000	/* max dynamic allocation; local limit per
+				         * measurement module */
 #define SYMON_MAX_OBJSIZE  (_POSIX2_LINE_MAX)	/* max allocation unit =
 #define SYMON_MAX_OBJSIZE  (_POSIX2_LINE_MAX)	/* max allocation unit =
 						 * _POSIX2_LINE_MAX */
 						 * _POSIX2_LINE_MAX */
+#define SYMON_SENSORMASK   0xFF         /* sensors 0-255 are allowed */
+
 struct funcmap {
 struct funcmap {
     int type;
     int type;
+    int used;
     void (*init) (char *);
     void (*init) (char *);
     void (*gets) ();
     void (*gets) ();
     int (*get) (char *, int, char *);
     int (*get) (char *, int, char *);
@@ -89,6 +92,10 @@ extern int get_debug(char *, int, char *);
 extern void init_proc(char *);
 extern void init_proc(char *);
 extern void gets_proc();
 extern void gets_proc();
 extern int get_proc(char *, int, char *);
 extern int get_proc(char *, int, char *);
+
+/* sm_sensor.c */
+extern void init_sensor(char *);
+extern int get_sensor(char *, int, char *);
 __END_DECLS
 __END_DECLS
 
 
 #endif				/* _SYMON_SYMON_H */
 #endif				/* _SYMON_SYMON_H */

+ 0 - 29
symon/symon2web/Makefile

@@ -1,29 +0,0 @@
-# $Id: Makefile,v 1.4 2003/01/18 09:55:35 dijkstra Exp $
-.include "../Makefile.inc"
-
-all:
-
-clean:
-
-install: 
-	${INSTALL} -d -m 555 -g www -o www ${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_cpu.inc	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_debug.inc	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_graph.inc	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_if.inc		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_io.inc		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_mem.inc	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_pf.inc		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www class_proc.inc	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www datasources.inc	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www graph_cpu.php	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www graph_if.php		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www graph_io.php		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www graph_mem.php	${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www graph_pf.php		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www index.php		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www spacer.png		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www symon.css		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www symon.png		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www test_config.php	${PREFIX}/${WEBDIR
-

+ 0 - 75
symon/symon2web/class_cpu.inc

@@ -1,75 +0,0 @@
-<?php
-// $Id: class_cpu.inc,v 1.4 2002/11/29 10:45:46 dijkstra Exp $
-require_once("class_graph.inc");
-
-class CPU_Graph extends Graph {
-    function CPU_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(".$this->get("name").")' -u 100 --rigid ";
-
-	$this->shortcut = array_merge($this->shortcut, array(
-	    "cpu" => array(
-		"brief" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":user:AVERAGE",
-			"DEF:B=".$this->get("rrdfile").":nice:AVERAGE",
-			"DEF:C=".$this->get("rrdfile").":system:AVERAGE",
-			"DEF:D=".$this->get("rrdfile").":interrupt:AVERAGE",
-			"DEF:E=".$this->get("rrdfile").":idle:AVERAGE"),
-		    "graphdefinition" => array(
-			"AREA:A#00FF00:'user'",
-			"GPRINT:A:AVERAGE:'%.0lf\g'",
-			"STACK:B#00FFFF:'nice'",
-			"GPRINT:B:AVERAGE:'%.0lf\g'",
-			"STACK:C#DDA0DD:'system'",
-			"GPRINT:C:AVERAGE:'%.0lf\g'", 
-			"STACK:D#9932CC:'interrupt'", 
-			"GPRINT:D:AVERAGE:'%.0lf\g'",
-			"STACK:E#F5FFFA:'idle'", 
-			"GPRINT:E:AVERAGE:'%.0lf\g'")),
-		"detailed" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":user:AVERAGE",
-			"DEF:B=".$this->get("rrdfile").":nice:AVERAGE",
-			"DEF:C=".$this->get("rrdfile").":system:AVERAGE",
-			"DEF:D=".$this->get("rrdfile").":interrupt:AVERAGE",
-			"DEF:E=".$this->get("rrdfile").":idle:AVERAGE"),
-		    "graphdefinition" => array(
-			'COMMENT:"                 min       avg       max       last\n"',
-			"AREA:A#00FF00:'user     '",
-			'GPRINT:A:MIN:" %6.2lf %%"',
-			'GPRINT:A:AVERAGE:"%6.2lf %%"',
-			'GPRINT:A:MAX:"%6.2lf %%"',
-			'GPRINT:A:LAST:"%6.2lf %%\n"',
-			"STACK:B#00FFFF:'nice     '",
-			'GPRINT:B:MIN:" %6.2lf %%"',
-			'GPRINT:B:AVERAGE:"%6.2lf %%"',
-			'GPRINT:B:MAX:"%6.2lf %%"',
-			'GPRINT:B:LAST:"%6.2lf %%\n"',
-			"STACK:C#DDA0DD:'system   '",
-			'GPRINT:C:MIN:" %6.2lf %%"',
-			'GPRINT:C:AVERAGE:"%6.2lf %%"',
-			'GPRINT:C:MAX:"%6.2lf %%"',
-			'GPRINT:C:LAST:"%6.2lf %%\n"',
-			"STACK:D#9932CC:'interrupt'", 
-			'GPRINT:D:MIN:" %6.2lf %%"',
-			'GPRINT:D:AVERAGE:"%6.2lf %%"',
-			'GPRINT:D:MAX:"%6.2lf %%"',
-			'GPRINT:D:LAST:"%6.2lf %%\n"',
-			"STACK:E#F5FFFA:'idle     '",
-			'GPRINT:E:MIN:" %6.2lf %%"',
-			'GPRINT:E:AVERAGE:"%6.2lf %%"',
-			'GPRINT:E:MAX:"%6.2lf %%"',
-			'GPRINT:E:LAST:"%6.2lf %%\n"')))));
-	$this->graphdefaults = array_merge($this->graphdefaults, 
-					   $this->shortcut["cpu"]["brief"]);
-	$this->url2options($url);
-
-    }
-}
-?>

+ 0 - 158
symon/symon2web/class_debug.inc

@@ -1,158 +0,0 @@
-<?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);
-    }
-}
-?>

+ 0 - 233
symon/symon2web/class_graph.inc

@@ -1,233 +0,0 @@
-<?php
-// $Id: class_graph.inc,v 1.7 2002/11/29 10:45:46 dijkstra Exp $
-//
-// Base class for all graph classes. 
-
-class Graph {
-    var $debug;
-    var $graphdefaults;
-    var $graphsettings;
-    var $options;
-    var $shortcut;    
-
-    function Graph() {
-	$this->init();
-    }
-
-    function enable_debug() {
-	$this->debug = 1;
-    }
-    function debug($string) {
-	if ($this->debug) {
-	    print "<hr><br>$string<br><hr>";
-	}
-    }
-
-    function dump_vars() {
-	print "<br><hr><br><b>graphsettings</b>:<br><pre>";
-	print_r($this->graphsettings);
-	print "</pre><br><hr><br><b>options</b>:<br><pre>";
-	print_r($this->options);
-	print "</pre><br><hr><br>";
-    }
-    // fill meta parameters
-    // this function will most likely not be overloaded by child classes
-    function init() {
-	$this->debug = 0;
-
-	$this->graphdefaults = array( 
-	    "width"     => array("max" => 2048, "min" => 32,           "default" => 300),
-	    "height"    => array("max" => 2048, "min" => 32,           "default" => 225),
-	    "start"     => array("max" => 429467296,    "min" => -4294967296,  "default" => -86400),	
-	    "end"       => array("max" => 429467296,    "min" => -4294967296,  "default" => -1),
-	    "imagetype" => "PNG",
-	    "rrdtool"   => "/usr/local/bin/rrdtool graph -",
-	    "rrdfile"   => "",
-	    "name"      => "unnamed graph");
-	
-	$this->options = array(
-	    "width"     => "-w",
-	    "height"    => "-h",
-	    "imagetype" => "-a",
-	    "start"     => "-s", 
-	    "end"       => "-e" );
-
-	$this->shortcut = array(
-	    // date shortcuts
-	    "timespan"  => array(
-		"today"     => array(
-		    "start" => -86400 ),
-		"lastweek"  => array(
-		    "start" => -604800 ),
-		"lastmonth" => array( 
-		    "start" => -2419200 )),
-	    // size shortcuts
-	    "size"      => array(
-		"tiny"      => array(
-		    "width"  => 100,
-		    "height" => 75 ),
-		"small"     => array(
-		    "width"  => 200,
-		    "height" => 125 ),
-		"normal"    => array(
-		    "width"  => 300,
-		    "height" => 225 ),
-		"big"      => array(
-		    "width" => 600,
-		    "height" => 450 ),
-		"huge"      => array(
-		    "width" => 1024,
-		    "height" => 640 )));
-	$this->graphsettings = array(
-	    "graphdefinition" => array(),
-	    "dsdefinition" => array(),
-	    "rawcmdline" => "");
-    }
-
-    // parseoptions will not be overloaded by child classes
-    function parseoptions (&$params) {
-	$myparams = array();
-	// look for shortcuts
-	if (!empty($params) && is_array($params)) {
-	    reset($params);
-	    while (list($key, $value) = each($params)) {
-		if (isset($this->shortcut[$key][$value])) { 
-		    $ar = $this->shortcut[$key][$value];
-		    while (list($itemkey,$itemvalue) = each($ar)) {
-			if (is_array($this->shortcut[$key][$value][$itemkey])) {
-			    $myparams[$itemkey] = array_merge(array(),$this->shortcut[$key][$value][$itemkey]);
-			} else if (is_scalar($itemvalue)) {
-			    $myparams[$itemkey] = $itemvalue;
-			}
-		    }
-		} else {
-		    $myparams[$key] = $value;
-		}
-	    }
-	}
-
-	// copy parameters, filling in defaults and constraining to acceptable
-	// values where necessary
-	reset($this->graphdefaults);
-	reset($myparams);
-	while (list($key, $value) = each($this->graphdefaults)) {
-	    if (isset($myparams[$key])) {
-		if (is_array($myparams[$key])) {
-		    $value = $myparams[$key];
-		} else {
-		    $value = escapeshellcmd($myparams[$key]);
-		}
-	    } else {
-		if (isset($this->graphsettings[$key])) {
-		    // is this set already, is current value .. 
-		    if ((is_array($this->graphsettings[$key]) && 
-			 count($this->graphsettings[$key]) != 0) // an non empty array?
-			|| (is_scalar($this->graphsettings[$key]))) // or a scalar
-		    {
-			// yes: keep current set value
-			$value = $this->graphsettings[$key];
-		    }
-		    // no: implicit; set to default
-		} else if (is_array($value) && isset($value["default"])) {
-		    // - check if it is an min/max/default array
-		    $value = $value["default"];
-		}
-	    }
-
-	    // normalize parameters
-	    if (is_array($this->graphdefaults[$key])
-		&& isset($this->graphdefaults[$key]["max"]) 
-		&& $value > $this->graphdefaults[$key]["max"]) {
-		$value = $this->graphdefaults[$key]["max"];
-	    }
-	    if (is_array($this->graphdefaults[$key]) 
-		&& isset($this->graphdefaults[$key]["min"]) 
-		&& $value < $this->graphdefaults[$key]["min"]) {
-		$value = $this->graphdefaults[$key]["min"];
-	    }
-	    
-	    $this->graphsettings[$key] = $value;
-	}
-    }
-    
-    // will not be overloaded by child classes
-    function cmdline() {
-
-	$cmdline = $this->graphsettings["rrdtool"];
-
-	// get options
-	reset($this->options);
-	while (list($key, $value) = each($this->options)) {
-	    if (isset($this->graphsettings[$key])) {
-		$cmdline .= ' '.$value.' '.$this->graphsettings[$key];
-	    }
-	}
-	
-	$cmdline .= $this->graphsettings["rawcmdline"];
-	while (list($key, $value) = each($this->graphsettings["dsdefinition"])) {
-	    $cmdline .= ' '.$value;
-	}
-
-	while (list($key, $value) = each($this->graphsettings["graphdefinition"])) {
-	    $cmdline .= ' '.$value;
-	}
-
-	return $cmdline;
-    }
-
-    function sendimage() {
-	$cmd = $this->cmdline();
-	$this->debug($cmd);
-	header("content-type: image/png");
-	passthru($cmd);
-    }
-
-    function url2options($url) {
-	$options = array();
-	$url = urldecode($url);
-	$args = explode('&', $url);
-	$i = 0;
-	while ($i < count($args)) {
-	    $operand = split('=', $args[$i]);
-	    if (!empty($operand) 
-		&& is_array($operand) 
-		&& count($operand) >= 2) {
-		$key = htmlspecialchars(urldecode($operand[0]));
-		if ($key == "opcode") {
-		    $this->graphsettings = 
-			unserialize(
-			    gzuncompress(
-				base64_decode(
-				    urldecode($operand[1]))));
-		} else {
-		    $value = htmlspecialchars(urldecode($operand[1]));
-		    $options[$key] = $value;
-		}
-	    }
-	    $i++;
-	}
-	$this->parseoptions($options);
-    }
-    function settings2url() {
-	$settings = urlencode(
-	    base64_encode(
-		gzcompress(
-		    serialize($this->graphsettings),9)));
-	return "opcode=".$settings;
-    }
-
-    function add($setting, $valuearray) {
-	$this->graphsettings[$setting] = 
-	    array_merge($this->graphsettings[$setting], $valuearray);
-    }
-
-    function set($setting, $value) {
-	$this->graphsettings[$setting] = $value;
-    }
-
-    function get($setting) {
-	return $this->graphsettings[$setting];
-    }
-}
-
-?>

+ 0 - 212
symon/symon2web/class_if.inc

@@ -1,212 +0,0 @@
-<?php
-// $Id: class_if.inc,v 1.9 2002/11/29 10:45:46 dijkstra Exp $
-require_once("class_graph.inc");
-
-class IF_Graph extends Graph {
-    function IF_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(
-	    "if" => array(
-		"brief" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":ibytes:AVERAGE",
-			"DEF:B=".$this->get("rrdfile").":obytes:AVERAGE",
-			"CDEF:inb=A,8,*",
-			"CDEF:outb=B,8,*",
-			"CDEF:ioutb=0,outb,-"),
-		    "graphdefinition" => array(
-			"HRULE:0#000000",
-			"AREA:inb#00FF00:'in'",
-			"GPRINT:A:AVERAGE:'%6.2lf %sbps\g'",
-			"AREA:ioutb#00FFFF:'out'" ,
-			"GPRINT:outb:AVERAGE:'%6.2lf %sbps'")),
-		"bits" => array(
-		    "dsdefinition" => array(
-			'DEF:in='.$this->get("rrdfile").':ibytes:AVERAGE',
-			'DEF:out='.$this->get("rrdfile").':obytes:AVERAGE',
-			'DEF:inp='.$this->get("rrdfile").':ipackets:AVERAGE',
-			'DEF:outp='.$this->get("rrdfile").':opackets:AVERAGE',
-			'DEF:coll='.$this->get("rrdfile").':collisions:AVERAGE',
-			// bits per second
-			'CDEF:inb=in,8,*',
-			'CDEF:outb=out,8,*',
-			// outbound bits per second negated
-			'CDEF:noutb=outb,-1,*',
-			// 2% extra at each bound (+x/-x) to ensure that we see the packetloss lines
-			'CDEF:pmax=inb,100,/,102,*',
-			'CDEF:nmax=noutb,100,/,102,*',
-			// percentage of collisions
-			'CDEF:totp=inp,outp,+',
-			'CDEF:per=coll,totp,/,100,*',
-			'CDEF:p0=per,0,EQ,INF,0,IF',
-			'CDEF:p10=per,10,LE,INF,0,IF,per,0,GT,INF,0,IF,MIN',
-			'CDEF:p20=per,20,LE,INF,0,IF,per,10,GT,INF,0,IF,MIN',
-			'CDEF:p30=per,30,LE,INF,0,IF,per,20,GT,INF,0,IF,MIN',
-			'CDEF:p40=per,40,LE,INF,0,IF,per,30,GT,INF,0,IF,MIN',
-			'CDEF:p50=per,50,LE,INF,0,IF,per,40,GT,INF,0,IF,MIN',
-			'CDEF:p60=per,60,LE,INF,0,IF,per,50,GT,INF,0,IF,MIN',
-			'CDEF:p70=per,70,LE,INF,0,IF,per,60,GT,INF,0,IF,MIN',
-			'CDEF:p80=per,80,LE,INF,0,IF,per,70,GT,INF,0,IF,MIN',
-			'CDEF:p90=per,80,LE,INF,0,IF,per,80,GT,INF,0,IF,MIN',
-			'CDEF:p100=per,100,LE,INF,0,IF,per,90,GT,INF,0,IF,MIN',
-			// negative percentages
-			'CDEF:n0=p0,-1,*',
-			'CDEF:n10=p10,-1,*',
-			'CDEF:n20=p20,-1,*',
-			'CDEF:n30=p30,-1,*',
-			'CDEF:n40=p40,-1,*',
-			'CDEF:n50=p50,-1,*',
-			'CDEF:n60=p60,-1,*',
-			'CDEF:n70=p70,-1,*',
-			'CDEF:n80=p80,-1,*',
-			'CDEF:n90=p90,-1,*',
-			'CDEF:n100=p100,-1,*'),
-		    "graphdefinition" => array(
-			'LINE1:pmax',
-			'LINE1:nmax',
-			'COMMENT:"               min          avg          max          last\n"',
-			'AREA:inb#00FF00:"in     "',
-			'GPRINT:inb:MIN:" %6.2lf %sbps"',
-			'GPRINT:inb:AVERAGE:"%6.2lf %sbps"',
-			'GPRINT:inb:MAX:"%6.2lf %sbps"',
-			'GPRINT:inb:LAST:"%6.2lf %sbps\n"',
-			'STACK:p0#FAFFFA', 
-			'STACK:p10#FFFFE6',
-			'STACK:p20#FFD900',
-			'STACK:p30#FD6724',
-			'STACK:p40#E61800',
-			'STACK:p50#AB2934',
-			'STACK:p60#B2888B',
-			'STACK:p70#CC91BA',
-			'STACK:p80#6A2990',
-			'STACK:p90#0571B0',
-			'STACK:p100#000000',
-			'AREA:noutb#00FFFF:"out     "',
-			'GPRINT:outb:MIN:"%6.2lf %sbps"',
-			'GPRINT:outb:AVERAGE:"%6.2lf %sbps"',
-			'GPRINT:outb:MAX:"%6.2lf %sbps"',
-			'GPRINT:outb:LAST:"%6.2lf %sbps\n"',
-			'COMMENT:packetloss',
-			'GPRINT:per:MIN:"%6.2lf%%    "',
-			'GPRINT:per:AVERAGE:"%6.2lf%%    "',
-			'GPRINT:per:MAX:"%6.2lf%%    "',
-			'GPRINT:per:LAST:"%6.2lf%%\n"',
-			'STACK:n0#FAFFFA:" 0%  "',
-			'STACK:n10#FFFFE6:" <10%"',
-			'STACK:n20#FFD900:" <20%"',
-			'STACK:n30#FD6724:" <30%"',
-			'STACK:n40#E61800:" <40%"',
-			'STACK:n50#AB2934:" <50%\n"',
-			'STACK:n60#B2888B:" <60%"',
-			'STACK:n70#CC91BA:" <70%"',
-			'STACK:n80#6A2990:" <80%"',
-			'STACK:n90#0571B0:" <90%"',
-			'STACK:n100#000000:" <100%"')),
-		"packets" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":ipackets:AVERAGE",
-			"DEF:B=".$this->get("rrdfile").":opackets:AVERAGE",
-			"DEF:C=".$this->get("rrdfile").":imcasts:AVERAGE",
-			"DEF:D=".$this->get("rrdfile").":omcasts:AVERAGE",
-			"DEF:E=".$this->get("rrdfile").":ierrors:AVERAGE",
-			"DEF:F=".$this->get("rrdfile").":oerrors:AVERAGE",
-			"DEF:G=".$this->get("rrdfile").":collisions:AVERAGE",
-			"DEF:H=".$this->get("rrdfile").":drops:AVERAGE"),
-		    "graphdefinition" => array(
-			"AREA:A#00FF00:'ipackets'",
-			"GPRINT:A:AVERAGE:'%.0lf\g'",
-			"LINE1:B#00FFFF:'opackets'",
-			"GPRINT:B:AVERAGE:'%.0lf\g'",
-			"LINE1:C#0000FF:'imcasts'",
-			"GPRINT:C:AVERAGE:'%.0lf\g'",
-			"LINE1:D#FF00FF:'omcasts'",
-			"GPRINT:D:AVERAGE:'%.0lf\g'",
-			"LINE1:E#FF0000:'ierrors'",
-			"GPRINT:E:AVERAGE:'%.0lf\g'",
-			"LINE1:F#8B0000:'oerrors'",
-			"GPRINT:F:AVERAGE:'%.0lf\g'",
-			"LINE1:G#888888:'collisions'",
-			"GPRINT:G:AVERAGE:'%.0lf\g'",
-			"LINE1:H#000000:'drops'",
-			"GPRINT:H:AVERAGE:'%.0lf\g'")),
-		"all" => array(
-		    "dsdefinition" => array(
-			"DEF:in=".$this->get("rrdfile").":ibytes:AVERAGE",
-			"DEF:out=".$this->get("rrdfile").":obytes:AVERAGE",
-			"DEF:inp=".$this->get("rrdfile").":ipackets:AVERAGE",
-			"DEF:outp=".$this->get("rrdfile").":opackets:AVERAGE",
-			"DEF:inm=".$this->get("rrdfile").":imcasts:AVERAGE",
-			"DEF:outm=".$this->get("rrdfile").":omcasts:AVERAGE",
-			"DEF:ierr=".$this->get("rrdfile").":ierrors:AVERAGE",
-			"DEF:oerr=".$this->get("rrdfile").":oerrors:AVERAGE",
-			"DEF:coll=".$this->get("rrdfile").":collisions:AVERAGE",
-			"DEF:drop=".$this->get("rrdfile").":drops:AVERAGE"),
-		    "graphdefinition" => array(
-			"HRULE:0#000000",
-			'COMMENT:"           min          avg          max          last\n"',
-			"AREA:in#00FF00:'in '",
-			"GPRINT:in:MIN:' %6.2lf %sbps'",
-			"GPRINT:in:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:in:MAX:'%6.2lf %sbps'",
-			'GPRINT:in:LAST:"%6.2lf %sbps\n"',
-			"LINE1:out",
-			"LINE1:out#00FFFF:'out '" ,
-			"GPRINT:out:MIN:'%6.2lf %sbps'",
-			"GPRINT:out:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:out:MAX:'%6.2lf %sbps'",
-			'GPRINT:out:LAST:"%6.2lf %sbps\n"',
-			"LINE1:inp#222222:'inp '" ,
-			"GPRINT:inp:MIN:'%6.2lf %sbps'",
-			"GPRINT:inp:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:inp:MAX:'%6.2lf %sbps'",
-			'GPRINT:inp:LAST:"%6.2lf %sbps\n"',
-			"LINE1:outp#444444:'outp'" ,
-			"GPRINT:outp:MIN:'%6.2lf %sbps'",
-			"GPRINT:outp:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:outp:MAX:'%6.2lf %sbps'",
-			'GPRINT:outp:LAST:"%6.2lf %sbps\n"',
-			"LINE1:inm#666666:'inm '" ,
-			"GPRINT:inm:MIN:'%6.2lf %sbps'",
-			"GPRINT:inm:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:inm:MAX:'%6.2lf %sbps'",
-			'GPRINT:inm:LAST:"%6.2lf %sbps\n"',
-			"LINE1:outm#888888:'outm'" ,
-			"GPRINT:outm:MIN:'%6.2lf %sbps'",
-			"GPRINT:outm:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:outm:MAX:'%6.2lf %sbps'",
-			'GPRINT:outm:LAST:"%6.2lf %sbps\n"',
-			"LINE1:ierr#aaaaaa:'ierr'" ,
-			"GPRINT:ierr:MIN:'%6.2lf %sbps'",
-			"GPRINT:ierr:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:ierr:MAX:'%6.2lf %sbps'",
-			'GPRINT:ierr:LAST:"%6.2lf %sbps\n"',
-			"LINE1:oerr#cccccc:'oerr'" ,
-			"GPRINT:oerr:MIN:'%6.2lf %sbps'",
-			"GPRINT:oerr:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:oerr:MAX:'%6.2lf %sbps'",
-			'GPRINT:oerr:LAST:"%6.2lf %sbps\n"',
-			"LINE1:coll#dddddd:'coll'" ,
-			"GPRINT:coll:MIN:'%6.2lf %sbps'",
-			"GPRINT:coll:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:coll:MAX:'%6.2lf %sbps'",
-			'GPRINT:coll:LAST:"%6.2lf %sbps\n"',
-			"LINE1:drop#ffffff:'drop'" ,
-			"GPRINT:drop:MIN:'%6.2lf %sbps'",
-			"GPRINT:drop:AVERAGE:'%6.2lf %sbps'",
-			"GPRINT:drop:MAX:'%6.2lf %sbps'",
-			'GPRINT:drop:LAST:"%6.2lf %sbps\n"')))));
-
-	$this->graphdefaults = array_merge($this->graphdefaults,
-					   $this->shortcut["if"]["brief"]);
-	$this->graphsettings["rawcmdline"] .=" -v 'if(".$this->get("name").")'";
-	$this->url2options($url);
-    }
-}
-?>

+ 0 - 56
symon/symon2web/class_io.inc

@@ -1,56 +0,0 @@
-<?php
-// $Id: class_io.inc,v 1.4 2002/11/29 10:45:46 dijkstra Exp $
-require_once("class_graph.inc");
-
-class IO_Graph extends Graph {
-    function IO_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 'io(".$this->get("name").")'";
-	$this->shortcut = array_merge($this->shortcut, array(
-	    "io" => array(
-		"brief" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":bytes:AVERAGE "),
-		    "graphdefinition" => array(
-			'COMMENT:"            min          avg          max          last\n"',
-			"AREA:A#00FF00:'bytes'",
-			"GPRINT:A:MIN:'%6.2lf %sBps'",
-			"GPRINT:A:AVERAGE:'%6.2lf %sBps'",
-			"GPRINT:A:MAX:'%6.2lf %sBps'",
-			"GPRINT:A:LAST:'%6.2lf %sBps'")),
-		"all" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":transfers:AVERAGE ",
-			"DEF:B=".$this->get("rrdfile").":seeks:AVERAGE ",
-			"DEF:C=".$this->get("rrdfile").":bytes:AVERAGE "),
-		    "graphdefinition" => array(
-			'COMMENT:"               min          avg          max          last\n"',
-			"AREA:C#00FF00:'bytes    '",
-			"GPRINT:C:MIN:'%4.2lf %sBps'",
-			"GPRINT:C:AVERAGE:'%4.2lf %sBps'",
-			"GPRINT:C:MAX:'%4.2lf %sBps'",
-			'GPRINT:C:LAST:"%4.2lf %sBps\n"',
-			"LINE1:B#0000FF:'seeks    '",
-			"GPRINT:B:MIN:'%4.2lf      '",
-			"GPRINT:B:AVERAGE:'%4.2lf      '",
-			"GPRINT:B:MAX:'%4.2lf      '",
-			'GPRINT:B:LAST:"%4.2lf\n"',
-			"LINE1:A#FF0000:'transfers'",
-			"GPRINT:A:MIN:'%4.2lf      '",
-			"GPRINT:A:AVERAGE:'%4.2lf      '",
-			"GPRINT:A:MAX:'%4.2lf      '",
-			"GPRINT:A:LAST:'%4.2lf'")))));
-
-	$this->graphdefaults = array_merge($this->graphdefaults,
-					   $this->shortcut["io"]["brief"]);
-
-	$this->url2options($url);
-    }
-}
-?>

+ 0 - 76
symon/symon2web/class_mem.inc

@@ -1,76 +0,0 @@
-<?php
-// $Id: class_mem.inc,v 1.4 2002/11/29 10:45:46 dijkstra Exp $
-require_once("class_graph.inc");
-
-class MEM_Graph extends Graph {
-    function MEM_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 'mem' -b 1024 ";
-	
-	$this->shortcut = array_merge($this->shortcut, array(
-	    "mem" => array(
-		"brief" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":real_active:AVERAGE",
-			"DEF:B=".$this->get("rrdfile").":real_total:AVERAGE",
-			"DEF:C=".$this->get("rrdfile").":free:AVERAGE",
-			"DEF:D=".$this->get("rrdfile").":swap_used:AVERAGE",
-			"DEF:E=".$this->get("rrdfile").":swap_total:AVERAGE"),
-		    "graphdefinition" => array(
-			"AREA:B#008B8B:real",
-			"GPRINT:B:AVERAGE:'%.0lf%s\g'",
-			"STACK:C#3CB371:free",
-			"GPRINT:C:AVERAGE:'%.0lf%s\g'",
-			"LINE1:A#00FFFF:active",
-			"GPRINT:A:AVERAGE:'%.0lf%s\g'",
-			"LINE1:D#888C00:swap_used",
-			"GPRINT:D:AVERAGE:'%.0lf%s\g'",
-			"LINE2:E#FF8C00:swap_total",
-			"GPRINT:E:AVERAGE:'%.0lf%s\g'")),
-		"detailed" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":real_active:AVERAGE",
-			"DEF:B=".$this->get("rrdfile").":real_total:AVERAGE",
-			"DEF:C=".$this->get("rrdfile").":free:AVERAGE",
-			"DEF:D=".$this->get("rrdfile").":swap_used:AVERAGE",
-			"DEF:E=".$this->get("rrdfile").":swap_total:AVERAGE"),
-		    "graphdefinition" => array(
-			'COMMENT:"                  min        avg        max        last\n"',
-			'AREA:B#008B8B:"real      "',
-			'GPRINT:B:MIN:" %6.2lf %sb"',
-			'GPRINT:B:AVERAGE:"%6.2lf %sb"',
-			'GPRINT:B:MAX:"%6.2lf %sb"',
-			'GPRINT:B:LAST:"%6.2lf %sb\n"',
-			'STACK:C#3CB371:"free      "',
-			'GPRINT:C:MIN:" %6.2lf %sb"',
-			'GPRINT:C:AVERAGE:"%6.2lf %sb"',
-			'GPRINT:C:MAX:"%6.2lf %sb"',
-			'GPRINT:C:LAST:"%6.2lf %sb\n"',
-			'LINE1:A#00FFFF:"active    "',
-			'GPRINT:A:MIN:" %6.2lf %sb"',
-			'GPRINT:A:AVERAGE:"%6.2lf %sb"',
-			'GPRINT:A:MAX:"%6.2lf %sb"',
-			'GPRINT:A:LAST:"%6.2lf %sb\n"',
-			'LINE1:D#888C00:"swap used "',
-			'GPRINT:D:MIN:" %6.2lf %sb"',
-			'GPRINT:D:AVERAGE:"%6.2lf %sb"',
-			'GPRINT:D:MAX:"%6.2lf %sb"',
-			'GPRINT:D:LAST:"%6.2lf %sb\n"',
-			'LINE2:E#FF8C00:"swap total"',
-			'GPRINT:E:MIN:" %6.2lf %sb"',
-			'GPRINT:E:AVERAGE:"%6.2lf %sb"',
-			'GPRINT:E:MAX:"%6.2lf %sb"',
-			'GPRINT:E:LAST:"%6.2lf %sb\n"')))));
-
-	$this->graphdefaults = array_merge($this->graphdefaults, 
-					   $this->shortcut["mem"]["brief"]);
-	$this->url2options($url);
-    }
-}
-?>

+ 0 - 240
symon/symon2web/class_pf.inc

@@ -1,240 +0,0 @@
-<?php
-// $Id: class_pf.inc,v 1.4 2002/11/29 10:45:46 dijkstra Exp $
-require_once("class_graph.inc");
-
-class PF_Graph extends Graph {
-    function PF_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->shortcut = array_merge($this->shortcut, array(
-	    "pf" => array(
-		"brief" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":bytes:AVERAGE "),
-		    "graphdefinition" => array(
-			'COMMENT:"            min          avg          max          last\n"',
-			"AREA:A#00FF00:'bytes'",
-			"GPRINT:A:MIN:'%6.2lf %sBps'",
-			"GPRINT:A:AVERAGE:'%6.2lf %sBps'",
-			"GPRINT:A:MAX:'%6.2lf %sBps'",
-			"GPRINT:A:LAST:'%6.2lf %sBps'")),
-		"all" => array(
-		    "dsdefinition" => array(
-			"DEF:A=".$this->get("rrdfile").":bytes_v4_in:AVERAGE ",
-			"DEF:B=".$this->get("rrdfile").":bytes_v4_out:AVERAGE ",
-			"DEF:C=".$this->get("rrdfile").":bytes_v6_in:AVERAGE ",
-			"DEF:D=".$this->get("rrdfile").":bytes_v6_out:AVERAGE ",
-			"DEF:E=".$this->get("rrdfile").":packets_v4_in_pass:AVERAGE ",
-			"DEF:F=".$this->get("rrdfile").":packets_v4_in_drop:AVERAGE ",
-			"DEF:G=".$this->get("rrdfile").":packets_v4_out_pass:AVERAGE ",
-			"DEF:H=".$this->get("rrdfile").":packets_v4_out_drop:AVERAGE ",
-			"DEF:J=".$this->get("rrdfile").":packets_v6_in_pass:AVERAGE ",
-			"DEF:K=".$this->get("rrdfile").":packets_v6_in_drop:AVERAGE ",
-			"DEF:L=".$this->get("rrdfile").":packets_v6_out_pass:AVERAGE ",
-			"DEF:M=".$this->get("rrdfile").":packets_v6_out_drop:AVERAGE ",
-			"DEF:N=".$this->get("rrdfile").":states_entries:MAX ",
-			"DEF:O=".$this->get("rrdfile").":states_searches:AVERAGE ",
-			"DEF:P=".$this->get("rrdfile").":states_inserts:AVERAGE ",
-			"DEF:Q=".$this->get("rrdfile").":states_removals:AVERAGE ",
-			"DEF:R=".$this->get("rrdfile").":counters_match:AVERAGE ",
-			"DEF:S=".$this->get("rrdfile").":counters_badoffset:AVERAGE ",
-			"DEF:T=".$this->get("rrdfile").":counters_fragment:AVERAGE ",
-			"DEF:U=".$this->get("rrdfile").":counters_short:AVERAGE ",
-			"DEF:V=".$this->get("rrdfile").":counters_normalize:AVERAGE ",
-			"DEF:W=".$this->get("rrdfile").":counters_memory:AVERAGE "),    
-		    "graphdefinition" => array(
-			'COMMENT:"                     min          avg          max          last\n"',
-			'LINE1:A#000000:"bytes_v4_in"',
-			"GPRINT:A:MIN:'        %4.2lf %sBps'",
-			"GPRINT:A:AVERAGE:'%4.2lf %sBps'",
-			"GPRINT:A:MAX:'%4.2lf %sBps'",
-			'GPRINT:A:LAST:"%4.2lf %sBps\n"',
-			'LINE1:B#0B0B0B:"bytes_v4_out"',
-			"GPRINT:B:MIN:'       %4.2lf %sBps'",
-			"GPRINT:B:AVERAGE:'%4.2lf %sBps'",
-			"GPRINT:B:MAX:'%4.2lf %sBps'",
-			'GPRINT:B:LAST:"%4.2lf %sBps\n"',
-			'LINE1:C#161616:"bytes_v6_in"',
-			"GPRINT:C:MIN:'        %4.2lf %sBps'",
-			"GPRINT:C:AVERAGE:'%4.2lf %sBps'",
-			"GPRINT:C:MAX:'%4.2lf %sBps'",
-			'GPRINT:C:LAST:"%4.2lf %sBps\n"',
-			'LINE1:D#212121:"bytes_v6_out"',
-			"GPRINT:D:MIN:'       %4.2lf %sBps'",
-			"GPRINT:D:AVERAGE:'%4.2lf %sBps'",
-			"GPRINT:D:MAX:'%4.2lf %sBps'",
-			'GPRINT:D:LAST:"%4.2lf %sBps\n"',
-			'LINE1:E#2C2C2C:"packets_v4_in_pass"',
-			"GPRINT:E:MIN:' %4.2lf     '",
-			"GPRINT:E:AVERAGE:'%4.2lf     '",
-			"GPRINT:E:MAX:'%4.2lf     '",
-			'GPRINT:E:LAST:"%4.2lf\n"',
-			'LINE1:F#373737:"packets_v4_in_drop"',
-			"GPRINT:F:MIN:' %4.2lf     '",
-			"GPRINT:F:AVERAGE:'%4.2lf     '",
-			"GPRINT:F:MAX:'%4.2lf     '",
-			'GPRINT:F:LAST:"%4.2lf\n"',
-			'LINE1:G#424242:"packets_v4_out_pass"',
-			"GPRINT:G:MIN:'%4.2lf     '",
-			"GPRINT:G:AVERAGE:'%4.2lf     '",
-			"GPRINT:G:MAX:'%4.2lf     '",
-			'GPRINT:G:LAST:"%4.2lf\n"',
-			'LINE1:H#4D4D4D:"packets_v4_out_drop"',
-			"GPRINT:H:MIN:'%4.2lf     '",
-			"GPRINT:H:AVERAGE:'%4.2lf     '",
-			"GPRINT:H:MAX:'%4.2lf     '",
-			'GPRINT:H:LAST:"%4.2lf\n"',
-			'LINE1:J#585858:"packets_v6_in_pass"',
-			"GPRINT:J:MIN:' %4.2lf     '",
-			"GPRINT:J:AVERAGE:'%4.2lf     '",
-			"GPRINT:J:MAX:'%4.2lf     '",
-			'GPRINT:J:LAST:"%4.2lf\n"',
-			'LINE1:K#636363:"packets_v6_in_drop"',
-			"GPRINT:K:MIN:' %4.2lf     '",
-			"GPRINT:K:AVERAGE:'%4.2lf     '",
-			"GPRINT:K:MAX:'%4.2lf     '",
-			'GPRINT:K:LAST:"%4.2lf\n"',
-			'LINE1:L#6E6E6E:"packets_v6_out_pass"',
-			"GPRINT:L:MIN:'%4.2lf     '",
-			"GPRINT:L:AVERAGE:'%4.2lf     '",
-			"GPRINT:L:MAX:'%4.2lf     '",
-			'GPRINT:L:LAST:"%4.2lf\n"',
-			'LINE1:M#797979:"packets_v6_out_drop"',
-			"GPRINT:M:MIN:'%4.2lf     '",
-			"GPRINT:M:AVERAGE:'%4.2lf     '",
-			"GPRINT:M:MAX:'%4.2lf     '",
-			'GPRINT:M:LAST:"%4.2lf\n"',
-			'LINE1:N#848484:"states_entries"',
-			"GPRINT:N:MIN:'     %4.2lf     '",
-			"GPRINT:N:AVERAGE:'%4.2lf    '",
-			"GPRINT:N:MAX:'%4.2lf     '",
-			'GPRINT:N:LAST:"%4.2lf\n"',
-			'LINE1:O#8F8F8F:"states_searches"',
-			"GPRINT:O:MIN:'    %4.2lf    '",
-			"GPRINT:O:AVERAGE:'%4.2lf   '",
-			"GPRINT:O:MAX:'%4.2lf   '",
-			'GPRINT:O:LAST:"%4.2lf\n"',
-			'LINE1:P#9A9A9A:"states_inserts"',
-			"GPRINT:P:MIN:'     %4.2lf     '",
-			"GPRINT:P:AVERAGE:'%4.2lf     '",
-			"GPRINT:P:MAX:'%4.2lf     '",
-			'GPRINT:P:LAST:"%4.2lf\n"',
-			'LINE1:Q#A5A5A5:"states_removals"',
-			"GPRINT:Q:MIN:'    %4.2lf     '",
-			"GPRINT:Q:AVERAGE:'%4.2lf     '",
-			"GPRINT:Q:MAX:'%4.2lf     '",
-			'GPRINT:Q:LAST:"%4.2lf\n"',
-			'LINE1:R#B0B0B0:"counters_match"',
-			"GPRINT:R:MIN:'     %4.2lf     '",
-			"GPRINT:R:AVERAGE:'%4.2lf    '",
-			"GPRINT:R:MAX:'%4.2lf    '",
-			'GPRINT:R:LAST:"%4.2lf\n"',
-			'LINE1:S#BBBBBB:"counters_badoffset"',
-			"GPRINT:S:MIN:' %4.2lf     '",
-			"GPRINT:S:AVERAGE:'%4.2lf     '",
-			"GPRINT:S:MAX:'%4.2lf     '",
-			'GPRINT:S:LAST:"%4.2lf\n"',
-			'LINE1:T#C6C6C6:"counters_fragment"',
-			"GPRINT:T:MIN:'  %4.2lf     '",
-			"GPRINT:T:AVERAGE:'%4.2lf     '",
-			"GPRINT:T:MAX:'%4.2lf     '",
-			'GPRINT:T:LAST:"%4.2lf\n"',
-			'LINE1:U#D1D1D1:"counters_short"',
-			"GPRINT:U:MIN:'     %4.2lf     '",
-			"GPRINT:U:AVERAGE:'%4.2lf     '",
-			"GPRINT:U:MAX:'%4.2lf     '",
-			'GPRINT:U:LAST:"%4.2lf\n"',
-			'LINE1:V#DCDCDC:"counters_normalize"',
-			"GPRINT:V:MIN:' %4.2lf     '",
-			"GPRINT:V:AVERAGE:'%4.2lf     '",
-			"GPRINT:V:MAX:'%4.2lf     '",
-			'GPRINT:V:LAST:"%4.2lf\n"',
-			'LINE1:W#E7E7E7:"counters_memory"',
-			"GPRINT:W:MIN:'    %4.2lf     '",
-			"GPRINT:W:AVERAGE:'%4.2lf     '",
-			"GPRINT:W:MAX:'%4.2lf     '",
-			'GPRINT:W:LAST:"%4.2lf\n"')),
-		"state" => array(
-		    "dsdefinition" => array(
-			"DEF:N=".$this->get("rrdfile").":states_entries:MAX ",
-			"DEF:O=".$this->get("rrdfile").":states_searches:AVERAGE ",
-			"DEF:P=".$this->get("rrdfile").":states_inserts:AVERAGE ",
-			"DEF:Q=".$this->get("rrdfile").":states_removals:AVERAGE ",
-			"CDEF:NQ=0,Q,- "),
-		    "graphdefinition" => array(
-			'COMMENT:"                     min    avg    max    last\n"',
-			'AREA:N#00FF00:"states_entries"',
-			"GPRINT:N:MIN:'%4.2lf'",
-			"GPRINT:N:AVERAGE:'%4.2lf'",
-			"GPRINT:N:MAX:'%4.2lf'",
-			'GPRINT:N:LAST:"%4.2lf\n"',
-			'LINE1:P#0000FF:"states_inserts "',
-			"GPRINT:P:MIN:'%4.2lf'",
-			"GPRINT:P:AVERAGE:'%4.2lf'",
-			"GPRINT:P:MAX:'%4.2lf'",
-			'GPRINT:P:LAST:"%4.2lf\n"',
-			'LINE1:NQ#FF0000:"states_removals"',
-			"GPRINT:Q:MIN:'%4.2lf'",
-			"GPRINT:Q:AVERAGE:'%4.2lf'",
-			"GPRINT:Q:MAX:'%4.2lf'",
-			'GPRINT:Q:LAST:"%4.2lf\n"')),
-		"performance" => array(
-		    "dsdefinition" => array(
-			'COMMENT:"                     min      avg      max      last\n"',
-			"DEF:O=".$this->get("rrdfile").":states_searches:AVERAGE ",
-			"DEF:R=".$this->get("rrdfile").":counters_match:AVERAGE ",
-			"DEF:S=".$this->get("rrdfile").":counters_badoffset:AVERAGE ",
-			"DEF:T=".$this->get("rrdfile").":counters_fragment:AVERAGE ",
-			"DEF:U=".$this->get("rrdfile").":counters_short:AVERAGE ",
-			"DEF:V=".$this->get("rrdfile").":counters_normalize:AVERAGE ",
-			"DEF:W=".$this->get("rrdfile").":counters_memory:AVERAGE "),    
-		    "graphdefinition" => array(
-			'LINE1:O#FFD900:"states_searches   "',
-			"GPRINT:O:MIN:'%4.2lf'",
-			"GPRINT:O:AVERAGE:'%4.2lf'",
-			"GPRINT:O:MAX:'%4.2lf'",
-			'GPRINT:O:LAST:"%4.2lf\n"',
-			'LINE1:R#FD6724:"counters_match    "',
-			"GPRINT:R:MIN:'%4.2lf'",
-			"GPRINT:R:AVERAGE:'%4.2lf'",
-			"GPRINT:R:MAX:'%4.2lf'",
-			'GPRINT:R:LAST:"%4.2lf\n"',
-			'LINE1:S#E61800:"counters_badoffset"',
-			"GPRINT:S:MIN:'%4.2lf'",
-			"GPRINT:S:AVERAGE:'%4.2lf'",
-			"GPRINT:S:MAX:'%4.2lf'",
-			'GPRINT:S:LAST:"%4.2lf\n"',
-			'LINE1:T#AB2934:"counters_fragment "',
-			"GPRINT:T:MIN:'%4.2lf'",
-			"GPRINT:T:AVERAGE:'%4.2lf'",
-			"GPRINT:T:MAX:'%4.2lf'",
-			'GPRINT:T:LAST:"%4.2lf\n"',
-			'LINE1:U#B2888B:"counters_short    "',
-			"GPRINT:U:MIN:'%4.2lf'",
-			"GPRINT:U:AVERAGE:'%4.2lf'",
-			"GPRINT:U:MAX:'%4.2lf'",
-			'GPRINT:U:LAST:"%4.2lf\n"',
-			'LINE1:V#CC91BA:"counters_normalize"',
-			"GPRINT:V:MIN:'%4.2lf'",
-			"GPRINT:V:AVERAGE:'%4.2lf'",
-			"GPRINT:V:MAX:'%4.2lf'",
-			'GPRINT:V:LAST:"%4.2lf\n"',
-			'LINE1:W#6A2990:"counters_memory   "',
-			"GPRINT:W:MIN:'%4.2lf'",
-			"GPRINT:W:AVERAGE:'%4.2lf'",
-			"GPRINT:W:MAX:'%4.2lf'",
-			"GPRINT:W:LAST:'%4.2lf\n'")))));
-
-	$this->graphsettings["rawcmdline"] .=" -v 'pf'";
-	$this->graphdefaults = array_merge($this->graphdefaults,
-					   $this->shortcut["pf"]["state"]);
-
-	$this->url2options($url);
-    }
-}
-?>

+ 0 - 87
symon/symon2web/class_proc.inc

@@ -1,87 +0,0 @@
-<?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);
-
-    }
-}
-?>

+ 0 - 17
symon/symon2web/datasources.inc

@@ -1,17 +0,0 @@
-<?php
-// $Id: datasources.inc,v 1.10 2002/10/18 12:30:20 dijkstra Exp $
-//
-// Contains definitions where the data files are to be found
-$symon2web["tree"]='/export/store_3/symon';
-
-// Show all datasources at once or provide a selection of hosts to be shown
-// Values: all|one
-//$symon2web["view"]='one';
-$symon2web["view"]='all';
-
-// Click on graph is zoom to this size
-// Values: '' = not clickable | tiny | small | normal | big | huge
-//$symon2web["magnify"]='';
-$symon2web["magnify"]='big';
-
-?>

+ 0 - 8
symon/symon2web/graph_cpu.php

@@ -1,8 +0,0 @@
-<?php
-// $Id: graph_cpu.php,v 1.8 2002/11/29 10:45:46 dijkstra Exp $
-require_once("datasources.inc");
-require_once("class_cpu.inc");
-$g = new CPU_Graph();
-$g->execute($HTTP_SERVER_VARS["QUERY_STRING"]);
-$g->sendimage();
-?>

+ 0 - 8
symon/symon2web/graph_debug.php

@@ -1,8 +0,0 @@
-<?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();
-?>

+ 0 - 8
symon/symon2web/graph_if.php

@@ -1,8 +0,0 @@
-<?php
-// $Id: graph_if.php,v 1.9 2002/11/29 10:45:46 dijkstra Exp $
-require_once("datasources.inc");
-require_once("class_if.inc");
-$g = new IF_Graph();
-$g->execute($HTTP_SERVER_VARS["QUERY_STRING"]);
-$g->sendimage();
-?>

+ 0 - 8
symon/symon2web/graph_io.php

@@ -1,8 +0,0 @@
-<?php
-// $Id: graph_io.php,v 1.5 2002/11/29 10:45:46 dijkstra Exp $
-require_once("datasources.inc");
-require_once("class_io.inc");
-$g = new IO_Graph();
-$g->execute($HTTP_SERVER_VARS["QUERY_STRING"]);
-$g->sendimage();
-?>

+ 0 - 8
symon/symon2web/graph_mem.php

@@ -1,8 +0,0 @@
-<?php
-// $Id: graph_mem.php,v 1.8 2002/11/29 10:45:46 dijkstra Exp $
-require_once("datasources.inc");
-require_once("class_mem.inc");
-$g = new MEM_Graph();
-$g->execute($HTTP_SERVER_VARS["QUERY_STRING"]);
-$g->sendimage();
-?>

+ 0 - 8
symon/symon2web/graph_pf.php

@@ -1,8 +0,0 @@
-<?php
-// $Id: graph_pf.php,v 1.3 2002/11/29 10:45:46 dijkstra Exp $
-require_once("datasources.inc");
-require_once("class_pf.inc");
-$g = new PF_Graph();
-$g->execute($HTTP_SERVER_VARS["QUERY_STRING"]);
-$g->sendimage();
-?>

+ 0 - 8
symon/symon2web/graph_proc.php

@@ -1,8 +0,0 @@
-<?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();
-?>

+ 0 - 294
symon/symon2web/index.php

@@ -1,294 +0,0 @@
-<?php
-// $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' 
-    $options = array();
-    $allargs = explode('&', $args);
-    $i = 0;
-    $selected_machine = "";
-    while ($i < count($allargs)) {
-	$operand = split('=', $allargs[$i]);
-	if (count($operand) == 2) {
-	    // options for this page
-	    if ($operand[0] == "machine") {
-		$selected_machine = $operand[1];
-	    }
-	    $options[$operand[0]]=$operand[1];
-	}
-	$i++;
-    }
-    // decode done, now recode
-    $i = 0;
-    $args = "";
-    reset($options);
-    while (list($key,$val) = each($options)) {
-	if ($args) {
-	    $args .= '&';
-	}
-	$args .= $key.'='.$val;
-    }
-} else {
-    $args = "";
-    $selected_machine = "";
-}
-function make_graph_url($type, $new_args) {
-    global $args;
-    $new_args = urlencode($new_args);
-    $url = "graph_".$type.".php?";
-    $allargs="";
-    if ($args) {
-	$allargs.=$args.'&';
-    }
-    $allargs .= $new_args;
-
-    switch ($type) {
-    case 'cpu':
-	$g = new CPU_Graph();
-	break;
-    case 'if':
-	$g = new IF_Graph();
-	break;
-    case 'io':
-	$g = new IO_Graph();
-	break;
-    case 'mem':
-	$g = new MEM_Graph();
-	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());
-}
-function print_index_url($new_args) {
-    global $args;
-    $url = 'index.php?';
-    if ($args) {
-	$url.=$args.'&';
-    }
-    $url .= sprintf("%s", $new_args);
-
-    print $url;
-}
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>symon statistics</title>
- <link rel="stylesheet" href="symon.css" type="text/css" />
-</head>
-<body>
- <table border="0" cellspacing="0" cellpadding="0" align="center">
-  <tr>
-   <td valign="top">
-    <table border="0" cellpadding="0" cellspacing="0">
-     <tr>
-      <td width="5%"></td>
-      <td colspan="5" bgcolor="#555599"><img src="spacer.png" width="1" height="1" alt="|"/></td>
-      <td width="5%"></td>
-     </tr>
-     <tr>
-      <!-- sidebar -->
-      <td width="5%"></td>
-      <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1" alt="|"/></td>
-      <td bgcolor="#FFFFFF" valign="top" width="20%">
-       <div class="left">
-        <img src="symon.png" width="149" border="0" alt="[symon]" />
-       </div> 
-
-       <div class="left">
-        <div class="section-head">Graph Options</div>
-        <div class="left-links">
-	 Timespan: 
-	 <a href="<? print_index_url("start=-14515200") ?>">last 6 months</a>, 
-	 <a href="<? print_index_url("start=-2419200") ?>">last month</a>,
-	 <a href="<? print_index_url("start=-691200") ?>">last 8 days</a>,
-	 <a href="<? print_index_url("start=-86400") ?>">last 24 hours</a>,
-	 <a href="<? print_index_url("start=-3600") ?>">last hour</a><br />
-	 Size: 
-	 <a href="<? print_index_url("size=tiny") ?>">tiny</a>, 
-	 <a href="<? print_index_url("size=small") ?>">small</a>, 
-	 <a href="<? print_index_url("size=normal") ?>">normal</a>, 
-	 <a href="<? print_index_url("size=big") ?>">big</a>, 
-	 <a href="<? print_index_url("size=huge") ?>">huge</a><br />
-	</div>
-	<div class="section-head">Type options</div>
-	<div class="left-links">
-	 Cpu:
-	 <a href="<? print_index_url("cpu=brief")?> ">brief</a>,
-	 <a href="<? print_index_url("cpu=detailed")?> ">detailed</a><br />
-	 If:
-	 <a href="<? print_index_url("if=brief")?> ">brief</a>,
-	 <a href="<? print_index_url("if=bits")?> ">bits</a>,
-	 <a href="<? print_index_url("if=packets")?> ">packets</a>,
-	 <a href="<? print_index_url("if=all")?> ">all</a><br />
-	 Io:
-	 <a href="<? print_index_url("io=brief")?> ">brief</a>,
-	 <a href="<? print_index_url("io=all")?> ">all</a><br />
-	 Mem:
-	 <a href="<? print_index_url("mem=brief")?> ">brief</a>,
-	 <a href="<? print_index_url("mem=detailed")?> ">detailed</a><br />
-	 Pf:
-	 <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>
-
-     <!-- main window -->
-      <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1"></td>
-      <td bgcolor="#FFFFFF" valign="top" width="95%">
-       <div align="center" class="blue">
-        <table bgcolor="#6699CC" border="0" cellpadding="0" cellspacing="0">
-         <tr>
-<?
-	 // get machines
-	 $root_dir = dir($symon2web["tree"]);
-         while ($machine = $root_dir->read()) {
-	     if ($machine != '.' && 
-		 $machine != '..' && 
-		 is_dir($symon2web["tree"]."/".$machine)) {
-		 $symon2web["machine"][$machine] = $symon2web["tree"]."/".$machine;
-
-		 if ($machine == $selected_machine) {
-		     $selected_dir = $symon2web["machine"][$machine];
-		 }
-	     }
-	 }
-
-         // show blue bar
-         if ($symon2web["view"] == "one") {
-	     print '
-          <td><a class="blue" href="';
-	     print_index_url("machine=all");
-	     print '">all machines</a>&nbsp;&nbsp;&nbsp;</td>
-';
-	 }
-	     
-         reset($symon2web["machine"]);
-         while (list($machine, $dir) = each($symon2web["machine"])) {
-	     print '
-          <td><a class="blue" href="';
-	     if ($symon2web["view"] == "one") {
-		 print_index_url("machine=" . $machine);
-	     } else {
-		 print_index_url("#" . $machine);
-	     }
-	     print '">'. $machine . "</a>&nbsp;&nbsp;&nbsp;</td>\n";
-	 }
-?>
-	 </tr>
-        </table>
-       </div>
-
-       <div class="items">
-	
-<?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" ) {
-      unset($symon2web["machine"]);
-      if ($selected_machine) {
-	  $symon2web["machine"][$selected_machine] = $selected_dir;
-      }
-  }
-// show graphs for each machine in the machine array
-  while (list($machine, $dir) = each($symon2web["machine"])) {
-      print '
-        <!-- item start -->
-        <div class="header">
-	 <a class="header" name="'. $machine . '">'. $machine. '</a><br />
-	</div>
-';
-      $machine_dir = dir($dir);
-      while ($filename = $machine_dir->read()) {
-	  $file = $dir."/".$filename;
-	  if (is_file($file) && 
-	      preg_match("/^(cpu|if|io|mem|pf|proc|debug)(_([a-z]+))?([0-9]?).rrd$/", 
-			 $filename, $match)) {
-	      $rrdtype = $match[1];
-	      $rrdwhat = $match[3];
-	      $rrdwhich = $match[4];
-	      
-	      $cmd = make_graph_url($rrdtype,
-				    "rrdfile=".$file.
-				    "&name=".$rrdwhat.$rrdwhich);
-	      if ($symon2web["magnify"] != '') {
-		  $magcmd = make_graph_url($rrdtype,
-					   "rrdfile=".$file.
-					   "&name=".$rrdwhat.$rrdwhich.
-					   "&size=".$symon2web["magnify"]);
-		  print '<a class="graph" href="'. $magcmd . '"> <img src="' . $cmd . 
-		      '" alt="'. $rrdtype . $rrdwhat . $rrdwhich .'"></a>'."\n";
-	      } else {
-		  print '<img src="' . $cmd . '" alt="'. $rrdtype . $rrdwhat . $rrdwhich .'">'."\n";
-	      }
-
-	      $found_machine++;
-	  }
-      }
-      print '
-        <div class="item-footer"></div>
-';
-
-  }
-  
-  if ($found_machine == 0) {
-      if ($symon2web["view"] == "one") {
-	  print 'Please select a machine';
-      } else {
-	  print 'Did not find any host directories in '.$symon2web["tree"].'<br>';
-      }
-  }
-?>
-       <div class="copyright">Copyright &copy; 2002 Willem Dijkstra</div>
-      </div> <!-- end items div -->
-
-      </td> <!-- end main window -->
-
-      <!-- horizontal endline -->
-      <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1" alt="|" /></td>
-     </tr>
-
-      <!-- vertical endline -->
-     <tr> 
-      <td width="5%"></td>
-      <td colspan="5" bgcolor="#555599"><img src="spacer.png" width="1" height="1" alt="|" /></td>
-      <td width="5%"></td>
-     </tr>
-
-    </table>
-   </td>
-   <td width="5%"></td>
-  </tr>
- </table>
-</body>
-</html>

BIN
symon/symon2web/spacer.png


+ 0 - 255
symon/symon2web/symon.css

@@ -1,255 +0,0 @@
-body {
-	background-color:#EDEDED;
-	margin: 0px 0px 0px 0px;
-	padding: 0px 0px 0px 0px;
-	color:#333;
-	font-family:verdana, arial, helvetica;
-	font-size:10px;
-	line-height:16px;
-}
-
-a { 
-	font-family:verdana, arial, helvetica; 
-	font-size:11px; 
-	color: #666; 
-	text-decoration: underline; 
-	line-height:19px; 
-	background-color:#FFF;
-} 
-a:link { 
-	color: #666; 
-	text-decoration: underline; 
-	background-color:#FFF;
-} 
-a:visited { 
-	color: #666; 
-	text-decoration: underline; 
-	background-color:#FFF;
-} 
-a:active { 
-	color: #99CC66; 
-	background-color:#FFF;
-} 
-a:hover { 
-	color: #6699CC; 
-	background-color:#FFF;
-} 
-
-a.blue { 
-	color: #FFF; 
-	font-family:verdana, arial, helvetica; 
-	font-weight:normal; 
-	font-size:11px; 
-	text-decoration: underline; 
-	padding-left:15px; 
-	padding-right:15px; 
-	background-color:#6699CC;
-} 
-a.blue:visited { 
-	color: #FFF; 
-	text-decoration: underline; 
-	background-color:#6699CC;
-} 
-a.blue:active { 
-	color: #DDDDDD; 
-	text-decoration: underline; 
-	background-color:#6699CC;
-} 
-a.blue:hover { 
-	color: #FFF; 
-	text-decoration:none; 
-	background-color:#4578AB;
-} 
-
-a.graph { 
-	text-decoration: none; 
-	padding-left:0px; 
-	padding-right:0px; 
-	font-size:11px; 
-	color: #FFFFFF; 
-	line-height:0px; 
-	background-color:#FFFFF;
-} 
-
-a.source { 
-	font-family:Courier, MS Courier New, Prestige, Everson Mono; 
-	font-size:12px; 
-	color: #000; 
-	text-decoration: underline; 
-	background-color:#EEEEEE; 
-	padding:1px;
-} 
-a.source:link { 
-	color: #000; 
-	text-decoration: underline; 
-	background-color:#EEEEEE;
-} 
-a.source:visited { 
-	color: #000; 
-	text-decoration: underline; 
-	background-color:#EEEEEE;
-} 
-a.source:active	{ 
-	color: #FFFFFF; 
-	background-color:#888888;
-} 
-a.source:hover { 
-	color: #FFF; text-decoration:none; 
-	background-color:#AAAAAA;
-} 
-
-a.header { 
-	font-family:verdana, arial, helvetica; font-size:11px; 
-	color: #666; 
-	text-decoration: none; 
-	line-height:19px; 
-	background-color:#FFF;
-} 
-a.header:link { 
-	color: #666; 
-	text-decoration: none; 
-	background-color:#FFF;
-} 
-a.header:visited { 
-	color: #666; 
-	text-decoration: none; 
-	background-color:#FFF;
-} 
-a.header:active { 
-	color: #99CC66; 
-	background-color:#FFF;
-} 
-a.header:hover { 
-	color: #6699CC; 
-	background-color:#FFF;
-} 
-
-.links {
-	background-color:#FFF;
-	width:200px;
-	font-family:geneva, verdana, trebuchet MS, trebuchet, verdana, arial, sans-serif;
-	font-size:9px;
-	line-height:17px;
-	color:#000;
-	padding-bottom:15px;
-	border-bottom:1px solid #ccc;
-	margin-bottom:15px;	
-}
-	
-	
-.left {
-	background-color:#FFF;
-	font-family:geneva, verdana, trebuchet MS, trebuchet, verdana, arial, sans-serif;
-	font-size:9px;
-	line-height:17px;
-	color:#000;
-	margin-bottom:15px;
-	padding-left:7px;
-}	
-	
-.blue {
-	background-color:#6699CC;
-	font-family:verdana, trebuchet MS, trebuchet, verdana, arial, sans-serif;
-	font-size:9px;
-	line-height:17px;
-	color:#000;
-	padding-top:3px;	
-	padding-bottom:3px;	
-	height:20px
-	text-align:center;
-}	
-	
-.source {
-	background-color:#EEEEEE;
-	font-family:Courier, MS Courier New, Prestige, Everson Mono;
-	font-size:12px;
-	line-height:13px;
-	color:#000;
-	padding-left:10px;
-	padding-top:5px;
-	border-bottom:1px solid #999;
-	padding-bottom:15px;	
-}
-	
-.page-title {
-	background-color:#CCCC66;
-	padding-left:10px;
-	padding-top:5px;
-	border-bottom:1px solid #999;
-	padding-right:10px;	
-	text-align:right;
-	font-family:verdana, arial, helvetica;
-	font-size:18px;
-	color:#FFF;
-	font-weight:bold;
-	padding-bottom:5px;	
-}
-
-
-.items {
-	background-color:#FFF;
-	font-family:verdana, trebuchet MS, trebuchet, verdana, arial, sans-serif;
-	font-size:11px;
-	line-height:17px;
-	color:#333;
-	padding-left:10px;
-	padding-right:10px;
-	padding-top:5px;
-}
-
-
-.header {
-	background-color:#FFF;
-	font-family:verdana, trebuchet MS, trebuchet, verdana, arial, sans-serif;
-	font-size:10px;
-	text-transform:uppercase;
-	font-weight:bold;
-	line-height:12px;
-	color:#666;
-	padding-left:2px;
-	margin-top:10px;		
-}		
-	
-p {
-	color:#333;
-	font-family: verdana, arial, helvetica;
-	font-size:11px;
-	line-height:17px;
-}
-
-.item-footer {
-	background-color:#FFF;
-	font-family:geneva, verdana, arial, sans-serif;
-	font-size:9px;
-	line-height:12px;
-	color:#666;
-	margin-top:10px;
-	text-align:right;
-	margin-bottom:20px;
-	padding-bottom:10px;
-	border-bottom:1px solid #999;		
-}
-	
-.section-head {
-	background-color:#FFF;
-	font-family:verdana, trebuchet MS, trebuchet, verdana, arial, sans-serif;
-	font-size:11px;
-	line-height:17px;
-	font-weight:bold;
-	color:#333;
-	padding-top:15px;
-	margin-bottom:0px;		
-}	
-		
-.left-links {
-	padding-left:20px;		
-}	
-
-.copyright {
-	font-family: geneva, arial, verdana, helvetica, sans-serif;
-	font-size: 9px;
-	margin-top:5px;
-	text-align:center;
-	color:#999;
-}		
-	

BIN
symon/symon2web/symon.png


+ 0 - 78
symon/symon2web/test_config.php

@@ -1,78 +0,0 @@
-<html>
- <head>
-  <title>Symon2Web configuration test</title>
- </head>
- <body>
-<?php
-// $Id: test_config.php,v 1.3 2003/01/26 20:41:02 dijkstra Exp $
-//
-// Test configuration variables
-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');
-
-// Test to see if we can find rrdtool
-// Test to see if we can run rrdtool
-print "Trying to find rrdtool:<b>";
-$g = new CPU_Graph();
-$g->init(); $a = ""; $g->parseoptions($a);
-$rrdtool = substr($g->get("rrdtool"), 0, strpos($g->get("rrdtool"), " "));
-print $rrdtool . "<br>\n";
-if (!is_string($rrdtool)) {
-    exit("Internal error, class_graph does not set a default rrdtool location!");
-} else {
-    if (!is_file($rrdtool)) {
-	exit("'$rrdtool' does not point to a file");
-    }
-
-    if (!is_executable($rrdtool)) {
-	exit("'$rrdtool' is not executable");
-    }
-}
-print "</b><br>rrdtool -v outputs:<hr><pre>";
-passthru($rrdtool.' -v');
-print "</pre><hr>";
-// Test to see if we can find rrd files
-print "Trying to find symon rrd files:<br>";
-$root_dir = dir($symon2web["tree"]);
-while ($machine = $root_dir->read()) {
-    if ($machine != '.' && 
-	$machine != '..' && 
-	is_dir($symon2web["tree"]."/".$machine)) {
-	$symon2web["machine"][$machine] = $symon2web["tree"]."/".$machine;
-    }
-}
-reset($symon2web["machine"]);
-while (list($machine, $dir) = each($symon2web["machine"])) {
-    $readable = TRUE;
-    print '<b>machine('.$machine.')=</b><br>';
-    $machine_dir = dir($dir);
-    while ($filename = $machine_dir->read()) {
-	$file = $dir."/".$filename;
-	if (is_file($file) && 
-	    preg_match("/^(cpu|if|io|mem|pf)(_([a-z]+))?([0-9]?).rrd$/", 
-		       $filename, $match)) {
-	    print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$file";
-	    if (!is_readable($file)) {
-		$readable = FALSE;
-		print "!";
-	    }
-	    print "<br>";
-	}
-    }
-    print "}<br>";
-    if ($readable == FALSE) {
-	print "Note that files tagged with an exclamation mark could not be read.<br><br>";
-    } else {
-	print "And all files accessable.<br><br>";
-    }
-}
-// Test to see if we can load rrd files
-// Tie it all together
-?>
-</body>
-</html>
-

+ 1 - 1
symon/symux/Makefile

@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.15 2002/10/18 12:30:48 dijkstra Exp $
+# $Id: Makefile,v 1.16 2003/06/20 08:41:23 dijkstra Exp $
 .include "../Makefile.inc"
 .include "../Makefile.inc"
 
 
 SRCS=	symux.c readconf.c symuxnet.c share.c
 SRCS=	symux.c readconf.c symuxnet.c share.c

+ 11 - 3
symon/symux/c_smrrds.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-# $Id: c_smrrds.sh,v 1.18 2003/01/17 16:21:35 dijkstra Exp $
+# $Id: c_smrrds.sh,v 1.19 2003/06/20 08:41:23 dijkstra Exp $
 
 
 #
 #
 # Copyright (c) 2001-2002 Willem Dijkstra
 # Copyright (c) 2001-2002 Willem Dijkstra
@@ -120,7 +120,7 @@ if [ `echo $i | egrep -e "^($VIRTUALINTERFACES)$"` ]; then i=if_$i.rrd; fi
 # add io_*.rrd if it is a disk
 # add io_*.rrd if it is a disk
 if [ `echo $i | egrep -e "^($DISKS)$"` ]; then i=io_$i.rrd; fi
 if [ `echo $i | egrep -e "^($DISKS)$"` ]; then i=io_$i.rrd; fi
 # add .rrd if it is a cpu, etc.
 # add .rrd if it is a cpu, etc.
-if [ `echo $i | egrep -e "^(cpu[0-9]$|mem$|pf$|mbuf$|debug$|proc_)"` ]; then i=$i.rrd; fi
+if [ `echo $i | egrep -e "^(cpu[0-9]$|mem$|pf$|mbuf$|debug$|proc_|sensor[0-9]$|sensor[0-9][0-9]$)"` ]; then i=$i.rrd; fi
 
 
 if [ -f $i ]; then
 if [ -f $i ]; then
     echo "$i exists - ignoring"
     echo "$i exists - ignoring"
@@ -160,6 +160,14 @@ cpu[0-9].rrd)
     echo "$i created"
     echo "$i created"
     ;;
     ;;
 
 
+sensor*.rrd)
+    # Build sensor file
+    rrdtool create $i $RRD_ARGS \
+	DS:value:GAUGE:5:-U:U \
+	$RRA_SETUP
+    echo "$i created"
+    ;;
+
 mem.rrd)
 mem.rrd)
     # Build memory file
     # Build memory file
     rrdtool create $i $RRD_ARGS \
     rrdtool create $i $RRD_ARGS \
@@ -267,7 +275,7 @@ io_*.rrd)
     echo $i - unknown
     echo $i - unknown
     cat <<EOF
     cat <<EOF
 Usage: $0 [oneday] all
 Usage: $0 [oneday] all
-       $0 [oneday] cpu0|mem|pf|mbuf|debug|proc|<if>|<io>
+       $0 [oneday] cpu0|mem|pf|mbuf|debug|proc|<if>|<io>|sensor[0-25]
 
 
 Where:
 Where:
 if=	`echo $INTERFACES|
 if=	`echo $INTERFACES|

+ 10 - 5
symon/symux/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.18 2003/01/18 09:55:37 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.19 2003/06/20 08:41:23 dijkstra Exp $ */
 
 
 /*
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -93,6 +93,10 @@ insert_filename(char *path, int maxlen, int type, char *args)
 	ts = "proc_";
 	ts = "proc_";
 	ta = args;
 	ta = args;
 	break;
 	break;
+    case MT_SENSOR:
+	ts = "sensor";
+	ta = args;
+	break;
     default:
     default:
 	warning("%s:%d: internal error: type (%d) unknown",
 	warning("%s:%d: internal error: type (%d) unknown",
 		__FILE__, __LINE__, type);
 		__FILE__, __LINE__, type);
@@ -190,6 +194,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 		case LXT_MBUF:
 		case LXT_MBUF:
 		case LXT_DEBUG:
 		case LXT_DEBUG:
 		case LXT_PROC:
 		case LXT_PROC:
+		case LXT_SENSOR:
 		    st = token2type(l->op);
 		    st = token2type(l->op);
 		    strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 		    strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 
 
@@ -225,7 +230,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 		case LXT_COMMA:
 		case LXT_COMMA:
 		    break;
 		    break;
 		default:
 		default:
-		    parse_error(l, "{cpu|mem|if|io|pf|debug}");
+		    parse_error(l, "{cpu|mem|if|io|pf|debug|mbuf|proc|sensor}");
 		    return 0;
 		    return 0;
 
 
 		    break;
 		    break;
@@ -317,6 +322,7 @@ read_source(struct sourcelist * sol, struct lex * l)
 	    case LXT_MBUF:
 	    case LXT_MBUF:
 	    case LXT_DEBUG:
 	    case LXT_DEBUG:
 	    case LXT_PROC:
 	    case LXT_PROC:
+	    case LXT_SENSOR:
 		st = token2type(l->op);
 		st = token2type(l->op);
 		strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 		strncpy(&sn[0], l->token, _POSIX2_LINE_MAX);
 
 
@@ -376,9 +382,9 @@ read_source(struct sourcelist * sol, struct lex * l)
 			stream->file = xstrdup(l->token);
 			stream->file = xstrdup(l->token);
 		    }
 		    }
 		}
 		}
-		break;		/* LXT_CPU/IF/IO/MEM/PF/MBUF/DEBUG/PROC */
+		break;		/* LXT_CPU/IF/IO/MEM/PF/MBUF/DEBUG/PROC/SENSOR */
 	    default:
 	    default:
-		parse_error(l, "{cpu|mem|if|io|debug|proc}");
+		parse_error(l, "{cpu|if|io|mem|pf|mbuf|debug|proc|sensor}");
 		return 0;
 		return 0;
 		break;
 		break;
 	    }
 	    }
@@ -467,7 +473,6 @@ read_config_file(struct muxlist * mul, const char *filename)
 		    if (stream->file == NULL) {
 		    if (stream->file == NULL) {
 			warning("%s: no filename specified for stream '%s(%s)' in source '%s'",
 			warning("%s: no filename specified for stream '%s(%s)' in source '%s'",
 				l->filename, type2str(stream->type), stream->args, source->addr);
 				l->filename, type2str(stream->type), stream->args, source->addr);
-			return 0;
 		    }
 		    }
 		}
 		}
 	    }
 	    }

+ 2 - 2
symon/symux/share.c

@@ -316,7 +316,7 @@ spawn_client(int sock)
     check_master();
     check_master();
 
 
     bzero(peername, sizeof(peername));
     bzero(peername, sizeof(peername));
-    clientsock = accept_connection(sock, (char *) &peername, sizeof(peername));
+    clientsock = accept_connection(sock, (char *) &peername[0], sizeof(peername));
 
 
     if ((pid = fork())) {
     if ((pid = fork())) {
 	/* server */
 	/* server */
@@ -326,7 +326,7 @@ spawn_client(int sock)
 	else {
 	else {
 	    newclients++;
 	    newclients++;
 	    info("forked client(%d) for incoming connection from %.17s",
 	    info("forked client(%d) for incoming connection from %.17s",
-		 pid, peername);
+		 pid, &peername[0]);
 	}
 	}
 
 
 	close(clientsock);
 	close(clientsock);

+ 5 - 1
symon/symux/symux.8

@@ -106,7 +106,8 @@ source-stmt  = "source" host "{" accept-stmts write-stmts [ datadir-stmt ] "}"
 accept-stmts = accept-stmt [accept-stmts]
 accept-stmts = accept-stmt [accept-stmts]
 accept-stmt  = "accept" "{" resources "}"
 accept-stmt  = "accept" "{" resources "}"
 resources    = resource ["(" argument ")"] [ ","|" " resources ]
 resources    = resource ["(" argument ")"] [ ","|" " resources ]
-resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc" | "mbuf"
+resource     = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | 
+               "proc" | "mbuf" | "sensor"
 argument     = number | interfacename | diskname
 argument     = number | interfacename | diskname
 datadir-stmt = "datadir" dirname
 datadir-stmt = "datadir" dirname
 write-stmts  = write-stmt [write-stmts]
 write-stmts  = write-stmt [write-stmts]
@@ -225,6 +226,9 @@ procsz : rsssz ).
 Mbuf statistics ( totmbufs : mt_data : mt_oobdata : mt_control :
 Mbuf statistics ( totmbufs : mt_data : mt_oobdata : mt_control :
 mt_header : mt_ftable : mt_soname : mt_soopts : pgused : pgtotal :
 mt_header : mt_ftable : mt_soname : mt_soopts : pgused : pgtotal :
 totmem : totpct : m_drops : m_wait : m_drain ).
 totmem : totpct : m_drops : m_wait : m_drain ).
+.It sensor
+Single sensor value. ( value ) Value is a double that is offered with 7.6
+precision. Value depends on sensor type.
 .El
 .El
 .Sh SIGNALS
 .Sh SIGNALS
 .Bl -tag -width Ds
 .Bl -tag -width Ds