ソースを参照

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

Wictor Lund 3 年 前
コミット
5ddc357e02
92 ファイル変更1145 行追加1010 行削除
  1. 0 73
      mon/INSTALL
  2. 0 18
      mon/TODO
  3. 0 19
      mon/lib/Makefile
  4. 0 32
      mon/mon/Makefile
  5. 0 110
      mon/mon/io.c
  6. 0 169
      mon/mon2web/class_pf.inc
  7. 0 7
      mon/mon2web/datasources.inc
  8. BIN
      mon/mon2web/mon.png
  9. 0 30
      mon/monmux/Makefile
  10. 0 62
      mon/monmux/monmux.conf
  11. 0 50
      mon/ports/mon/Makefile
  12. 0 3
      mon/ports/mon/pkg/DESCR
  13. 0 4
      mon/ports/mon/pkg/DESCR-monitor
  14. 0 4
      mon/ports/mon/pkg/DESCR-mux
  15. 0 6
      mon/ports/mon/pkg/DESCR-web
  16. 0 7
      mon/ports/mon/pkg/MESSAGE
  17. 0 10
      mon/ports/mon/pkg/PLIST
  18. 0 6
      mon/ports/mon/pkg/PLIST-monitor
  19. 0 7
      mon/ports/mon/pkg/PLIST-mux
  20. 0 19
      mon/ports/mon/pkg/PLIST-web
  21. 24 2
      symon/CHANGELOG
  22. 89 0
      symon/INSTALL
  23. 16 8
      symon/Makefile
  24. 5 6
      symon/Makefile.inc
  25. 12 0
      symon/TODO
  26. 19 0
      symon/lib/Makefile
  27. 11 11
      symon/lib/data.c
  28. 22 22
      symon/lib/data.h
  29. 14 14
      symon/lib/error.c
  30. 4 4
      symon/lib/error.h
  31. 0 0
      symon/lib/lex.c
  32. 4 4
      symon/lib/lex.h
  33. 0 0
      symon/lib/net.c
  34. 5 5
      symon/lib/net.h
  35. 0 0
      symon/lib/xmalloc.c
  36. 4 4
      symon/lib/xmalloc.h
  37. 50 0
      symon/ports/symon/Makefile
  38. 10 0
      symon/ports/symon/pkg/DESCR
  39. 4 0
      symon/ports/symon/pkg/DESCR-mon
  40. 4 0
      symon/ports/symon/pkg/DESCR-mux
  41. 6 0
      symon/ports/symon/pkg/DESCR-web
  42. 7 0
      symon/ports/symon/pkg/MESSAGE
  43. 4 0
      symon/ports/symon/pkg/MESSAGE-mon
  44. 7 0
      symon/ports/symon/pkg/MESSAGE-mux
  45. 8 0
      symon/ports/symon/pkg/MESSAGE-web
  46. 27 0
      symon/ports/symon/pkg/PLIST
  47. 6 0
      symon/ports/symon/pkg/PLIST-mon
  48. 7 0
      symon/ports/symon/pkg/PLIST-mux
  49. 20 0
      symon/ports/symon/pkg/PLIST-web
  50. 25 0
      symon/symon/Makefile
  51. 7 7
      symon/symon/readconf.c
  52. 5 5
      symon/symon/readconf.h
  53. 5 5
      symon/symon/sm_cpu.c
  54. 5 5
      symon/symon/sm_if.c
  55. 151 0
      symon/symon/sm_io.c
  56. 5 5
      symon/symon/sm_mem.c
  57. 5 5
      symon/symon/sm_pf.c
  58. 15 18
      symon/symon/symon.8
  59. 28 64
      symon/symon/symon.c
  60. 0 0
      symon/symon/symon.conf
  61. 15 32
      symon/symon/symon.h
  62. 8 8
      symon/symon/symonnet.c
  63. 4 4
      symon/symon/symonnet.h
  64. 3 3
      symon/symon2web/Makefile
  65. 0 0
      symon/symon2web/class_cpu.inc
  66. 0 0
      symon/symon2web/class_graph.inc
  67. 0 0
      symon/symon2web/class_if.inc
  68. 0 0
      symon/symon2web/class_io.inc
  69. 0 0
      symon/symon2web/class_mem.inc
  70. 239 0
      symon/symon2web/class_pf.inc
  71. 7 0
      symon/symon2web/datasources.inc
  72. 0 0
      symon/symon2web/graph_cpu.php
  73. 0 0
      symon/symon2web/graph_if.php
  74. 0 0
      symon/symon2web/graph_io.php
  75. 0 0
      symon/symon2web/graph_mem.php
  76. 0 0
      symon/symon2web/graph_pf.php
  77. 27 23
      symon/symon2web/index.php
  78. 0 0
      symon/symon2web/spacer.png
  79. 0 0
      symon/symon2web/symon.css
  80. BIN
      symon/symon2web/symon.png
  81. 30 0
      symon/symux/Makefile
  82. 3 3
      symon/symux/c_smrrds.sh
  83. 3 3
      symon/symux/readconf.c
  84. 4 4
      symon/symux/readconf.h
  85. 4 4
      symon/symux/share.c
  86. 5 5
      symon/symux/share.h
  87. 33 33
      symon/symux/symux.8
  88. 16 16
      symon/symux/symux.c
  89. 62 0
      symon/symux/symux.conf
  90. 9 9
      symon/symux/symux.h
  91. 24 24
      symon/symux/symuxnet.c
  92. 9 9
      symon/symux/symuxnet.h

+ 0 - 73
mon/INSTALL

@@ -1,73 +0,0 @@
-Installation notes
-==================
-
-Real quick 
-==========
-make && make install && vi /etc/monmux.conf /etc/mon.conf && 
-	~mon/monmux/c_monrrds.sh all && 
-	/usr/local/libexec/monmux && 
-	/usr/local/libexec/mon
-
-Slightly less quick but with pretty pictures
-============================================
-- Install rrdtool. cd /usr/ports/net/rrdtool && make install should do the
-  trick.
-
-- Check Makefile.inc for settings. Things to watch out for are
-
-     + PREFIX = Where does the installation tree start. Defaults to
-                '/usr/local'.
-
-     + BINDIR = Where should the daemons be put, relative to $PREFIX. Defaults
-                to 'libexec'.
-
-     + MANDIR = Where should the manuals be installed, relative to
-                $PREFIX. Defaults to 'man'.
-
-     + SHRDIR = Where are the example configurations to be installed. Defaults
-                to 'share/mon'.
-
-- Decide if you want to monitor disk usage. Define KVM as an environment
-  variable before you run make if you do.
-
-- Run make && make install
-
-- Create an '/etc/mon.conf'. Note that there is an example configuration in
-  $PREFIX/$SHRDIR. 
-
-- Create a monmux.conf on the gatherer host. You can specify alternative
-  locations than '/etc/monmux.conf' using 'monmux -f <monmux.conf>'.
-
-- Create the rrd files where the incoming mon data is to be
-  stored. $PREFIX/$SHRDIR/c_monrrds.sh is your friend. Note that 'mon2web'
-  expects an '.../machine/*.rrd' style directory structure.
-
-- Fire up mon, monmux. Check system logs for any failures.
-
-- only if you need the webinterface: mon2web is not installed anywhere by
-  default. Copy the files to a convenient apache directory and modify the
-  mon2web/datasources.inc to reflect your filelocations. Note that it uses php,
-  so you may need to (cd /usr/ports/www/php4; make install).
-
-Installing mon on many machines
-===============================
-
-- Copy the mon-version.tar.gz to /usr/ports/distfiles/
-
-- Use the ports directory to create a mon package. 
-  cd ~mon/ports/mon
-  make package
-- The binary package can be found at 
-  /usr/ports/packages/<arch>/All/mon-version.tgz
-
-- You can transfer the resulting package to many machines and install it by
-  pkg_add it.
-
-This package is an OpenBSD application. You might be able to make monmux and
-mon2web run on POSIX compliant unixes, but the monitoring application itself
-(mon) is OpenBSD specific.
-
-Willem Dijkstra <wpd@xs4all.nl>
-
-$Id: INSTALL,v 1.3 2002/08/31 15:54:57 dijkstra Exp $
-

+ 0 - 18
mon/TODO

@@ -1,18 +0,0 @@
-TODO:
-
-== current problems / short term
-- add mon2web manual page / readme, explain weird format
-- remove mon packet limit
-- rework port makefile, current version contains both (mon|monmux) on a host
-  and that does not make sense for a probe only host. flavors should be
-  default, kvm, no-pf (3.1 and up dep)
-- add pf graphs
-- rework io to use sysctl
-(- build sysctl to get disk structure)
-
-== longer term
-- change rrd to accommodate batch updates
-- write a muxer that supports unix pipes
-- write a client that drives a crystal fontz lcd
-
-$Id: TODO,v 1.16 2002/09/02 06:15:19 dijkstra Exp $

+ 0 - 19
mon/lib/Makefile

@@ -1,19 +0,0 @@
-# $Id: Makefile,v 1.7 2002/08/29 05:59:34 dijkstra Exp $
-.include "../Makefile.inc"
-
-SRCS=   error.c lex.c xmalloc.c net.c data.c
-OBJS+=	${SRCS:R:S/$/.o/g}
-
-all: libmon.a
-
-libmon.a: ${OBJS}
-	@echo building standard mon library
-	@rm -f libmon.a
-	@${AR} cq libmon.a `${LORDER} ${OBJS} | tsort -q`
-	${RANLIB} libmon.a
-
-clean:
-	rm -f libmon.a ${OBJS}
-
-install: libmon.a
-

+ 0 - 32
mon/mon/Makefile

@@ -1,32 +0,0 @@
-# $Id: Makefile,v 1.24 2002/08/31 15:00:25 dijkstra Exp $
-.include "../Makefile.inc"
-
-LIBS=	-L../lib -lmon
-SRCS=	mon.c cpu.c mem.c if.c pf.c readconf.c monnet.c io.c
-.ifdef KVM
-LIBS+=	-lkvm
-.endif
-OBJS+=	${SRCS:R:S/$/.o/g}
-CFLAGS+=-DNET_INET6 -I../lib
-
-all: mon mon.cat8
-
-mon: ${OBJS}
-	${CC} -o $@ ${OBJS} ${LIBS}
-.ifndef DEBUG
-	${STRIP} $@
-.endif
-
-clean:
-	rm -f mon mon.cat8 ${OBJS}
-
-install: mon mon.cat8 mon.conf
-.ifdef KVM
-	${INSTALL} -c -m 2555 -g kmem  -o root mon      ${PREFIX}/${BINDIR}
-.else
-	${INSTALL} -c -m 555  -g wheel -o root mon      ${PREFIX}/${BINDIR}
-.endif
-	${INSTALL} -c -m 444  -g wheel -o root mon.cat8 ${PREFIX}/${MANDIR}/cat8/mon.0
-	${INSTALL} -d -m 555  -g bin   -o root ${PREFIX}/${SHRDIR}
-	${INSTALL} -c -m 444  -g bin   -o root mon.conf ${PREFIX}/${SHRDIR}
-

+ 0 - 110
mon/mon/io.c

@@ -1,110 +0,0 @@
-/* $Id: io.c,v 1.6 2002/09/02 06:16:26 dijkstra Exp $ */
-
-/*
- * Copyright (c) 2001-2002 Willem Dijkstra
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *    - Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    - Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials provided
- *      with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * Get current disk transfer statistics from kernel and return them in mon_buf as
- * 
- * total nr of transfers : total seeks : total bytes transferred
- *
- * This module uses the kvm interface to read kernel values directly. It needs
- * a valid kvm handle and will only work if this has been obtained by someone
- * belonging to group kmem. Note that these priviledges can be dropped right
- * after the handle has been obtained. (sgid kmem on executable) 
- *
- * Re-entrant code: globals are used to speedup calculations for all disks.
- * 
- * TODO: di_name is too large
- */
-#include <sys/disk.h>
-
-#include <limits.h>
-#include <string.h>
-
-#include "error.h"
-#include "mon.h"
-
-/* Globals for this module start with io_ */
-struct disk io_disk;
-size_t io_size_disk;
-struct disklist_head io_dihead;
-size_t io_size_dihead;
-char io_name[_POSIX2_LINE_MAX];
-/* Prepare io module for first use */
-void 
-init_io(char *s) 
-{
-#ifdef MON_KVM
-    io_size_disk = sizeof io_disk;
-    io_size_dihead = sizeof io_dihead;
-
-    info("started module io(%s)", s);
-#else
-    warning("io(%s) requires kvm support which was disabled at compile time", s);
-#endif
-}
-/* Get new io statistics */
-int 
-get_io(char *mon_buf, int maxlen, char *disk) 
-{
-#ifdef MON_KVM
-    u_long diskptr;
-
-    /* obtain first disk structure in kernel memory */
-    if (kread(mon_nl[MON_DL].n_value, (char *) &io_dihead, io_size_dihead)) {
-	warning("io(%s) failed", disk);
-	return 0;
-    }
-
-    diskptr = (u_long) io_dihead.tqh_first;
-
-    while (diskptr) {
-	kread(diskptr, (char *) &io_disk, io_size_disk);
-	diskptr = (u_long) io_disk.dk_link.tqe_next;
-
-	if (io_disk.dk_name != NULL) {
-	    kread((u_long)io_disk.dk_name, (char *) &io_name, _POSIX2_LINE_MAX);
-	    io_name[_POSIX2_LINE_MAX - 1] = '\0';
-
-	    if (disk != NULL && strncmp(io_name, disk, _POSIX2_LINE_MAX) == 0) {
-		return snpack(mon_buf, maxlen, disk, MT_IO,
-			      io_disk.dk_xfer, io_disk.dk_seek,
-			      io_disk.dk_bytes);
-	    }
-	}
-    }
-
-    return 0;
-#else
-    return 0;
-#endif
-}
-

+ 0 - 169
mon/mon2web/class_pf.inc

@@ -1,169 +0,0 @@
-<?php
-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:AVERAGE ",
-			"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"')))));
-
-	$this->graphsettings["rawcmdline"] .=" -v 'pf'";
-	$this->graphdefaults = array_merge($this->graphdefaults,
-					   $this->shortcut["pf"]["all"]);
-
-	$this->url2options($url);
-    }
-}
-?>

+ 0 - 7
mon/mon2web/datasources.inc

@@ -1,7 +0,0 @@
-<?php
-// $Id: datasources.inc,v 1.8 2002/08/16 12:51:36 dijkstra Exp $
-//
-// Contains definitions where the data files are to be found
-$mon2web["tree"]='/export/store_3/mon';
-
-?>

BIN
mon/mon2web/mon.png


+ 0 - 30
mon/monmux/Makefile

@@ -1,30 +0,0 @@
-# $Id: Makefile,v 1.13 2002/07/25 14:25:31 dijkstra Exp $
-.include "../Makefile.inc"
-
-SRCS=	monmux.c readconf.c muxnet.c share.c
-OBJS+=	${SRCS:R:S/$/.o/g}
-LIBS=  -L../lib -L/usr/local/lib -lrrd -lmon
-CFLAGS+=-I../lib -I/usr/local/include
-
-all: monmux monmux.cat8
-
-monmux: ${OBJS}
-	${CC} -o $@ ${OBJS} ${LIBS}
-.ifndef DEBUG
-	${STRIP} $@
-.endif
-
-clean:
-	rm -f monmux monmux.cat8 ${OBJS}
-
-install: monmux monmux.cat8 c_monrrds.sh monmux.conf
-	${INSTALL} -c -m 555 -g bin   -o root monmux      ${PREFIX}/${BINDIR}
-	${INSTALL} -c -m 444 -g wheel -o root monmux.cat8 ${PREFIX}/${MANDIR}/cat8/monmux.0
-	${INSTALL} -d -m 555 -g bin   -o root ${PREFIX}/${SHRDIR}
-	${INSTALL} -c -m 544 -g bin   -o root c_monrrds.sh  ${PREFIX}/${SHRDIR}
-	${INSTALL} -c -m 444 -g bin   -o root monmux.conf   ${PREFIX}/${SHRDIR}
-
-cleanipc:
-	ipcs | egrep "^m" | awk '{print $$2}' | xargs -n1 ipcrm -m &
-	ipcs | egrep "^s" | awk '{print $$2}' | xargs -n1 ipcrm -s 
-

+ 0 - 62
mon/monmux/monmux.conf

@@ -1,62 +0,0 @@
-#
-# $Id: monmux.conf,v 1.16 2002/08/26 14:53:01 dijkstra Exp $
-#
-# Initial monmux.conf demonstrates how I configure monmux.
-
-#
-# hub <hubname> defines the destination of all monitored data described in this
-# configuration file.
-#
-# note that monmux listens for incoming mon traffic on udp 2100 and incoming
-# client connections on tcp 2100
-#
-
-mux 10.0.0.1:2100
-
-#
-# source <hostname> defines a source of monitored data. 
-#
-source 10.0.0.1 {
-
-	# All accepted formats have to be defined explicitly. 
-	#
-	# cpu(x) - gather stats for cpu nr. x
-	# mem    - gather memory stats
-	# if(x)  - gather io stats for interface x
-	# io(x)  - gather io stats for disk x.
-
-	accept { cpu(0), mem, if(xl0), if(de0),
-	         if(lo0), io(wd0), io(wd1), 
-                 io(wd2), io(wd3), io(cd0)}
-	
-	# Define where data should be put
-	#
-	# Accepted sources that are not written out will be 
-	# discarded.
-
-	write cpu(0)   in "/export/mon/www/cpu0.rrd"
-	write mem      in "/export/mon/www/mem.rrd"
-
-	write if(xl0)  in "/export/mon/www/if_xl0.rrd"
-	write if(de0)  in "/export/mon/www/if_de0.rrd"
-	write if(lo0)  in "/export/mon/www/if_lo0.rrd"
-	
-	write io(wd0)  in "/export/mon/www/io_wd0.rrd"
-	write io(wd1)  in "/export/mon/www/io_wd1.rrd"
-	write io(wd2)  in "/export/mon/www/io_wd2.rrd"
-	write io(wd3)  in "/export/mon/www/io_wd3.rrd"
-
-	write io(cd0)  in "/export/mon/www/io_cd0.rrd"
-}
-source 10.0.0.2 {
-	accept { cpu(0), mem, if(sis0), if(sis1),
-		 if(lo0), if(wi0), io(wd0) }
-
-	write cpu(0)   in "/export/mon/4512/cpu0.rrd"
-	write mem      in "/export/mon/4512/mem.rrd"
-	write if(sis0) in "/export/mon/4512/if_sis0.rrd"
-	write if(sis1) in "/export/mon/4512/if_sis1.rrd"
-	write if(lo0)  in "/export/mon/4512/if_lo0.rrd"
-	write if(wi0)  in "/export/mon/4512/if_wi0.rrd"
-	write io(wd0)  in "/export/mon/4512/io_wd0.rrd"
-}

+ 0 - 50
mon/ports/mon/Makefile

@@ -1,50 +0,0 @@
-# $OpenBSD: $
-
-COMMENT=		"active monitoring tool"
-V=			2.4
-DISTNAME=		mon-${V}
-PKGNAME=		mon-${V}
-CATEGORIES=		net sysutils
-NEED_VERSION=		1.502
-MASTER_SITES=		http://www.xs4all.nl/~wpd/mon/
-
-HOMEPAGE=		http://www.xs4all.nl/~wpd/mon/
-
-MAINTAINER=		Willem Dijkstra <wpd@xs4all.nl>
-
-PERMIT_PACKAGE_CDROM=	Yes
-PERMIT_PACKAGE_FTP=	Yes
-PERMIT_DISTFILES_CDROM=	Yes
-PERMIT_DISTFILES_FTP=	Yes
-# flavors
-# static client
-
-# prepare package for client
-MULTI_PACKAGES+=	-monitor
-COMMENT-monitor=	"active host monitor"
-MON_DEPENDS=		
-
-# prepare package for server
-MULTI_PACKAGES+=	-mux
-COMMENT-mux=		"mon data gatherer"
-MONMUX_DEPENDS=		rrd.0.0::net/rrdtool
-
-# prepare package for web frontend
-MULTI_PACKAGES+=	-web
-COMMENT-web=		"mon web frontend"
-WEB_DEPENDS=		rrd.0.0::net/rrdtool
-
-.for i in ${MULTI_PACKAGES}
-FULLPKGNAME${i}=        mon${i}-${V}
-.endfor
-
-.if defined(PACKAGING) && !empty(SUBPACKAGE)
-MODULE_NAME=            ${SUBPACKAGE:S/-//g}
-LIB_DEPENDS=            ${${MODULE_NAME:U}_DEPENDS}
-MESSAGE=                ${PKGDIR}/MESSAGE
-.endif
-
-WRKDIST=		${WRKDIR}/mon
-
-.include <bsd.port.mk>
-

+ 0 - 3
mon/ports/mon/pkg/DESCR

@@ -1,3 +0,0 @@
-mon is a lightweight system monitor that measures cpu, memory, interface and disk st
-atistics every 5 seconds. This information is then spooled over "the network" to monmux for further processing.
-

+ 0 - 4
mon/ports/mon/pkg/DESCR-monitor

@@ -1,4 +0,0 @@
-mon is a lightweight system monitor that measures cpu, memory, interface and
-disk st atistics every 5 seconds. This information is then spooled over "the
-network" to monmux for further processing.
-

+ 0 - 4
mon/ports/mon/pkg/DESCR-mux

@@ -1,4 +0,0 @@
-monmux is a heavyweight data gatherer for the lightweight mon system monitor.
-mon is a lightweight system monitor that measures cpu, memory, interface and
-disk st atistics every 5 seconds.
-

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

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

+ 0 - 7
mon/ports/mon/pkg/MESSAGE

@@ -1,7 +0,0 @@
-+---------------
-| Example configurations for both mon and monmux have been installed in
-| ${PREFIX}/share/mon.
-|
-| RRD files can be obtained by running
-| ${PREFIX}/share/mon/c_monrrds.sh
-+---------------

+ 0 - 10
mon/ports/mon/pkg/PLIST

@@ -1,10 +0,0 @@
-@comment $Id:$
-@comment $OpenBSD$
-libexec/mon
-libexec/monmux
-man/cat8/mon.0
-man/cat8/monmux.0
-share/mon/c_monrrds.sh
-share/mon/mon.conf
-share/mon/monmux.conf
-@dirrm share/mon

+ 0 - 6
mon/ports/mon/pkg/PLIST-monitor

@@ -1,6 +0,0 @@
-@comment $Id:$
-@comment $OpenBSD$
-libexec/mon
-man/cat8/mon.0
-share/mon/mon.conf
-@dirrm share/mon

+ 0 - 7
mon/ports/mon/pkg/PLIST-mux

@@ -1,7 +0,0 @@
-@comment $Id:$
-@comment $OpenBSD$
-libexec/monmux
-man/cat8/monmux.0
-share/mon/c_monrrds.sh
-share/mon/monmux.conf
-@dirrm share/mon

+ 0 - 19
mon/ports/mon/pkg/PLIST-web

@@ -1,19 +0,0 @@
-@comment $Id:$
-@comment $OpenBSD$
-share/mon/web/class_cpu.inc        
-share/mon/web/class_graph.inc      
-share/mon/web/class_if.inc         
-share/mon/web/class_io.inc         
-share/mon/web/class_mem.inc        
-share/mon/web/class_pf.inc         
-share/mon/web/datasources.inc      
-share/mon/web/graph_cpu.php        
-share/mon/web/graph_if.php         
-share/mon/web/graph_io.php         
-share/mon/web/graph_mem.php        
-share/mon/web/graph_pf.php         
-share/mon/web/index.php            
-share/mon/web/mon.css              
-share/mon/web/mon.png              
-share/mon/web/spacer.png           
-@dirrm share/mon/web

+ 24 - 2
mon/CHANGELOG → symon/CHANGELOG

@@ -1,4 +1,26 @@
-06/09/2002 -
+13/09/2002 - 2.5 - kvm gone, renamed mon to symon
+
+   Rewrote io.c to obtain information via sysctl only. All kvm code is now
+   gone.
+
+   Renamed mon to symon, monmux to symux and mon2web to symon2web. I liked mon
+   better, but that name is already taken.
+
+   Cleaned up webpages to be XHTML 1.0.
+
+10/09/2002 - 2.4
+
+   Added some example pf graphs. This data is hard to plot, ideas are
+   welcome. Added better port support.
+
+09/09/2002 - Towards a better port makefile
+
+   Reworked port Makefile. It now generates a number of packages that can be
+   used to just install mon, monmux or mon2web. The KVM stuff has become a special
+   flavor of the monitor package.
+
+06/09/2002 - Cosmetics again
+
    monmux/c_monrrds.sh:
      - Added RRD_ARGS support. All created rrds have start=epoch. Incoming data
        from hosts may be from an earlier time than rrd creation now.
@@ -125,4 +147,4 @@
 29/09/2001 - Lexer had trouble dealing with ip-addresses. Cleaned up the number	
              parsing code and removed a second comment reader.
 
-$Id: CHANGELOG,v 1.2 2002/09/02 06:15:19 dijkstra Exp $
+$Id: CHANGELOG,v 1.6 2002/09/14 15:58:45 dijkstra Exp $

+ 89 - 0
symon/INSTALL

@@ -0,0 +1,89 @@
+Installation notes
+==================
+
+Priviledges
+===========
+symux needs read and write access to it's rrdfiles.
+
+monitoring needs:
+cpu, if, mem, io - 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.
+
+Real quick 
+==========
+make && make install && vi /etc/symux.conf /etc/symon.conf && 
+	~symon/symux/c_smrrds.sh all && 
+	/usr/local/libexec/symux && 
+	/usr/local/libexec/symon
+
+or grab the port and do
+make package
+pkg_add symon-mon-version.tgz on all monitored hosts
+pkg_add symon-mux-version.tgz on the loghost
+pkg_add symon-web-version.tgz on the loghost
+
+Less quick, but more verbose
+============================
+- Install rrdtool where you want to run the gatherer. 
+	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
+  are:
+
+     + PREFIX = Where does the installation tree start. Defaults to
+                '/usr/local'.
+
+     + BINDIR = Where should the daemons be put, relative to $PREFIX. Defaults
+                to 'libexec'.
+
+     + MANDIR = Where should the manuals be installed, relative to
+                $PREFIX. Defaults to 'man'.
+
+     + SHRDIR = Where are the example configurations to be installed. Defaults
+                to 'share/symon'.
+
+   Run make && make install
+
+- Building from the port: 
+	cd ~symon/ports/symon or cd /usr/ports/sysutils/symon
+	make package
+
+	cd /usr/ports/packages/$ARCH/All/
+	pkg_add symon-mon-version.tgz               on monitored hosts
+	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
+  $PREFIX/$SHRDIR. 
+
+- Create a symux.conf on the gatherer host. You can specify alternative
+  locations than '/etc/symux.conf' using 'symux -f <symux.conf>'.
+
+- 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.
+
+- 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.
+
+Portability
+===========
+
+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
+(symon) is OpenBSD specific.
+
+Willem Dijkstra <wpd@xs4all.nl>
+
+$Id: INSTALL,v 1.6 2002/09/14 15:58:45 dijkstra Exp $
+

+ 16 - 8
mon/Makefile → symon/Makefile

@@ -1,10 +1,9 @@
-# $Id: Makefile,v 1.6 2002/08/31 15:54:57 dijkstra Exp $
+# $Id: Makefile,v 1.9 2002/09/14 15:58:45 dijkstra Exp $
 
-SUBDIR=	lib mon monmux mon2web
-V=2.4
+SUBDIR=	lib symon symux symon2web
 
 .if make(clean)
-SUBDIR+= ports/mon
+SUBDIR+= ports/symon
 .endif
 
 .include "Makefile.inc"
@@ -16,11 +15,20 @@ install: _SUBDIRUSE
 # Not all the stuff that I'm working on is ready for release
 dist: clean
 	@workdir=`basename ${.CURDIR}`; \
-	cd ..; \
-	echo Exporting mon-${V}.tar.gz; \
+	cd ports/symon; \
+	rm -f distinfo; \
+	${MAKE} clean; \
+	cd ../../..; \
+	echo Exporting symon-${V}.tar.gz; \
 	find $${workdir} -type f -print | egrep -v 'CVS|doc|clients|README|regress|#'| \
-		tar -czvf mon-${V}.tar.gz -I -
-
+		tar -czvf /tmp/symon-${V}.tar.gz -I -; \
+	cp /tmp/symon-${V}.tar.gz /usr/ports/distfiles/; \
+	cd $${workdir}/ports/symon; \
+	${MAKE} makesum; \
+	cd ..; \
+	find symon -type f -print | egrep -v 'CVS' | \
+		tar -czvf /tmp/ports-symon-${V}.tar.gz -I -; \
+	cd ../..
 
 _SUBDIRUSE: .USE
 .if defined(SUBDIR)

+ 5 - 6
mon/Makefile.inc → symon/Makefile.inc

@@ -1,4 +1,6 @@
-# $Id: Makefile.inc,v 1.3 2002/08/31 14:59:57 dijkstra Exp $
+# $Id: Makefile.inc,v 1.8 2002/09/14 15:58:45 dijkstra Exp $
+
+V=2.5
 
 AR=	ar
 CC=	cc
@@ -7,9 +9,6 @@ CFLAGS= -g -Wall
 .else
 CFLAGS= -O2 -Wall
 .endif
-.ifdef KVM
-CFLAGS+=-DMON_KVM
-.endif
 INSTALL=install
 LORDER=	lorder
 NROFF=	nroff
@@ -18,8 +17,8 @@ STRIP=  strip
 
 BINDIR= libexec
 MANDIR=	man
-SHRDIR= share/mon
-WEBDIR= share/mon/web
+SHRDIR= share/symon
+WEBDIR= ${SHRDIR}/web
 
 .ifndef PREFIX
 PREFIX=/usr/local

+ 12 - 0
symon/TODO

@@ -0,0 +1,12 @@
+TODO:
+
+== current problems / short term
+- add symon2web manual page / readme, explain weird format
+- remove mon packet limit
+
+== longer term
+- change rrd to accommodate batch updates
+- write a muxer that supports unix pipes
+- write a client that drives a crystal fontz lcd
+
+$Id: TODO,v 1.19 2002/09/14 15:58:45 dijkstra Exp $

+ 19 - 0
symon/lib/Makefile

@@ -0,0 +1,19 @@
+# $Id: Makefile,v 1.8 2002/09/14 15:56:18 dijkstra Exp $
+.include "../Makefile.inc"
+
+SRCS=   error.c lex.c xmalloc.c net.c data.c
+OBJS+=	${SRCS:R:S/$/.o/g}
+
+all: libsymon.a
+
+libsymon.a: ${OBJS}
+	@echo building standard symon library
+	@rm -f libsymon.a
+	@${AR} cq libsymon.a `${LORDER} ${OBJS} | tsort -q`
+	${RANLIB} libsymon.a
+
+clean:
+	rm -f libsymon.a ${OBJS}
+
+install: libsymon.a
+

+ 11 - 11
mon/lib/data.c → symon/lib/data.c

@@ -1,4 +1,4 @@
-/* $Id: data.c,v 1.15 2002/09/02 06:15:52 dijkstra Exp $ */
+/* $Id: data.c,v 1.16 2002/09/14 15:56:18 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -34,7 +34,7 @@
 
 /* Terminology: 
  * 
- * A host carrying a 'mon' is considered a 'source' of information. A single
+ * A host carrying a 'symon' is considered a 'source' of information. A single
  * data 'stream' of information has a particular type: <cpu|mem|if|io>. A
  * source can provide multiple 'streams' simultaniously. A source spools
  * information towards a 'mux'. A 'stream' that has been converted to network
@@ -236,27 +236,27 @@ checklen(int maxlen, int current, int extra)
     }
 }
 int 
-setheader(char *buf, struct monpacketheader *hph) 
+setheader(char *buf, struct symonpacketheader *hph) 
 {
-    struct monpacketheader nph;
+    struct symonpacketheader nph;
     char *p;
 
     nph.timestamp = htonq(hph->timestamp);
     nph.crc = htonl(hph->crc);
     nph.length = htons(hph->length);
-    nph.mon_version = hph->mon_version;
+    nph.symon_version = hph->symon_version;
 
     p = buf;
 
     bcopy(&nph.crc, p, sizeof(u_int32_t)); p += sizeof(u_int32_t);
     bcopy(&nph.timestamp, p, sizeof(u_int64_t)); p += sizeof(u_int64_t);
     bcopy(&nph.length, p, sizeof(u_int16_t)); p += sizeof(u_int16_t);
-    bcopy(&nph.mon_version, p, sizeof(u_int8_t)); p += sizeof(u_int8_t);
+    bcopy(&nph.symon_version, p, sizeof(u_int8_t)); p += sizeof(u_int8_t);
 
     return (p - buf);
 }
 int
-getheader(char *buf, struct monpacketheader *hph)
+getheader(char *buf, struct symonpacketheader *hph)
 {
     char *p;
 
@@ -265,7 +265,7 @@ getheader(char *buf, struct monpacketheader *hph)
     bcopy(p, &hph->crc, sizeof(u_int32_t)); p += sizeof(u_int32_t);
     bcopy(p, &hph->timestamp, sizeof(u_int64_t)); p += sizeof(u_int64_t);
     bcopy(p, &hph->length, sizeof(u_int16_t)); p += sizeof(u_int16_t);
-    bcopy(p, &hph->mon_version, sizeof(u_int8_t)); p += sizeof(u_int8_t);
+    bcopy(p, &hph->symon_version, sizeof(u_int8_t)); p += sizeof(u_int8_t);
 
     hph->timestamp = ntohq(hph->timestamp);
     hph->crc = ntohl(hph->crc);
@@ -739,7 +739,7 @@ free_muxlist(struct muxlist *mul)
 
 	if (p->name != NULL) xfree(p->name);
 	close(p->clientsocket);
-	close(p->monsocket);
+	close(p->symonsocket);
 	free_streamlist(&p->sl);
 	xfree(p);
 
@@ -786,7 +786,7 @@ free_sourcelist(struct sourcelist *sol)
 	p = np;
     }
 }
-/* Calculate maximum buffer space needed for a single mon hit */
+/* Calculate maximum buffer space needed for a single symon hit */
 int 
 calculate_churnbuffer(struct sourcelist *sol) { 
     struct source *source; 
@@ -839,7 +839,7 @@ init_crc32()
     for (i = 0; i < 256; ++i) {
 	c = i << 24;
 	for (j = 8; j > 0; --j)
-	    c = c & 0x80000000 ? (c << 1) ^ MON_CRCPOLY : (c << 1);
+	    c = c & 0x80000000 ? (c << 1) ^ SYMON_CRCPOLY : (c << 1);
 	crc32_table[i] = c;
     }
 }

+ 22 - 22
mon/lib/data.h → symon/lib/data.h

@@ -1,4 +1,4 @@
-/* $Id: data.h,v 1.15 2002/09/02 06:15:52 dijkstra Exp $ */
+/* $Id: data.h,v 1.16 2002/09/14 15:56:18 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -31,14 +31,14 @@
  */
 
 /*
- * A host carrying a 'mon' is considered a 'source' of information. A single
+ * A host carrying a 'symon' is considered a 'source' of information. A single
  * data 'stream' of information has a particular type: <cpu|mem|if|io>. A
  * source can provide multiple 'streams' simultaneously. A source spools
  * information towards a 'mux'. A 'stream' that has been converted to network
  * representation is called a 'packedstream'.
  */
-#ifndef _MON_LIB_DATA_H
-#define _MON_LIB_DATA_H
+#ifndef _SYMON_LIB_DATA_H
+#define _SYMON_LIB_DATA_H
 
 #include <sys/queue.h>
 #include <sys/types.h>
@@ -49,7 +49,7 @@
 #include "lex.h"
 
 /* Polynominal to use for CRC generation */
-#define MON_CRCPOLY  0x04c11db7
+#define SYMON_CRCPOLY  0x04c11db7
 
 #if BYTE_ORDER == BIG_ENDIAN
 #define htonq(n) (n)
@@ -67,31 +67,31 @@ ntohq (u_int64_t v)
 }
 #endif
 
-/* Mon packet version 
+/* Symon packet version 
  * version 1:
- * mon_version:timestamp:length:crc:n*packedstream
+ * symon_version:timestamp:length:crc:n*packedstream
  * 
  * Note that the data portion is limited. The current (31/03/2002) largest
  * streamtype (if) needs 42 bytes without arguments. My _POSIX2_LINE_MAX is 2k,
- * so that works out to about 38 packedstreams in a single mon packet.  
+ * so that works out to about 38 packedstreams in a single symon packet.  
  */
-#define MON_PACKET_VER  1
+#define SYMON_PACKET_VER  1
 
 /* Sending structures over the network is dangerous as the compiler might have
- * added extra padding between items. monpacketheader below is therefore also
+ * added extra padding between items. symonpacketheader below is therefore also
  * marshalled and demarshalled via snpack and sunpack. The actual values are
  * copied out of memory into this structure one by one. 
  */
-struct monpacketheader {
+struct symonpacketheader {
 	u_int64_t timestamp;
 	u_int32_t crc;
 	u_int16_t length;
-	u_int8_t mon_version;
+	u_int8_t symon_version;
 	u_int8_t reserved;
 };
 
-struct monpacket {
-    struct monpacketheader header;
+struct symonpacket {
+    struct symonpacketheader header;
     char data[_POSIX2_LINE_MAX];
 };  
   
@@ -122,8 +122,8 @@ struct mux {
     char *name;
     int offset;
     int clientsocket;
-    int monsocket;
-    struct monpacket packet;
+    int symonsocket;
+    struct symonpacket packet;
     struct sockaddr_in sockaddr;
     struct streamlist sl;
     u_int32_t senderr;
@@ -153,13 +153,13 @@ SLIST_HEAD(muxlist, mux);
  * only. Although the union members are here, they could also read u_int64_t[4]
  * with io, for instance.
  */
-#define MON_PS_ARGLEN    16
+#define SYMON_PS_ARGLEN    16
 struct packedstream {
     int type;
     int padding;
-    char args[MON_PS_ARGLEN];
+    char args[SYMON_PS_ARGLEN];
     union {
-	struct monpacketheader header;
+	struct symonpacketheader header;
 	struct { 
 	    u_int64_t mtotal_transfers;
 	    u_int64_t mtotal_seeks;
@@ -223,9 +223,9 @@ __BEGIN_DECLS
 const char    *type2str(const int);
 const int      token2type(const int);
 int            calculate_churnbuffer(struct sourcelist *);
-int            getheader(char *, struct monpacketheader *);
+int            getheader(char *, struct symonpacketheader *);
 int            ps2strn(struct packedstream *, char *, int, int);
-int            setheader(char *, struct monpacketheader *);
+int            setheader(char *, struct symonpacketheader *);
 int            snpack(char *, int, char*, int, ...);
 int            strlentype(int);
 int            sunpack(char *, struct packedstream *);
@@ -245,4 +245,4 @@ void           free_sourcelist(struct sourcelist *);
 void           free_streamlist(struct streamlist *);
 void           init_crc32();
 __END_DECLS
-#endif /*_MON_LIB_DATA_H*/
+#endif /*_SYMON_LIB_DATA_H*/

+ 14 - 14
mon/lib/error.c → symon/lib/error.c

@@ -1,4 +1,4 @@
-/* $Id: error.c,v 1.8 2002/08/29 19:38:52 dijkstra Exp $ */
+/* $Id: error.c,v 1.9 2002/09/14 15:56:18 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -46,10 +46,10 @@ __END_DECLS
 int flag_daemon = 0;
 int flag_debug = 0;
 
-enum { MON_LOG_FATAL, 
-       MON_LOG_WARNING,
-       MON_LOG_INFO,
-       MON_LOG_DEBUG } loglevels;
+enum { SYMON_LOG_FATAL, 
+       SYMON_LOG_WARNING,
+       SYMON_LOG_INFO,
+       SYMON_LOG_DEBUG } loglevels;
 
 struct {
     int type;
@@ -57,10 +57,10 @@ struct {
     char *errtxt;
     FILE *stream;
 } logmapping[] = {
-    {MON_LOG_FATAL,   LOG_ERR,     "fatal",   stderr},
-    {MON_LOG_WARNING, LOG_WARNING, "warning", stderr},
-    {MON_LOG_INFO,    LOG_INFO,    "",        stdout},
-    {MON_LOG_DEBUG,   LOG_DEBUG,   "debug",   stdout},
+    {SYMON_LOG_FATAL,   LOG_ERR,     "fatal",   stderr},
+    {SYMON_LOG_WARNING, LOG_WARNING, "warning", stderr},
+    {SYMON_LOG_INFO,    LOG_INFO,    "",        stdout},
+    {SYMON_LOG_DEBUG,   LOG_DEBUG,   "debug",   stdout},
     {-1,              0,           "",        NULL}
 };
 /* 
@@ -73,7 +73,7 @@ output_message(int level, char *fmt, va_list args)
     char msgbuf[_POSIX2_LINE_MAX];
     int loglevel;
 
-    if (level == MON_LOG_DEBUG && flag_debug == 0)
+    if (level == SYMON_LOG_DEBUG && flag_debug == 0)
 	return;
 
     vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
@@ -105,7 +105,7 @@ fatal(char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    output_message(MON_LOG_FATAL, fmt, ap);
+    output_message(SYMON_LOG_FATAL, fmt, ap);
     va_end(ap);
         
     exit( 1 );
@@ -116,7 +116,7 @@ warning(char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    output_message(MON_LOG_WARNING, fmt, ap);
+    output_message(SYMON_LOG_WARNING, fmt, ap);
     va_end(ap);
 }
 /* Inform and continue */
@@ -125,7 +125,7 @@ info(char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    output_message(MON_LOG_INFO, fmt, ap);
+    output_message(SYMON_LOG_INFO, fmt, ap);
     va_end(ap);
 }
 /* Debug statements only */
@@ -134,7 +134,7 @@ debug(char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-    output_message(MON_LOG_DEBUG, fmt, ap);
+    output_message(SYMON_LOG_DEBUG, fmt, ap);
     va_end(ap);
 }
 

+ 4 - 4
mon/lib/error.h → symon/lib/error.h

@@ -1,4 +1,4 @@
-/* $Id: error.h,v 1.5 2002/04/01 14:44:16 dijkstra Exp $ */
+/* $Id: error.h,v 1.6 2002/09/14 15:56:18 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -30,8 +30,8 @@
  *
  */
 
-#ifndef _MON_LIB_ERROR_H
-#define _MON_LIB_ERROR_H
+#ifndef _SYMON_LIB_ERROR_H
+#define _SYMON_LIB_ERROR_H
 
 #include <sys/cdefs.h>
 
@@ -46,4 +46,4 @@ void        info(char *, ...);
 void        debug(char *, ...);
 __END_DECLS
 
-#endif /*_MON_LIB_ERROR_H*/
+#endif /*_SYMON_LIB_ERROR_H*/

+ 0 - 0
mon/lib/lex.c → symon/lib/lex.c


+ 4 - 4
mon/lib/lex.h → symon/lib/lex.h

@@ -1,4 +1,4 @@
-/* $Id: lex.h,v 1.11 2002/08/29 19:38:52 dijkstra Exp $ */
+/* $Id: lex.h,v 1.12 2002/09/14 15:56:18 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -35,8 +35,8 @@
  * lexical analyser. 
  */
 
-#ifndef _MON_LIB_LEX_H
-#define _MON_LIB_LEX_H
+#ifndef _SYMON_LIB_LEX_H
+#define _SYMON_LIB_LEX_H
 
 #include <sys/cdefs.h>
 
@@ -101,5 +101,5 @@ __END_DECLS
 	}                                         \
     } while (0);
 
-#endif /*_MON_LIB_LEX_H*/
+#endif /*_SYMON_LIB_LEX_H*/
 

+ 0 - 0
mon/lib/net.c → symon/lib/net.c


+ 5 - 5
mon/lib/net.h → symon/lib/net.h

@@ -1,4 +1,4 @@
-/* $Id: net.h,v 1.6 2002/09/02 06:15:52 dijkstra Exp $ */
+/* $Id: net.h,v 1.7 2002/09/14 15:56:18 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -30,12 +30,12 @@
  *
  */
 
-#ifndef _MON_LIB_NET_H
-#define _MON_LIB_NET_H
+#ifndef _SYMON_LIB_NET_H
+#define _SYMON_LIB_NET_H
 
 #include <sys/types.h>
 
-#define MONMUX_PORT  2100                     /* default monmux port */
+#define SYMUX_PORT  2100                     /* default symux port */
 
 /* Rewrite an ipadress uint32_t as 4 comma seperated bytes */
 #define IPAS4BYTES(x) \
@@ -49,4 +49,4 @@ __BEGIN_DECLS
 int lookup(char *);
 __END_DECLS
 
-#endif /* _MON_LIB_NET_H */
+#endif /* _SYMON_LIB_NET_H */

+ 0 - 0
mon/lib/xmalloc.c → symon/lib/xmalloc.c


+ 4 - 4
mon/lib/xmalloc.h → symon/lib/xmalloc.h

@@ -1,4 +1,4 @@
-/* $Id: xmalloc.h,v 1.4 2002/03/31 14:27:46 dijkstra Exp $ */
+/* $Id: xmalloc.h,v 1.5 2002/09/14 15:56:18 dijkstra Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -14,8 +14,8 @@
  * called by a name other than "ssh" or "Secure Shell".
  */
 
-#ifndef _MON_LIB_XMALLOC_H
-#define _MON_LIB_XMALLOC_H
+#ifndef _SYMON_LIB_XMALLOC_H
+#define _SYMON_LIB_XMALLOC_H
 
 #include <sys/types.h>
 
@@ -26,4 +26,4 @@ void   *xrealloc(void *, size_t);
 void    xfree(void *);
 char   *xstrdup(const char *);
 __END_DECLS
-#endif /*_MON_LIB_XMALLOC_H*/
+#endif /*_SYMON_LIB_XMALLOC_H*/

+ 50 - 0
symon/ports/symon/Makefile

@@ -0,0 +1,50 @@
+# $OpenBSD: $
+# $Id: Makefile,v 1.5 2002/09/13 07:42:54 dijkstra Exp $
+
+COMMENT=		"active monitoring tool"
+V=			2.5
+DISTNAME=		symon-${V}
+CATEGORIES=		net sysutils
+NEED_VERSION=		1.502
+MASTER_SITES=		http://www.xs4all.nl/~wpd/symon/
+HOMEPAGE=		http://www.xs4all.nl/~wpd/symon/
+MAINTAINER=		Willem Dijkstra <wpd@xs4all.nl>
+
+PERMIT_PACKAGE_CDROM=	Yes
+PERMIT_PACKAGE_FTP=	Yes
+PERMIT_DISTFILES_CDROM=	Yes
+PERMIT_DISTFILES_FTP=	Yes
+
+# client only package
+MULTI_PACKAGES+=	-mon
+COMMENT-mon=		"active host monitor"
+MON_DEPENDS=		
+# gatherer only package
+MULTI_PACKAGES+=	-mux
+COMMENT-mux=		"symon data gatherer"
+MUX_DEPENDS=		rrd.*::net/rrdtool 
+
+# Web frontend only package also depends on php4,
+# but php4.2.2 needs an :php4->=4:www/php4
+# and php<     needs an :php4-core->=4:www/php4
+# => net result = it won't work without php, but the package does not force you
+# to have it.
+MULTI_PACKAGES+=	-web
+COMMENT-web=		"symon web frontend"
+WEB_DEPENDS=		rrd.*::net/rrdtool
+
+.for i in ${MULTI_PACKAGES}
+FULLPKGNAME${i}=        symon${i}-${V}
+.endfor
+
+.if defined(PACKAGING) && !empty(SUBPACKAGE)
+MODULE_NAME=            ${SUBPACKAGE:S/-//g}
+LIB_DEPENDS=            ${${MODULE_NAME:U}_DEPENDS}
+MESSAGE=                ${PKGDIR}/MESSAGE${SUBPACKAGE}
+.endif
+
+WRKDIST=		${WRKDIR}/symon
+SUBST_VARS=		V
+
+.include <bsd.port.mk>
+

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

@@ -0,0 +1,10 @@
+symon is a lightweight system monitor that measures cpu, memory,
+interface and disk st atistics every 5 seconds. This information is
+then spooled over "the network" to symux for further processing.
+
+The port will yield 4 packages: 
+symon-mon-${V}.tgz : symon daemon and manual
+symon-mux-${V}.tgz : symux daemon, manual and auxilliary scripts
+symon-web-${V}.tgz : web frontend
+symon-${V}.tgz     : all of the above rolled into a single package
+

+ 4 - 0
symon/ports/symon/pkg/DESCR-mon

@@ -0,0 +1,4 @@
+symon is a lightweight system monitor that measures cpu, memory,
+interface and disk st atistics every 5 seconds. This information is
+then spooled over "the network" to symux for further processing.
+

+ 4 - 0
symon/ports/symon/pkg/DESCR-mux

@@ -0,0 +1,4 @@
+symux is a heavyweight data gatherer for the lightweight symon system
+monitor.  symon is a lightweight system monitor that measures cpu,
+memory, interface and disk statistics every 5 seconds.
+

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

@@ -0,0 +1,6 @@
+symon is a lightweight system monitor that measures cpu, memory,
+interface and disk st atistics 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.

+ 7 - 0
symon/ports/symon/pkg/MESSAGE

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

+ 4 - 0
symon/ports/symon/pkg/MESSAGE-mon

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

+ 7 - 0
symon/ports/symon/pkg/MESSAGE-mux

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

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

@@ -0,0 +1,8 @@
++---------------
+| 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'.
++---------------

+ 27 - 0
symon/ports/symon/pkg/PLIST

@@ -0,0 +1,27 @@
+@comment $Id: PLIST,v 1.1 2002/09/09 22:03:27 dijkstra Exp $
+@comment $OpenBSD$
+libexec/symon
+libexec/symux
+man/cat8/symon.0
+man/cat8/symux.0
+share/symon/c_smrrds.sh
+share/symon/symon.conf
+share/symon/symux.conf
+share/symon/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/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           
+@dirrm share/symon/web
+@dirrm share/symon

+ 6 - 0
symon/ports/symon/pkg/PLIST-mon

@@ -0,0 +1,6 @@
+@comment $Id: PLIST-mon,v 1.1 2002/09/09 22:03:27 dijkstra Exp $
+@comment $OpenBSD$
+libexec/symon
+man/cat8/symon.0
+share/symon/symon.conf
+@dirrm share/symon

+ 7 - 0
symon/ports/symon/pkg/PLIST-mux

@@ -0,0 +1,7 @@
+@comment $Id: PLIST-mux,v 1.1 2002/09/09 22:03:27 dijkstra Exp $
+@comment $OpenBSD$
+libexec/symux
+man/cat8/symux.0
+share/symon/c_smrrds.sh
+share/symon/symux.conf
+@dirrm share/symon

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

@@ -0,0 +1,20 @@
+@comment $Id: PLIST-web,v 1.2 2002/09/10 18:33:54 dijkstra Exp $
+@comment $OpenBSD$
+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/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           
+@dirrm share/symon/web
+@dirrm share/symon

+ 25 - 0
symon/symon/Makefile

@@ -0,0 +1,25 @@
+# $Id: Makefile,v 1.26 2002/09/14 15:49:39 dijkstra Exp $
+.include "../Makefile.inc"
+
+LIBS=	-L../lib -lsymon
+SRCS=	symon.c sm_cpu.c sm_mem.c sm_if.c sm_io.c sm_pf.c readconf.c symonnet.c 
+OBJS+=	${SRCS:R:S/$/.o/g}
+CFLAGS+=-DNET_INET6 -I../lib
+
+all: symon symon.cat8
+
+symon: ${OBJS}
+	${CC} -o $@ ${OBJS} ${LIBS}
+.ifndef DEBUG
+	${STRIP} $@
+.endif
+
+clean:
+	rm -f symon symon.cat8 ${OBJS}
+
+install: symon symon.cat8 symon.conf
+	${INSTALL} -c -m 555  -g wheel -o root symon      ${PREFIX}/${BINDIR}
+	${INSTALL} -c -m 444  -g wheel -o root symon.cat8 ${PREFIX}/${MANDIR}/cat8/symon.0
+	${INSTALL} -d -m 555  -g bin   -o root ${PREFIX}/${SHRDIR}
+	${INSTALL} -c -m 444  -g bin   -o root symon.conf ${PREFIX}/${SHRDIR}
+

+ 7 - 7
mon/mon/readconf.c → symon/symon/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.9 2002/08/29 19:38:53 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.10 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -43,14 +43,14 @@
 #include "data.h"
 #include "error.h"
 #include "lex.h"
-#include "mon.h"
+#include "symon.h"
 #include "net.h"
 #include "readconf.h"
 #include "xmalloc.h"
 
 __BEGIN_DECLS
 int read_host_port(struct muxlist *, struct mux *, struct lex *);
-int read_mon_args(struct mux *, struct lex *);
+int read_symon_args(struct mux *, struct lex *);
 int read_monitor(struct muxlist *, struct lex *);
 __END_DECLS
 
@@ -82,7 +82,7 @@ read_host_port(struct muxlist *mul, struct mux *mux, struct lex *l)
     else {
 	if (l->type != LXY_NUMBER) {
 	    lex_ungettoken(l);
-	    mux->port = MONMUX_PORT;
+	    mux->port = SYMUX_PORT;
 	    return 1;
 	}
     }
@@ -97,7 +97,7 @@ read_host_port(struct muxlist *mul, struct mux *mux, struct lex *l)
 }
 /* parse "<cpu(arg)|mem|if(arg)|io(arg)>", end condition == "}" */
 int 
-read_mon_args(struct mux *mux, struct lex *l) 
+read_symon_args(struct mux *mux, struct lex *l) 
 {
     char sn[_POSIX2_LINE_MAX];
     char sa[_POSIX2_LINE_MAX];
@@ -161,7 +161,7 @@ read_monitor(struct muxlist *mul, struct lex *l)
     mux = add_mux(mul, "<unnamed host>");
 
     /* parse cpu|mem|if|io */
-    if (!read_mon_args(mux, l))
+    if (!read_symon_args(mux, l))
 	return 0;
 
     /* parse stream to */
@@ -177,7 +177,7 @@ read_monitor(struct muxlist *mul, struct lex *l)
     return 1;
 }
 
-/* Read mon.conf */
+/* Read symon.conf */
 int
 read_config_file(struct muxlist *muxlist, 
 		 const char *filename)

+ 5 - 5
mon/mon/readconf.h → symon/symon/readconf.h

@@ -1,4 +1,4 @@
-/* $Id: readconf.h,v 1.3 2002/04/01 20:15:59 dijkstra Exp $ */
+/* $Id: readconf.h,v 1.4 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -30,8 +30,8 @@
  *
  */
 
-#ifndef _MON_READCONF_H
-#define _MON_READCONF_H
+#ifndef _SYMON_READCONF_H
+#define _SYMON_READCONF_H
 
 #include <sys/cdefs.h>
 
@@ -39,7 +39,7 @@
 #include "lex.h"
 
 /* Monitor subsystem structure */
-struct monm {
+struct symonm {
     int type;
     void  (*init)(char *);
     char* (*get)(char *);
@@ -48,6 +48,6 @@ struct monm {
 __BEGIN_DECLS
 int read_config_file(struct muxlist *, const char *);
 __END_DECLS
-#endif /*_MON_READCONF_H*/
+#endif /*_SYMON_READCONF_H*/
 
 

+ 5 - 5
mon/mon/cpu.c → symon/symon/sm_cpu.c

@@ -1,4 +1,4 @@
-/* $Id: cpu.c,v 1.12 2002/08/29 19:38:53 dijkstra Exp $ */
+/* $Id: sm_cpu.c,v 1.13 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /* The author of this code is Willem Dijkstra (wpd@xs4all.nl).
  * 
@@ -46,7 +46,7 @@
 
 /*
  * Get current cpu statistics in percentages (total of all counts = 100.0)
- * and returns them in mon_buf as
+ * and returns them in symon_buf as
  *
  * user : nice : system : interrupt : idle
  *
@@ -59,7 +59,7 @@
 #include <sys/sysctl.h>
 
 #include "error.h"
-#include "mon.h"
+#include "symon.h"
 
 __BEGIN_DECLS
 int percentages(int, int *, long *, long *, long *);
@@ -129,7 +129,7 @@ init_cpu(char *s)
 }
 /* Get new cpu measurements */
 int 
-get_cpu(char *mon_buf, int maxlen, char *s) 
+get_cpu(char *symon_buf, int maxlen, char *s) 
 {
     int total;
 
@@ -141,7 +141,7 @@ get_cpu(char *mon_buf, int maxlen, char *s)
     /* convert cp_time counts to percentages */
     total = percentages(CPUSTATES, cp_states, cp_time, cp_old, cp_diff);
     
-    return snpack(mon_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], 

+ 5 - 5
mon/mon/if.c → symon/symon/sm_if.c

@@ -1,4 +1,4 @@
-/* $Id: if.c,v 1.5 2002/08/31 15:01:04 dijkstra Exp $ */
+/* $Id: sm_if.c,v 1.6 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -31,7 +31,7 @@
  */
 
 /*
- * Get current interface statistics from kernel and return them in mon_buf as
+ * Get current interface statistics from kernel and return them in symon_buf as
  *
  * ipackets : opackets : ibytes : obytes : imcasts : omcasts : ierrors :
  * oerrors : colls : drops
@@ -60,7 +60,7 @@
 #include <string.h>
 
 #include "error.h"
-#include "mon.h"
+#include "symon.h"
 
 /* Globals for this module start with if_ */
 int if_s = -1;
@@ -77,7 +77,7 @@ init_if(char *s)
 }
 /* Get interface statistics */
 int 
-get_if(char *mon_buf, int maxlen, char *interface) 
+get_if(char *symon_buf, int maxlen, char *interface) 
 {
     struct ifreq ifr;
     struct if_data ifdata;
@@ -91,7 +91,7 @@ get_if(char *mon_buf, int maxlen, char *interface)
 	return 0;
     }
     
-    return snpack(mon_buf, maxlen, interface, MT_IF,
+    return snpack(symon_buf, maxlen, interface, MT_IF,
 		  ifdata.ifi_ipackets, 
 		  ifdata.ifi_opackets, 
 		  ifdata.ifi_ibytes, 

+ 151 - 0
symon/symon/sm_io.c

@@ -0,0 +1,151 @@
+/* $Id: sm_io.c,v 1.8 2002/09/14 15:49:39 dijkstra Exp $ */
+
+/*
+ * Copyright (c) 2001-2002 Willem Dijkstra
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *    - Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    - Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials provided
+ *      with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Get current disk transfer statistics from kernel and return them in symon_buf as
+ * 
+ * total nr of transfers : total seeks : total bytes transferred
+ *
+ * Non re-entrant code: gets_io messes with globals r/w without a semaphore.
+ * 
+ */
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/disk.h>
+
+#include <limits.h>
+#include <string.h>
+
+#include "error.h"
+#include "symon.h"
+#include "xmalloc.h"
+
+/* Globals for this module start with io_ */
+char *io_dkstr = NULL;
+struct diskstats *io_dkstats = NULL;
+char **io_dknames = NULL;
+int io_dks = 0;
+int io_maxdks = 0;
+int io_maxstr = 0;
+
+void 
+gets_io() 
+{
+    int mib[3];
+    char *p;
+    int dks;
+    size_t size;
+    size_t strsize;
+    
+    /* how much memory is needed */
+    mib[0] = CTL_HW;
+    mib[1] = HW_DISKCOUNT;
+    size = sizeof(dks);
+    if (sysctl(mib, 2, &dks, &size, NULL, 0) < 0) {
+	fatal("%s:%d: sysctl failed: can't get hw.diskcount",
+	      __FILE__, __LINE__);
+    }
+
+    mib[0] = CTL_HW;
+    mib[1] = HW_DISKNAMES;
+    strsize = 0;
+    if (sysctl(mib, 2, NULL, &strsize, NULL, 0) < 0) {
+	fatal("%s:%d: sysctl failed: can't get hw.disknames", 
+	      __FILE__, __LINE__);
+    }
+
+    /* increase buffers if necessary */
+    if (dks > io_maxdks || strsize > io_maxstr) {
+	io_maxdks = dks;
+	io_maxstr = strsize;
+
+	if (io_maxdks > SYMON_MAX_DOBJECTS) {
+	    fatal("%s:%d: dynamic object limit (%d) exceeded for diskstat structures",
+		  __FILE__, __LINE__, SYMON_MAX_DOBJECTS);
+	}
+	
+	if (io_maxstr > SYMON_MAX_OBJSIZE) {
+	    fatal("%s:%d: string size exceeded (%d)",
+		  __FILE__, __LINE__, SYMON_MAX_OBJSIZE);
+	}
+
+	io_dkstats = xrealloc(io_dkstats, io_maxdks * sizeof(struct diskstats));
+	io_dknames = xrealloc(io_dknames, io_maxdks * sizeof(char *));
+	io_dkstr = xrealloc(io_dkstr, io_maxstr + 1);
+    }
+
+    /* read data in anger */
+    mib[0] = CTL_HW;
+    mib[1] = HW_DISKNAMES;
+    if (sysctl(mib, 2, io_dkstr, &io_maxstr, NULL, 0) < 0) {
+	fatal("%s:%d: io can't get hw.disknames"
+	      __FILE__, __LINE__);
+    }
+    io_dkstr[io_maxstr] = '\0';
+
+    mib[0] = CTL_HW;
+    mib[1] = HW_DISKSTATS;
+    size = io_maxdks * sizeof(struct diskstats);
+    if (sysctl(mib, 2, io_dkstats, &size, NULL, 0) < 0) {
+	fatal("%s:%d: io can't get hw.diskstats"
+	      __FILE__, __LINE__);
+    }
+
+    p = io_dkstr;
+    io_dks = 0;
+    while ((io_dknames[io_dks] = strsep(&p, ",")) != NULL)
+	io_dks++;
+}    
+/* Prepare io module for first use */
+void 
+init_io(char *s) 
+{
+    info("started module io(%s)", s);
+}
+/* Get new io statistics */
+int 
+get_io(char *symon_buf, int maxlen, char *disk) 
+{
+    int i;
+
+    /* look for disk */
+    for (i=0; i<io_dks; i++) {
+	if (strncmp(io_dknames[i], disk, 
+		    (io_dkstr + io_maxstr - io_dknames[i])) == 0)
+	    return snpack(symon_buf, maxlen, disk, MT_IO,
+			  io_dkstats[i].ds_xfer, 
+			  io_dkstats[i].ds_seek,
+			  io_dkstats[i].ds_bytes);
+    } 
+
+    return 0;
+}

+ 5 - 5
mon/mon/mem.c → symon/symon/sm_mem.c

@@ -1,4 +1,4 @@
-/* $Id: mem.c,v 1.11 2002/04/09 05:37:37 dijkstra Exp $ */
+/* $Id: sm_mem.c,v 1.12 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -31,7 +31,7 @@
  */
 
 /*
- * Get current memory statistics in bytes; reports them back in mon_buf as
+ * Get current memory statistics in bytes; reports them back in symon_buf as
  *
  * real active : real total : free : [swap used : swap total]
  *
@@ -49,7 +49,7 @@
 #include <limits.h>
 
 #include "error.h"
-#include "mon.h"
+#include "symon.h"
 #include "xmalloc.h"
 
 #define pagetob(size) ((size) << me_pageshift)
@@ -95,7 +95,7 @@ init_mem(char *s)
 }
 /* Get memory statistics */
 int 
-get_mem(char *mon_buf, int maxlen, char *s)
+get_mem(char *symon_buf, int maxlen, char *s)
 {
     int i,rnswap;
 
@@ -127,7 +127,7 @@ get_mem(char *mon_buf, int maxlen, char *s)
 	}
     }
 
-    return snpack(mon_buf, maxlen, s, MT_MEM, 
+    return snpack(symon_buf, maxlen, s, MT_MEM, 
 		  me_stats[0], me_stats[1], me_stats[2], 
 		  me_stats[3], me_stats[4]);
 }

+ 5 - 5
mon/mon/pf.c → symon/symon/sm_pf.c

@@ -1,4 +1,4 @@
-/* $Id: pf.c,v 1.2 2002/08/31 15:02:10 dijkstra Exp $ */
+/* $Id: sm_pf.c,v 1.3 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2002 Daniel Hartmeier
@@ -31,7 +31,7 @@
  */
 
 /*
- * Get current pf statistics and return them in mon_buf as 
+ * Get current pf statistics and return them in symon_buf as 
  *
  *   bytes_v4_in : bytes_v4_out : bytes_v6_in : bytes_v6_out :
  *   packets_v4_in_pass : * packets_v4_in_drop : packets_v4_out_pass :
@@ -54,7 +54,7 @@
 #include <string.h>
 
 #include "error.h"
-#include "mon.h"
+#include "symon.h"
 
 /* Globals for this module start with pf_ */
 static int pf_dev = -1;
@@ -72,7 +72,7 @@ init_pf(char *s)
 }
 /* Get pf statistics */
 int
-get_pf(char *mon_buf, int maxlen, char *arg)
+get_pf(char *symon_buf, int maxlen, char *arg)
 {
     struct pf_status s;
     u_int64_t n;
@@ -91,7 +91,7 @@ get_pf(char *mon_buf, int maxlen, char *arg)
 	return 0;
     
     n = s.states;
-    return snpack(mon_buf, maxlen, arg, MT_PF,
+    return snpack(symon_buf, maxlen, arg, MT_PF,
 		  s.bcounters[0][PF_IN],
 		  s.bcounters[0][PF_OUT],
 		  s.bcounters[1][PF_IN],

+ 15 - 18
mon/mon/mon.8 → symon/symon/symon.8

@@ -28,10 +28,10 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\" 
 .Dd April 5, 2002
-.Dt MON 8
+.Dt SYMON 8
 .Os
 .Sh NAME
-.Nm mon
+.Nm symon
 .Nd system monitor
 .Sh SYNOPSIS
 .Nm 
@@ -41,20 +41,20 @@
 .Nm
 is a lightweight system monitor that measures cpu, memory, interface and disk
 statistics every 5 seconds. This information is then spooled to
-.Xr monmux 8
+.Xr symux 8
 for further processing. 
 .Pp
 .Nm
 has been designed to inflict minimal performance and security impact on the system it monitors. 
-.Xr monmux 8
+.Xr symux 8
 has performance impact proportional to the amount of streams it needs to manage. Ideally 
-.Xr monmux 
+.Xr symux 
 should live on a different system and collect data from several 
 .Nm
 instances in a LAN. 
 .Lp
 .Nm
-priviledge needs depend on the probes used. The cpu, mem and interface probes will work even when mon runs as 
+priviledge needs depend on the probes used. The cpu, mem, disk and interface probes will work even when symon runs as 
 .Ar "nobody" . 
 For pf, read and write access to 
 .Pa /dev/pf
@@ -62,9 +62,6 @@ is needed, so
 .Nm 
 will have to run as
 .Ar "root".
-Only the io probe requires 
-.Ar kmem
-priviledges. All other probes use ioctls and sysctls to obtain their data.
 .Lp
 The options:
 .Bl -tag -width Ds
@@ -78,9 +75,9 @@ from becoming a daemon and show debug information on stdout.
 .Sh CONFIGURATION
 .Nm
 obtains configuration data from 
-.Pa /etc/mon.conf .
+.Pa /etc/symon.conf .
 The configuration file contains monitor stanzas that define what resources should be monitored and to which 
-.Xr monmux 8
+.Xr symux 8
 the information should be streamed to.
 .Pp
 Multiple monitor statements to different muxes are allowed. Whitespace, newlines and text behind '#' are ignored. The format in BNF:
@@ -95,7 +92,7 @@ argument     = number | interfacename | diskname
 .fi
 .Sh EXAMPLE
 Here is an example 
-.Ar mon.conf
+.Ar symon.conf
 that monitors cpu, memory, pf, interfaces xl0/de0/lo0/wi0, disks wd[0-3]/cd[0-1]
 and streams that information to localhost on port 2100.
 .Pp
@@ -111,31 +108,31 @@ monitor { cpu(0),  mem, pf, if(xl0), if(de0),
 Causes
 .Nm
 to read 
-.Pa /etc/mon.conf .
+.Pa /etc/symon.conf .
 .Nm
 will keep the old configuration if errors occured during parsing of the configuration file.
 .Sh FILES
 .Bl -tag -width Ds
-.It Pa /var/run/mon.pid
+.It Pa /var/run/symon.pid
 Contains the program id of the
 .Nm
 daemon.
-.It Pa /etc/mon.conf
+.It Pa /etc/symon.conf
 .Nm
 system wide configuration file. 
 .El
 .Sh BUGS
 Every monitored resource mentioned 
-.Pa /etc/mon.conf 
+.Pa /etc/symon.conf 
 gets queried. Mentioning, for example, cpu(0) twice for different muxes will result in two distinct cpu(0) measurement actions. 
 .Pp
 .Nm 
 does not check whether resources mentioned in 
-.Pa /etc/mon.conf
+.Pa /etc/symon.conf
 exist. 
 .Sh AUTHOR
 Willem Dijkstra <wpd@xs4all.nl>. Daniel Hartmeier <daniel@benzedrine.cx>
 contributed the pf probe and helped to port to big-endian architectures.
 .Sh SEE ALSO
-.Xr monmux 8 
+.Xr symux 8 
  

+ 28 - 64
mon/mon/mon.c → symon/symon/symon.c

@@ -1,4 +1,4 @@
-/* $Id: mon.c,v 1.22 2002/08/31 16:09:55 dijkstra Exp $ */
+/* $Id: symon.c,v 1.24 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -43,8 +43,8 @@
 
 #include "data.h"
 #include "error.h"
-#include "mon.h"
-#include "monnet.h"
+#include "symon.h"
+#include "symonnet.h"
 #include "net.h"
 #include "readconf.h"
 #include "xmalloc.h"
@@ -57,43 +57,17 @@ __END_DECLS
 
 int flag_hup = 0;
 
-#ifdef MON_KVM
-kvm_t *kvmd;
-struct nlist mon_nl[] = {
-    {"_disklist"},   /* MON_DL    = 0  (mon.h)*/
-    {""},
-};
-/* Read kernel memory */
-int 
-kread(u_long addr, char *buf, int size)
-{
-    if (kvm_read(kvmd, addr, buf, size) != size) {
-	warning("kvm_read:%s", kvm_geterr(kvmd));
-	return 1;
-    }
-
-    return 0;
-}
-#else /* MON_KVM */
-int 
-kread(u_long addr, char *buf, int size)
-{
-    warning("kvm_read not compiled in, calling probe will signal failure");
-
-    return 0;
-}
-#endif
 /* map stream types to inits and getters */
 struct funcmap streamfunc[] = {
-    {MT_IO,  init_io,  get_io},
-    {MT_CPU, init_cpu, get_cpu},
-    {MT_MEM, init_mem, get_mem},
-    {MT_IF,  init_if,  get_if},
-    {MT_PF,  init_pf,  get_pf},
+    {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_EOT, NULL, NULL}
 };
 
-/* Alarmhandler that gets called every MON_INTERVAL */
+/* Alarmhandler that gets called every SYMON_INTERVAL */
 void 
 alarmhandler(int s) {
     /* EMPTY */
@@ -109,9 +83,9 @@ huphandler(int s) {
     flag_hup = 1;
 }
 /* 
- * Mon is a system measurement utility. 
+ * Symon is a system measurement utility. 
  *
- * The main goals mon hopes to accomplish is:
+ * The main goals symon hopes to accomplish is:
  * - to take fine grained measurements of system parameters 
  * - with minimal performance impact 
  * - in a secure way.
@@ -119,10 +93,10 @@ huphandler(int s) {
  * 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 mon provides is done by a second program, called monmux.
+ * information that symon provides is done by a second program, called symux.
  * 
- * Mon can keep track of cpu, memory, disk and network interface
- * interactions. Mon was built specifically for OpenBSD.
+ * Symon can keep track of cpu, memory, disk and network interface
+ * interactions. Symon was built specifically for OpenBSD.
  */
 int 
 main(int argc, char *argv[])
@@ -132,11 +106,8 @@ main(int argc, char *argv[])
     struct stream *stream;
     struct mux *mux;
     FILE *f;
-#ifdef MON_KVM
-    char mon_buf[_POSIX2_LINE_MAX];
-    char *nlistf = NULL, *memf = NULL;
-#endif
     int ch;
+    int i;
 
     SLIST_INIT(&mul);
 
@@ -150,26 +121,13 @@ main(int argc, char *argv[])
 	    flag_debug = 1;
 	    break;
 	case 'v':
-	    info("mon version %s", MON_VERSION);
+	    info("symon version %s", SYMON_VERSION);
 	default:
 	    info("usage: %s [-d] [-v]", __progname);
 	    exit(1);
 	}
     }
 
-#ifdef MON_KVM
-    /* Populate our kernel name list */
-    if ((kvmd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, mon_buf)) == NULL)
-	fatal("kvm_open: %s", mon_buf);
-    
-    if (kvm_nlist(kvmd, mon_nl) < 0 || mon_nl[0].n_type == 0) {
-	if (nlistf)
-	    fatal("%s: no namelist", nlistf);
-	else
-	    fatal("no namelist");
-    }
-#endif /* MON_KVM */
-
     setegid(getgid());
     setgid(getgid());
 
@@ -180,16 +138,16 @@ main(int argc, char *argv[])
 	flag_daemon = 1;
 
 	/* record pid */
-	f = fopen(MON_PID_FILE, "w");
+	f = fopen(SYMON_PID_FILE, "w");
 	if (f) {
 	    fprintf(f, "%u\n", (u_int) getpid());
 	    fclose(f);
 	}
     } 
 
-    info("mon version %s", MON_VERSION);
+    info("symon version %s", SYMON_VERSION);
 
-    if (!read_config_file(&mul, MON_CONFIG_FILE))
+    if (!read_config_file(&mul, SYMON_CONFIG_FILE))
 	fatal("configuration contained errors; quitting");
 
     if (flag_debug == 1)
@@ -217,21 +175,21 @@ main(int argc, char *argv[])
     timerclear(&alarminterval.it_interval);
     timerclear(&alarminterval.it_value);
     alarminterval.it_interval.tv_sec=
-	alarminterval.it_value.tv_sec=MON_INTERVAL;
+	alarminterval.it_value.tv_sec=SYMON_INTERVAL;
 
     if (setitimer(ITIMER_REAL, &alarminterval, NULL) != 0) {
 	fatal("alarm setup failed -- %s", strerror(errno));
     }
 
     for (;;) {  /* FOREVER */
-	sleep(MON_INTERVAL*2);    /* alarm will always interrupt sleep */
+	sleep(SYMON_INTERVAL*2);    /* alarm will always interrupt sleep */
 
 	if (flag_hup == 1) {
 	    flag_hup = 0;
 
 	    SLIST_INIT(&newmul);
 
-	    if (!read_config_file(&newmul, MON_CONFIG_FILE)) {
+	    if (!read_config_file(&newmul, SYMON_CONFIG_FILE)) {
 		info("new configuration contains errors; keeping old configuration");
 		free_muxlist(&newmul);
 	    } else {
@@ -249,6 +207,12 @@ main(int argc, char *argv[])
 	    }
 	}
 
+	/* populate data space for modules that get all their measurements in
+           one go */
+	for (i=0; i<MT_EOT; i++)
+	    if (streamfunc[i].gets != NULL)
+		(streamfunc[i].gets)();
+
 	SLIST_FOREACH(mux, &mul, muxes) {
 	    prepare_packet(mux);
 	    

+ 0 - 0
mon/mon/mon.conf → symon/symon/symon.conf


+ 15 - 32
mon/mon/mon.h → symon/symon/symon.h

@@ -1,4 +1,4 @@
-/* $Id: mon.h,v 1.16 2002/08/31 15:00:25 dijkstra Exp $ */
+/* $Id: symon.h,v 1.19 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -30,51 +30,33 @@
  *
  */
 
-#ifndef _MON_MON_H
-#define _MON_MON_H
+#ifndef _SYMON_SYMON_H
+#define _SYMON_SYMON_H
 
 #include <sys/queue.h>
 
-#ifdef MON_KVM
-#include <kvm.h>
-#include <nlist.h>
-#endif
-
 #include "lex.h"
 #include "data.h"
 
-#define MON_CONFIG_FILE "/etc/mon.conf"
-#define MON_PID_FILE    "/var/run/mon.pid"
-#define MON_VERSION     "2.3"
-#define MON_INTERVAL 5                           /* measurement interval */
-#define MON_WARN_SENDERR 50                      /* warn every x errors */
-
-/* kvm interface */
-#ifdef MON_KVM
-extern kvm_t *kvmd;
-extern struct nlist mon_nl[];
-#define MON_DL    0
-#endif /* MON_KVM */
-
+#define SYMON_CONFIG_FILE "/etc/symon.conf"
+#define SYMON_PID_FILE    "/var/run/symon.pid"
+#define SYMON_VERSION     "2.5"
+#define SYMON_INTERVAL 5                           /* measurement interval */
+#define SYMON_WARN_SENDERR 50                      /* warn every x errors */
+#define SYMON_MAX_DOBJECTS  100                    /* max dynamic alloction
+                                                     = 100 objects */
+#define SYMON_MAX_OBJSIZE  (_POSIX2_LINE_MAX)      /* max allocation unit 
+						     = _POSIX2_LINE_MAX */
 struct funcmap {
     int type;
     void (*init)(char *);
+    void (*gets)();
     int (*get)(char*, int, char *);
 };
-
 extern struct funcmap streamfunc[];
 
 /* prototypes */
 __BEGIN_DECLS
-#ifdef MON_KVM
-extern int kread(u_long, char *, int);
-#else
-extern int kread(u_long, char *, int); /* This is a stub that reports an error
-					  when called. I included it so as not
-					  to miss any stuff when the time has
-					  come to rip all MON_KVM stuff out */
-#endif
-
 /* cpu.c */
 extern void init_cpu(char *);
 extern int  get_cpu(char *, int, char *);
@@ -89,6 +71,7 @@ extern int  get_if(char *, int, char *);
 
 /* io.c */
 extern void init_io(char *);
+extern void gets_io();
 extern int  get_io(char *, int, char *);
 
 /* pf.c */
@@ -96,4 +79,4 @@ extern void init_pf(char *);
 extern int  get_pf(char *, int, char *);
 __END_DECLS
 
-#endif /*_MON_MON_H*/
+#endif /*_SYMON_SYMON_H*/

+ 8 - 8
mon/mon/monnet.c → symon/symon/symonnet.c

@@ -1,4 +1,4 @@
-/* $Id: monnet.c,v 1.9 2002/09/02 06:16:55 dijkstra Exp $ */
+/* $Id: symonnet.c,v 1.10 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -41,7 +41,7 @@
 
 #include "error.h"
 #include "data.h"
-#include "mon.h"
+#include "symon.h"
 #include "net.h"
 
 /* Fill a mux structure with inet details */
@@ -50,7 +50,7 @@ connect2mux(struct mux *mux)
 {
     struct sockaddr_in sockaddr;
 
-    if ((mux->monsocket = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+    if ((mux->symonsocket = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
 	fatal("could not obtain socket: %.200s", strerror(errno));
 
     sockaddr.sin_family = AF_INET;
@@ -58,7 +58,7 @@ connect2mux(struct mux *mux)
     sockaddr.sin_addr.s_addr = htonl(INADDR_ANY);
     bzero(&sockaddr.sin_zero, 8);
 
-    if (bind(mux->monsocket, (struct sockaddr *) &sockaddr, 
+    if (bind(mux->symonsocket, (struct sockaddr *) &sockaddr, 
 	     sizeof(struct sockaddr)) == -1)
 	fatal("could not bind socket: %.200s", strerror(errno));
 
@@ -74,14 +74,14 @@ connect2mux(struct mux *mux)
 void 
 send_packet(struct mux *mux)
 {   
-    if (sendto(mux->monsocket, (void *)&mux->packet.data, 
+    if (sendto(mux->symonsocket, (void *)&mux->packet.data, 
 	       mux->offset, 0, (struct sockaddr *)&mux->sockaddr, 
 	       sizeof(mux->sockaddr))
 	!= mux->offset) {
 	mux->senderr++;
     }
 
-    if (mux->senderr >= MON_WARN_SENDERR)
+    if (mux->senderr >= SYMON_WARN_SENDERR)
 	warning("%d updates to mux(%u.%u.%u.%u) lost due to send errors",
 		mux->senderr, 
 		IPAS4BYTES(mux->ip)), mux->senderr = 0;
@@ -93,10 +93,10 @@ prepare_packet(struct mux *mux)
     time_t t = time(NULL);
 
     bzero(&mux->packet, sizeof(mux->packet));
-    mux->packet.header.mon_version = MON_PACKET_VER;
+    mux->packet.header.symon_version = SYMON_PACKET_VER;
     mux->packet.header.timestamp = t;
 
-    /* monpacketheader is always first stream */
+    /* symonpacketheader is always first stream */
     mux->offset = 
 	setheader((char *)&mux->packet.data, 
 		  &mux->packet.header);

+ 4 - 4
mon/mon/monnet.h → symon/symon/symonnet.h

@@ -1,4 +1,4 @@
-/* $Id: monnet.h,v 1.3 2002/03/31 14:27:48 dijkstra Exp $ */
+/* $Id: symonnet.h,v 1.4 2002/09/14 15:49:39 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -30,8 +30,8 @@
  *
  */
 
-#ifndef _MON_MONNET_H
-#define _MON_MONNET_H
+#ifndef _SYMON_SYMONNET_H
+#define _SYMON_SYMONNET_H
 
 #include "data.h"
 
@@ -43,4 +43,4 @@ void prepare_packet(struct mux *);
 void stream_in_packet(struct stream *, struct mux *);
 void finish_packet(struct mux *);
 __END_DECLS
-#endif /* _MON_MONNET_H */
+#endif /* _SYMON_SYMONNET_H */

+ 3 - 3
mon/mon2web/Makefile → symon/symon2web/Makefile

@@ -1,4 +1,4 @@
-# $Id: $
+# $Id: Makefile,v 1.2 2002/09/14 15:55:54 dijkstra Exp $
 .include "../Makefile.inc"
 
 all:
@@ -20,7 +20,7 @@ install:
 	${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 mon.css		${PREFIX}/${WEBDIR}
-	${INSTALL} -c -m 444 -g www -o www mon.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 spacer.png		${PREFIX}/${WEBDIR}
 

+ 0 - 0
mon/mon2web/class_cpu.inc → symon/symon2web/class_cpu.inc


+ 0 - 0
mon/mon2web/class_graph.inc → symon/symon2web/class_graph.inc


+ 0 - 0
mon/mon2web/class_if.inc → symon/symon2web/class_if.inc


+ 0 - 0
mon/mon2web/class_io.inc → symon/symon2web/class_io.inc


+ 0 - 0
mon/mon2web/class_mem.inc → symon/symon2web/class_mem.inc


+ 239 - 0
symon/symon2web/class_pf.inc

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

+ 7 - 0
symon/symon2web/datasources.inc

@@ -0,0 +1,7 @@
+<?php
+// $Id: datasources.inc,v 1.9 2002/09/14 15:55:54 dijkstra Exp $
+//
+// Contains definitions where the data files are to be found
+$symon2web["tree"]='/export/store_3/symon';
+
+?>

+ 0 - 0
mon/mon2web/graph_cpu.php → symon/symon2web/graph_cpu.php


+ 0 - 0
mon/mon2web/graph_if.php → symon/symon2web/graph_if.php


+ 0 - 0
mon/mon2web/graph_io.php → symon/symon2web/graph_io.php


+ 0 - 0
mon/mon2web/graph_mem.php → symon/symon2web/graph_mem.php


+ 0 - 0
mon/mon2web/graph_pf.php → symon/symon2web/graph_pf.php


+ 27 - 23
mon/mon2web/index.php → symon/symon2web/index.php

@@ -76,8 +76,8 @@ function print_index_url($new_args) {
 <html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>mon statistics</title>
- <link rel="stylesheet" href="mon.css" type="text/css" />
+ <title>symon statistics</title>
+ <link rel="stylesheet" href="symon.css" type="text/css" />
 </head>
 <body>
  <table border="0" cellspacing="0" cellpadding="0" align="center">
@@ -85,17 +85,17 @@ function print_index_url($new_args) {
    <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" /></td>
-      <td width="5%"/></td>
+      <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" /></td>
+      <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="mon.png" width="149" border="0" alt="[mon]" />
+        <img src="symon.png" width="149" border="0" alt="[symon]" />
        </div> 
 
        <div class="left">
@@ -130,22 +130,26 @@ function print_index_url($new_args) {
 	 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 />
         </div>
        </div>
       </td>
 
      <!-- main window -->
-      <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1" /></td>
+      <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>
 <?
-	 $root_dir = dir($mon2web["tree"]);
+	 $root_dir = dir($symon2web["tree"]);
          while ($machine = $root_dir->read()) {
 	     if ($machine != '.' && 
 		 $machine != '..' && 
-		 is_dir($mon2web["tree"]."/".$machine)) {
+		 is_dir($symon2web["tree"]."/".$machine)) {
 		 print '
           <td><a class="blue" href="';
 		 print_index_url("#" . $machine);
@@ -161,22 +165,22 @@ function print_index_url($new_args) {
        <div class="items">
 	
 <?php
-// traverse through the monrrd tree
-  $root_dir = dir($mon2web["tree"]);
+// traverse through the symonrrd tree
+  $root_dir = dir($symon2web["tree"]);
   $found_machine = 0;
   while ($machine = $root_dir->read()) {
       if ($machine != '.' && 
 	  $machine != '..' && 
-	  is_dir($mon2web["tree"]."/".$machine)) {
+	  is_dir($symon2web["tree"]."/".$machine)) {
 	  print '
         <!-- item start -->
         <div class="header">
 	 <a class="header" name="'. $machine . '">'. $machine. '</a><br />
 	</div>
 ';
-	  $machine_dir = dir($mon2web["tree"]."/".$machine);
+	  $machine_dir = dir($symon2web["tree"]."/".$machine);
 	  while ($filename = $machine_dir->read()) {
-	      $file = $mon2web["tree"]."/".$machine."/".$filename;
+	      $file = $symon2web["tree"]."/".$machine."/".$filename;
 	      if (is_file($file) && 
 		  preg_match("/^(cpu|if|io|mem|pf)(_([a-z]+))?([0-9]?).rrd$/", 
 			     $filename, $match)) {
@@ -187,7 +191,7 @@ function print_index_url($new_args) {
 		  $cmd = make_graph_url($rrdtype,
 					"rrdfile=".$file.
 					"&name=".$rrdwhat.$rrdwhich);
-		  print '<img src="' . $cmd . '">'."\n";
+		  print '<img src="' . $cmd . '" alt="'. $rrdtype . $rrdwhat . $rrdwhich .'">'."\n";
 		  $found_machine++;
 	      }
 	  }
@@ -199,7 +203,7 @@ function print_index_url($new_args) {
   }
   
   if ($found_machine == 0) {
-      print 'Did not find any host directories in '.$mon2web["tree"].'<br>';
+      print 'Did not find any host directories in '.$symon2web["tree"].'<br>';
   }
 ?>
        <div class="copyright">Copyright &copy; 2002 Willem Dijkstra</div>
@@ -208,19 +212,19 @@ function print_index_url($new_args) {
       </td> <!-- end main window -->
 
       <!-- horizontal endline -->
-      <td width="1" bgcolor="#555599"><img src="spacer.png" width="1" height="1" /></td>
+      <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" /></td>
-      <td width="5%"/></td>
+      <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>
+   <td width="5%"></td>
   </tr>
  </table>
 </body>

+ 0 - 0
mon/mon2web/spacer.png → symon/symon2web/spacer.png


+ 0 - 0
mon/mon2web/mon.css → symon/symon2web/symon.css


BIN
symon/symon2web/symon.png


+ 30 - 0
symon/symux/Makefile

@@ -0,0 +1,30 @@
+# $Id: Makefile,v 1.14 2002/09/14 15:54:55 dijkstra Exp $
+.include "../Makefile.inc"
+
+SRCS=	symux.c readconf.c symuxnet.c share.c
+OBJS+=	${SRCS:R:S/$/.o/g}
+LIBS=  -L../lib -L/usr/local/lib -lrrd -lsymon
+CFLAGS+=-I../lib -I/usr/local/include
+
+all: symux symux.cat8
+
+symux: ${OBJS}
+	${CC} -o $@ ${OBJS} ${LIBS}
+.ifndef DEBUG
+	${STRIP} $@
+.endif
+
+clean:
+	rm -f symux symux.cat8 ${OBJS}
+
+install: symux symux.cat8 c_smrrds.sh symux.conf
+	${INSTALL} -c -m 555 -g bin   -o root symux      ${PREFIX}/${BINDIR}
+	${INSTALL} -c -m 444 -g wheel -o root symux.cat8 ${PREFIX}/${MANDIR}/cat8/symux.0
+	${INSTALL} -d -m 555 -g bin   -o root ${PREFIX}/${SHRDIR}
+	${INSTALL} -c -m 544 -g bin   -o root c_smrrds.sh  ${PREFIX}/${SHRDIR}
+	${INSTALL} -c -m 444 -g bin   -o root symux.conf   ${PREFIX}/${SHRDIR}
+
+cleanipc:
+	ipcs | egrep "^m" | awk '{print $$2}' | xargs -n1 ipcrm -m &
+	ipcs | egrep "^s" | awk '{print $$2}' | xargs -n1 ipcrm -s 
+

+ 3 - 3
mon/monmux/c_monrrds.sh → symon/symux/c_smrrds.sh

@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: c_monrrds.sh,v 1.11 2002/09/06 12:17:11 dijkstra Exp $
+# $Id: c_smrrds.sh,v 1.12 2002/09/14 15:54:55 dijkstra Exp $
 
 #
 # Copyright (c) 2001-2002 Willem Dijkstra
@@ -29,14 +29,14 @@
 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-# mon datafiles "make" file. Valid arguments:
+# symon datafiles "make" file. Valid arguments:
 #       all      Makes all files for active interfaces and disks
 #       mem      Make memory file
 #       cpu?     Make cpu file
 #       pf       Make pf file
 
 # --- user configuration starts here
-INTERVAL=`grep MON_INTERVAL ../mon/mon.h 2>/dev/null | cut -f3 -d\ `
+INTERVAL=`grep SYMON_INTERVAL ../symon/symon.h 2>/dev/null | cut -f3 -d\ `
 INTERVAL=${INTERVAL:-5}
 # RRA setup:
 # - 2   days of  5 second  samples = 34560 x 5 second samples

+ 3 - 3
mon/monmux/readconf.c → symon/symux/readconf.c

@@ -1,4 +1,4 @@
-/* $Id: readconf.c,v 1.12 2002/08/29 19:38:56 dijkstra Exp $ */
+/* $Id: readconf.c,v 1.13 2002/09/14 15:54:55 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -80,7 +80,7 @@ read_mux(struct muxlist *mul, struct lex *l)
     else {
 	if (l->type != LXY_NUMBER) {
 	    lex_ungettoken(l);
-	    m->port = MONMUX_PORT;
+	    m->port = SYMUX_PORT;
 	    return 1;
 	}
     }
@@ -247,7 +247,7 @@ read_source(struct sourcelist *sol, struct lex *l)
 
     return 0;
 }
-/* Read monmux.conf */
+/* Read symux.conf */
 int  
 read_config_file(struct muxlist *mul, 
 		 struct sourcelist *sol, 

+ 4 - 4
mon/monmux/readconf.h → symon/symux/readconf.h

@@ -1,4 +1,4 @@
-/* $Id: readconf.h,v 1.4 2002/04/01 20:16:04 dijkstra Exp $ */
+/* $Id: readconf.h,v 1.5 2002/09/14 15:54:55 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -31,8 +31,8 @@
  * (copyrighting a file like this does seem rather pointless...)
  */
 
-#ifndef _MONMUX_READCONF_H
-#define _MONMUX_READCONF_H
+#ifndef _SYMUX_READCONF_H
+#define _SYMUX_READCONF_H
 
 #include "data.h"
 
@@ -40,6 +40,6 @@ __BEGIN_DECLS
 int read_config_file(struct muxlist *, struct sourcelist *, const char *);
 __END_DECLS
 
-#endif /*_MONMUX_READCONF_H*/
+#endif /*_SYMUX_READCONF_H*/
 
 

+ 4 - 4
mon/monmux/share.c → symon/symux/share.c

@@ -1,4 +1,4 @@
-/* $Id: share.c,v 1.8 2002/08/31 16:09:56 dijkstra Exp $ */
+/* $Id: share.c,v 1.9 2002/09/14 15:54:55 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -35,7 +35,7 @@
  * Check wether one buffer suffices, do some performance tests
  */
 
-/* Share contains all routines needed for the ipc between monmuxes */
+/* Share contains all routines needed for the ipc between symuxes */
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
@@ -49,12 +49,12 @@
 
 #include "data.h"
 #include "error.h"
-#include "muxnet.h"
+#include "symuxnet.h"
 #include "share.h"
 
 /* Shared operation: 
  *
- * The moment the master monmux receives a new packet:
+ * The moment the master symux receives a new packet:
  *
  * master calls master_forbidread:
  * - master checks the 'SEM_READ' semaphore to be equal to the number of

+ 5 - 5
mon/monmux/share.h → symon/symux/share.h

@@ -1,4 +1,4 @@
-/* $Id: share.h,v 1.3 2002/06/21 15:53:32 dijkstra Exp $ */
+/* $Id: share.h,v 1.4 2002/09/14 15:54:55 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -35,12 +35,12 @@
  * Check wether one buffer suffices, do some performance tests
  */
 
-#ifndef _MONMUX_SHARE_H
-#define _MONMUX_SHARE_H
+#ifndef _SYMUX_SHARE_H
+#define _SYMUX_SHARE_H
 
 #include "data.h"
 
-/* Share contains all routines needed for the ipc between monmuxes */
+/* Share contains all routines needed for the ipc between symuxes */
 #define SEM_WAIT     0              /* wait semaphore */
 #define SEM_READ     1              /* have read semaphore */
 #define SEM_TOTAL    2
@@ -64,4 +64,4 @@ void  shared_setlen(long);
 void  spawn_client(int);
 __END_DECLS
 
-#endif /*_MONMUX_SHARE_H*/
+#endif /*_SYMUX_SHARE_H*/

+ 33 - 33
mon/monmux/monmux.8 → symon/symux/symux.8

@@ -28,24 +28,24 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\" 
 .Dd April 5, 2002
-.Dt MONMUX 8
+.Dt SYMUX 8
 .Os
 .Sh NAME
-.Nm monmux
-.Nd mon stream multiplexer
+.Nm symux
+.Nd symon stream multiplexer
 .Sh SYNOPSIS
 .Nm 
 .Op Fl vd
 .Op Fl f Ar filename
 .Pp
 .Sh DESCRIPTION
-.Xr mon 8
+.Xr symon 8
 is a lightweight system monitor that measures cpu, memory, interface and disk
 statistics every 5 seconds. This information is then spooled to
 .Nm
 for further processing. 
 .Pp
-.Xr mon 8
+.Xr symon 8
 has been designed to inflict minimal performance and security impact on the
 system it monitors.
 .Nm
@@ -53,14 +53,14 @@ has performance impact proportional to the amount of streams it needs to
 manage. Ideally 
 .Nm 
 should live on a different system and collect data from several
-.Xr mon 8
+.Xr symon 8
 instances in a LAN.
 .Nm 
 stores the incoming streams in .rrd files and distributes the information to
 connected listeners. Listeners can connect to
 .Nm
 on a tcp port and receive incoming 
-.Xr mon 8
+.Xr symon 8
 transmissions decoded into ascii.
 .Lp
 .Nm
@@ -79,11 +79,11 @@ from becoming a daemon and show debug information on stdout.
 Read configuration from 
 .Ar filename
 instead of 
-.Pa /etc/monmux.conf .
+.Pa /etc/symux.conf .
 .Sh CONFIGURATION
 .Nm
 obtains configuration data from 
-.Pa /etc/monmux.conf .
+.Pa /etc/symux.conf .
 The configuration file contains one mux stanza that defines on what interface and port
 .Nm 
 should listen to for incoming monitored data. There is a source section for
@@ -110,15 +110,15 @@ Note that
 in the 
 .Va mux-stmt
 specifies the port-number for both the udp port (incoming 
-.Xr mon 8
+.Xr symon 8
 traffic) and the tcp port for incoming listeners.
 
 .Sh EXAMPLE
 Here is an example 
-.Ar monmux.conf
+.Ar symux.conf
 that listens to udp port 2100 on lo0, and accepts cpu, memory, pf, interfaces
 xl0/de0/lo0/wi0, disks wd[0-3]/cd[0-1] streams from a
-.Xr mon 8
+.Xr symon 8
 on localhost. 
 .Nm
 will also listen on tcp port 2100 for incoming listeners.
@@ -132,32 +132,32 @@ source 127.0.0.1 {
              io(wd0), io(wd1), io(wd2), 
              io(wd3), io(cd0), io(cd1) }
 
-    write cpu(0)   in "/export/mon/localhost/cpu0.rrd"
-    write mem      in "/export/mon/localhost/mem.rrd"
-    write pf       in "/export/mon/localhost/pf.rrd"
+    write cpu(0)   in "/export/symon/localhost/cpu0.rrd"
+    write mem      in "/export/symon/localhost/mem.rrd"
+    write pf       in "/export/symon/localhost/pf.rrd"
 
-    write if(xl0)  in "/export/mon/localhost/if_xl0.rrd"
-    write if(de0)  in "/export/mon/localhost/if_de0.rrd"
-    write if(lo0)  in "/export/mon/localhost/if_lo0.rrd"
-    write if(wi0)  in "/export/mon/localhost/if_wi0.rrd"
+    write if(xl0)  in "/export/symon/localhost/if_xl0.rrd"
+    write if(de0)  in "/export/symon/localhost/if_de0.rrd"
+    write if(lo0)  in "/export/symon/localhost/if_lo0.rrd"
+    write if(wi0)  in "/export/symon/localhost/if_wi0.rrd"
 
-    write io(wd0)  in "/export/mon/localhost/io_wd0.rrd"
-    write io(wd1)  in "/export/mon/localhost/io_wd1.rrd"
-    write io(wd2)  in "/export/mon/localhost/io_wd2.rrd"
-    write io(wd3)  in "/export/mon/localhost/io_wd3.rrd"
+    write io(wd0)  in "/export/symon/localhost/io_wd0.rrd"
+    write io(wd1)  in "/export/symon/localhost/io_wd1.rrd"
+    write io(wd2)  in "/export/symon/localhost/io_wd2.rrd"
+    write io(wd3)  in "/export/symon/localhost/io_wd3.rrd"
 
-    write io(cd0)  in "/export/mon/localhost/io_cd0.rrd"
-    write io(cd1)  in "/export/mon/localhost/io_cd1.rrd"
+    write io(cd0)  in "/export/symon/localhost/io_cd0.rrd"
+    write io(cd1)  in "/export/symon/localhost/io_cd1.rrd"
 }
 .fi
 .Sh LISTENERS
 .Nm
 offers received 
-.Xr mon 8 
+.Xr symon 8 
 data to other programs via tcp. An example of a listener session:
 .Pp
 .nf
-hoard:~/project/mon$ telnet 127.0.0.1 2100
+hoard:~/project/symon$ telnet 127.0.0.1 2100
 Trying 127.0.0.1...
 Connected to 127.0.0.1.
 Escape character is '^]'.
@@ -179,9 +179,9 @@ Connection closed.
 .fi
 .Lp
 The format is 
-.Va mon-version
+.Va symon-version
 :
-.Va mon-host-ip
+.Va symon-host-ip
 :
 .Va io|if|cpu|mem|pf
 :
@@ -222,7 +222,7 @@ counters_fragment : counters_short : counters_normalize : counters_memory
 Causes
 .Nm
 to read 
-.Pa /etc/monmux.conf 
+.Pa /etc/symux.conf 
 or the file specified by the 
 .Fl f 
 flag.
@@ -232,11 +232,11 @@ configuration file.
 .El
 .Sh FILES
 .Bl -tag -width Ds
-.It Pa /var/run/monmux.pid
+.It Pa /var/run/symux.pid
 Contains the program id of the
 .Nm
 daemon.
-.It Pa /etc/monmux.conf
+.It Pa /etc/symux.conf
 .Nm
 system wide configuration file. 
 .El
@@ -253,4 +253,4 @@ will be unresponsive during this process.
 Willem Dijkstra <wpd@xs4all.nl>. Daniel Hartmeier <daniel@benzedrine.cx>
 contributed the pf probe and helped to port to big-endian architectures.
 .Sh SEE ALSO
-.Xr mon 8 
+.Xr symon 8 

+ 16 - 16
mon/monmux/monmux.c → symon/symux/symux.c

@@ -1,4 +1,4 @@
-/* $Id: monmux.c,v 1.21 2002/09/02 06:17:37 dijkstra Exp $ */
+/* $Id: symux.c,v 1.22 2002/09/14 15:54:56 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -47,8 +47,8 @@
 #include "data.h"
 #include "error.h"
 #include "limits.h"
-#include "monmux.h"
-#include "muxnet.h"
+#include "symux.h"
+#include "symuxnet.h"
 #include "net.h"
 #include "readconf.h"
 #include "share.h"
@@ -75,9 +75,9 @@ huphandler(int s) {
     flag_hup = 1;
 }
 /* 
- * Monmux is the receiver of mon performance measurements.
+ * symux is the receiver of symon performance measurements.
  *
- * The main goals mon hopes to accomplish is:
+ * The main goals symon hopes to accomplish is:
  * - to take fine grained measurements of system parameters 
  * - with minimal performance impact 
  * - in a secure way.
@@ -85,15 +85,15 @@ huphandler(int s) {
  * 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 mon provides is done by a second program, called monmux.
+ * information that symon provides is done by a second program, called symux.
  * 
- * Mon can keep track of cpu, memory, disk and network interface
- * interactions. Mon was built specifically for OpenBSD.
+ * Symon can keep track of cpu, memory, disk and network interface
+ * interactions. Symon was built specifically for OpenBSD.
  */
 int 
 main(int argc, char *argv[])
 {
-    struct monpacket packet;
+    struct symonpacket packet;
     struct packedstream ps;
     char *cfgfile;
     char *cfgpath;
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
     flag_debug = 0;
     flag_daemon = 0;
     
-    cfgfile = MONMUX_CONFIG_FILE;
+    cfgfile = SYMUX_CONFIG_FILE;
     while ((ch = getopt(argc, argv, "dvf:")) != -1) {
 	switch (ch) {
 	case 'd':
@@ -146,7 +146,7 @@ main(int argc, char *argv[])
 
 	    break;
 	case 'v':
-	    info("monmux version %s", MONMUX_VERSION);
+	    info("symux version %s", SYMUX_VERSION);
 	default:
 	    info("usage: %s [-d] [-v] [-f cfgfile]", __progname);
 	    exit(EX_USAGE);
@@ -160,14 +160,14 @@ main(int argc, char *argv[])
 	flag_daemon = 1;
 
 	/* record pid */
-	f = fopen(MONMUX_PID_FILE, "w");
+	f = fopen(SYMUX_PID_FILE, "w");
 	if (f) {
 	    fprintf(f, "%u\n", (u_int) getpid());
 	    fclose(f);
 	}
     } 
     
-    info("monmux version %s", MONMUX_VERSION);
+    info("symux version %s", SYMUX_VERSION);
 
     /* parse configuration file */
     if (!read_config_file(&mul, &sol, cfgfile))
@@ -193,7 +193,7 @@ main(int argc, char *argv[])
     /* Prepare crc32 */
     init_crc32();
 
-    getmonsocket(mux);
+    getsymonsocket(mux);
     getclientsocket(mux);
 
     for (;;) {
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
 		mul = newmul;
 		sol = newsol;
 		mux = SLIST_FIRST(&mul);
-		getmonsocket(mux);
+		getsymonsocket(mux);
 		getclientsocket(mux);
 	    }
 	    break; /* wait for next alarm */
@@ -273,7 +273,7 @@ main(int argc, char *argv[])
 		    arg_ra[1] = "--";
 		    arg_ra[2] = stream->file;
 		    
-		    /* This call will cost a lot (monmux will become
+		    /* This call will cost a lot (symux will become
 		     * unresponsive and eat up massive amounts of cpu) if
 		     * the rrdfile is out of sync. While I could update the
 		     * rrd in a separate process, I choose not to at this

+ 62 - 0
symon/symux/symux.conf

@@ -0,0 +1,62 @@
+#
+# $Id: symux.conf,v 1.17 2002/09/14 15:54:56 dijkstra Exp $
+#
+# Initial symux.conf demonstrates how I configure symux.
+
+#
+# hub <hubname> defines the destination of all monitored data described in this
+# configuration file.
+#
+# note that symux listens for incoming symon traffic on udp 2100 and incoming
+# client connections on tcp 2100
+#
+
+mux 10.0.0.1:2100
+
+#
+# source <hostname> defines a source of monitored data. 
+#
+source 10.0.0.1 {
+
+	# All accepted formats have to be defined explicitly. 
+	#
+	# cpu(x) - gather stats for cpu nr. x
+	# mem    - gather memory stats
+	# if(x)  - gather io stats for interface x
+	# io(x)  - gather io stats for disk x.
+
+	accept { cpu(0), mem, if(xl0), if(de0),
+	         if(lo0), io(wd0), io(wd1), 
+                 io(wd2), io(wd3), io(cd0)}
+	
+	# Define where data should be put
+	#
+	# Accepted sources that are not written out will be 
+	# discarded.
+
+	write cpu(0)   in "/export/symon/www/cpu0.rrd"
+	write mem      in "/export/symon/www/mem.rrd"
+
+	write if(xl0)  in "/export/symon/www/if_xl0.rrd"
+	write if(de0)  in "/export/symon/www/if_de0.rrd"
+	write if(lo0)  in "/export/symon/www/if_lo0.rrd"
+	
+	write io(wd0)  in "/export/symon/www/io_wd0.rrd"
+	write io(wd1)  in "/export/symon/www/io_wd1.rrd"
+	write io(wd2)  in "/export/symon/www/io_wd2.rrd"
+	write io(wd3)  in "/export/symon/www/io_wd3.rrd"
+
+	write io(cd0)  in "/export/symon/www/io_cd0.rrd"
+}
+source 10.0.0.2 {
+	accept { cpu(0), mem, if(sis0), if(sis1),
+		 if(lo0), if(wi0), io(wd0) }
+
+	write cpu(0)   in "/export/symon/4512/cpu0.rrd"
+	write mem      in "/export/symon/4512/mem.rrd"
+	write if(sis0) in "/export/symon/4512/if_sis0.rrd"
+	write if(sis1) in "/export/symon/4512/if_sis1.rrd"
+	write if(lo0)  in "/export/symon/4512/if_lo0.rrd"
+	write if(wi0)  in "/export/symon/4512/if_wi0.rrd"
+	write io(wd0)  in "/export/symon/4512/io_wd0.rrd"
+}

+ 9 - 9
mon/monmux/monmux.h → symon/symux/symux.h

@@ -1,4 +1,4 @@
-/* $Id: monmux.h,v 1.11 2002/08/31 16:09:55 dijkstra Exp $ */
+/* $Id: symux.h,v 1.13 2002/09/14 15:54:56 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -30,19 +30,19 @@
  *
  */
 
-#ifndef _MONMUX_MONMUX_H
-#define _MONMUX_MONMUX_H
+#ifndef _SYMUX_SYMUX_H
+#define _SYMUX_SYMUX_H
 
-#define MONMUX_CONFIG_FILE "/etc/monmux.conf"
-#define MONMUX_PID_FILE "/var/run/monmux.pid"
-#define MONMUX_VERSION "2.3"
+#define SYMUX_CONFIG_FILE "/etc/symux.conf"
+#define SYMUX_PID_FILE "/var/run/symux.pid"
+#define SYMUX_VERSION "2.5"
 
 /* Amount of connections allowed in listen backlog 
  * - note that more than 128 makes no sense in OpenBSD
  */
-#define MONMUX_TCPBACKLOG 5
+#define SYMUX_TCPBACKLOG 5
 
 /* Number of retries allowed in recvfrom */
-#define MONMUX_MAXREADTRIES 5
+#define SYMUX_MAXREADTRIES 5
 
-#endif /*_MONMUX_MONMUX_H*/
+#endif /*_SYMUX_SYMUX_H*/

+ 24 - 24
mon/monmux/muxnet.c → symon/symux/symuxnet.c

@@ -1,4 +1,4 @@
-/* $Id: muxnet.c,v 1.9 2002/09/02 06:17:37 dijkstra Exp $ */
+/* $Id: symuxnet.c,v 1.10 2002/09/14 15:54:56 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -41,15 +41,15 @@
 
 #include "data.h"
 #include "error.h"
-#include "monmux.h"
-#include "muxnet.h"
+#include "symux.h"
+#include "symuxnet.h"
 #include "net.h"
 #include "xmalloc.h"
 #include "share.h"
 
-/* Obtain a udp socket for incoming mon traffic */
+/* Obtain a udp socket for incoming symon traffic */
 int 
-getmonsocket(struct mux *mux) 
+getsymonsocket(struct mux *mux) 
 {
     struct sockaddr_in sockaddr;
     int sock;
@@ -66,9 +66,9 @@ getmonsocket(struct mux *mux)
 	     sizeof(struct sockaddr)) == -1)
 	fatal("could not bind socket: %.200s", strerror(errno));
 
-    mux->monsocket = sock;
+    mux->symonsocket = sock;
 
-    info("listening for incoming mon traffic on udp:%s:%d", 
+    info("listening for incoming symon traffic on udp:%s:%d", 
 	 mux->name, mux->port);
 
     return sock;
@@ -92,7 +92,7 @@ getclientsocket(struct mux *mux)
 	     sizeof(struct sockaddr)) == -1)
 	fatal("could not bind socket: %.200s", strerror(errno));
 
-    if (listen(sock, MONMUX_TCPBACKLOG) == -1)
+    if (listen(sock, SYMUX_TCPBACKLOG) == -1)
       fatal("could not listen to socket: %.200s", strerror(errno));
 
     fcntl(sock, O_NONBLOCK);
@@ -104,27 +104,27 @@ getclientsocket(struct mux *mux)
     return sock;
 }
 /*
- * Wait for traffic (mon reports from a source in sourclist | clients trying to connect
+ * Wait for traffic (symon reports from a source in sourclist | clients trying to connect
  * Returns the <source> and <packet>
  * Silently forks off clienthandlers
  */
 void
 waitfortraffic(struct mux *mux, struct sourcelist *sourcelist, 
-	       struct source **source, struct monpacket *packet) 
+	       struct source **source, struct symonpacket *packet) 
 {
     fd_set readset;
     int socksactive;
     int maxsock;
 
-    maxsock = ((mux->clientsocket > mux->monsocket) ?
+    maxsock = ((mux->clientsocket > mux->symonsocket) ?
 	       mux->clientsocket :
-	       mux->monsocket);
+	       mux->symonsocket);
     maxsock++;
 
-    for (;;) { /* FOREVER - until a valid mon packet is received */
+    for (;;) { /* FOREVER - until a valid symon packet is received */
 	FD_ZERO(&readset);
 	FD_SET(mux->clientsocket, &readset);
-	FD_SET(mux->monsocket, &readset);
+	FD_SET(mux->symonsocket, &readset);
 	
 	socksactive = select(maxsock, &readset, NULL, NULL, NULL);
 	
@@ -133,8 +133,8 @@ waitfortraffic(struct mux *mux, struct sourcelist *sourcelist,
 		spawn_client(mux->clientsocket);
 	    }
 
-	    if (FD_ISSET(mux->monsocket, &readset)) {
-		if (recvmonpacket(mux, sourcelist, source, packet))
+	    if (FD_ISSET(mux->symonsocket, &readset)) {
+		if (recvsymonpacket(mux, sourcelist, source, packet))
 		    return;
 	    }
 	} else {
@@ -143,12 +143,12 @@ waitfortraffic(struct mux *mux, struct sourcelist *sourcelist,
 	}
     }
 }
-/* Receive a mon packet for mux. Checks if the source is allowed and returns the source found.
+/* Receive a symon packet for mux. Checks if the source is allowed and returns the source found.
  * return 0 if no valid packet found 
  */
 int
-recvmonpacket(struct mux *mux, struct sourcelist *sourcelist, 
-	      struct source **source, struct monpacket *packet) 
+recvsymonpacket(struct mux *mux, struct sourcelist *sourcelist, 
+	      struct source **source, struct symonpacket *packet) 
 
 {
     struct sockaddr_in sind;
@@ -164,8 +164,8 @@ recvmonpacket(struct mux *mux, struct sourcelist *sourcelist,
     do {
 	sl = sizeof(sind);
 
-	size = recvfrom(mux->monsocket, (void *)packet->data + received, 
-			sizeof(struct monpacket) - received, 
+	size = recvfrom(mux->symonsocket, (void *)packet->data + received, 
+			sizeof(struct symonpacket) - received, 
 			0, (struct sockaddr *)&sind, &sl);
 	if (size > 0)
 	  received += size;
@@ -173,7 +173,7 @@ recvmonpacket(struct mux *mux, struct sourcelist *sourcelist,
 	tries++;
     } while ((size == -1) && 
 	     (errno == EAGAIN || errno == EINTR) && 
-	     (tries < MONMUX_MAXREADTRIES) &&
+	     (tries < SYMUX_MAXREADTRIES) &&
 	     (received < sizeof(packet->data)));
 
     if ((size == -1) && 
@@ -201,9 +201,9 @@ recvmonpacket(struct mux *mux, struct sourcelist *sourcelist,
 	    return 0;
 	}
 	/* check packet version */
-	if (packet->header.mon_version != MON_PACKET_VER) {
+	if (packet->header.symon_version != SYMON_PACKET_VER) {
 	    warning("ignored packet with wrong version %d", 
-		    packet->header.mon_version);
+		    packet->header.symon_version);
 	    return 0;
 	} else {
 	    if (flag_debug) 

+ 9 - 9
mon/monmux/muxnet.h → symon/symux/symuxnet.h

@@ -1,4 +1,4 @@
-/* $Id: muxnet.h,v 1.5 2002/09/02 06:17:24 dijkstra Exp $ */
+/* $Id: symuxnet.h,v 1.6 2002/09/14 15:54:56 dijkstra Exp $ */
 
 /*
  * Copyright (c) 2001-2002 Willem Dijkstra
@@ -30,21 +30,21 @@
  *
  */
 
-#ifndef _MONMUX_MUXNET_H
-#define _MONMUX_MUXNET_H
+#ifndef _SYMUX_SYMUXNET_H
+#define _SYMUX_SYMUXNET_H
 
 #include "data.h"
 
 /* prototypes */
 __BEGIN_DECLS
 int  acceptconnection(int);
-int  getmonsocket(struct mux *);
+int  getsymonsocket(struct mux *);
 int  getclientsocket(struct mux *);
 void waitfortraffic(struct mux *, struct sourcelist *, 
-		    struct source **, struct monpacket *);
-int  recvmonpacket(struct mux *, struct sourcelist *, 
-		   struct source **, struct monpacket *);
-int  check_crc_packet(struct monpacket *);
+		    struct source **, struct symonpacket *);
+int  recvsymonpacket(struct mux *, struct sourcelist *, 
+		   struct source **, struct symonpacket *);
+int  check_crc_packet(struct symonpacket *);
 __END_DECLS
-#endif /*_MONMUX_MUXNET_H*/
+#endif /*_SYMUX_SYMUXNET_H*/