summaryrefslogtreecommitdiff
path: root/sysutils/symon
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2005-03-16 20:39:33 +0000
committerPav Lucistnik <pav@FreeBSD.org>2005-03-16 20:39:33 +0000
commit7eb5b4f04c1daab724298ecccfa13ea141465107 (patch)
tree05248a2b4519e5e68533f14fdd7beaee6422a709 /sysutils/symon
parentUpdate to 1.5. (diff)
symon is a is a lightweight system monitor that measures cpu, memory, pf,
interface and disk statistics every 5 seconds. It sends this data on to symux for further processing. symon has been designed to inflict minimal performance and security impact -- it can be run as nobody on the system it monitors. symux is a non-priviledged daemon that listens to incoming symon traffic. symux can write the incoming symon streams into rrd files. Clients interested in monitoring machine state can also log into symux and receive data as ascii as it arrives. symon2web is a php script that can show the data stored in the rrd files. PR: ports/78416 Submitted by: Ulrich Spoerlein <q@uni.de>
Notes
Notes: svn path=/head/; revision=131424
Diffstat (limited to 'sysutils/symon')
-rw-r--r--sysutils/symon/Makefile40
-rw-r--r--sysutils/symon/files/patch-conf.sh59
-rw-r--r--sysutils/symon/files/patch-sm_proc.c18
-rw-r--r--sysutils/symon/files/patch-symon-Makefile14
-rw-r--r--sysutils/symon/files/patch-symux-Makefile14
-rw-r--r--sysutils/symon/pkg-descr16
-rw-r--r--sysutils/symon/pkg-install24
-rw-r--r--sysutils/symon/pkg-message15
-rw-r--r--sysutils/symon/pkg-plist13
9 files changed, 213 insertions, 0 deletions
diff --git a/sysutils/symon/Makefile b/sysutils/symon/Makefile
new file mode 100644
index 000000000000..e4e2805952bc
--- /dev/null
+++ b/sysutils/symon/Makefile
@@ -0,0 +1,40 @@
+# New ports collection makefile for: sysutils/symon
+# Date created: 17.02.2005
+# Whom: Ulrich Spoerlein <q@uni.de>
+#
+# $FreeBSD$
+#
+
+PORTNAME= symon
+PORTVERSION= 2.70
+CATEGORIES= sysutils
+MASTER_SITES= http://www.xs4all.nl/~wpd/symon/philes/
+
+MAINTAINER= q@uni.de
+COMMENT= Performance and information monitoring tool
+
+LIB_DEPENDS= rrd.0:${PORTSDIR}/net/rrdtool
+
+WRKSRC= ${WRKDIR}/${PORTNAME}
+MAKE_ARGS+= SYSCONFDIR=${LOCALBASE}/etc BINDIR=bin
+PKGMESSAGE= ${WRKDIR}/.pkg-message
+
+MAN8= symon.8 symux.8
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+post-patch:
+ @${ECHO} "" > ${WRKSRC}/platform/FreeBSD/Makefile.inc
+.endif
+
+post-build:
+ @${SED} 's,%%LOCALBASE%%,${LOCALBASE},g' pkg-message > ${PKGMESSAGE}
+
+pre-install:
+ @${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
+
+post-install:
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/symon/files/patch-conf.sh b/sysutils/symon/files/patch-conf.sh
new file mode 100644
index 000000000000..0ead1aab4196
--- /dev/null
+++ b/sysutils/symon/files/patch-conf.sh
@@ -0,0 +1,59 @@
+--- platform/FreeBSD/conf.sh.orig Thu Mar 10 09:34:37 2005
++++ platform/FreeBSD/conf.sh Thu Mar 10 09:35:24 2005
+@@ -1,25 +1,34 @@
+-case `grep -cq "m_drops" /usr/include/sys/mbuf.h` in
+-1) echo "#define HAS_MBUF_MDROPS 1" ;;
+-0) echo "#undef HAS_MBUF_MDROPS" ;;
+-esac;
+-case `grep -cq "sf_allocfail" /usr/include/sys/mbuf.h` in
+-1) echo "#define HAS_MBUF_SFALLOCFAIL 1" ;;
+-0) echo "#undef HAS_MBUF_SFALLOCFAIL" ;;
+-esac;
+-case `grep -cq "VM_TOTAL" /usr/include/vm/vm_param.h` in
+-0) echo "#define VM_TOTAL VM_METER" ;;
+-esac;
+-sysctl -N vm.nswapdev 1>/dev/null 2>&1
+-case $? in
+-1) echo "#undef HAS_VM_NSWAPDEV" ;;
+-0) echo "#define HAS_VM_NSWAPDEV 1" ;;
+-esac;
++#!/bin/sh
++if grep -q "m_drops" /usr/include/sys/mbuf.h; then
++ echo "#define HAS_MBUF_MDROPS 1"
++else
++ echo "#undef HAS_MBUF_MDROPS"
++fi
++if grep -q "sf_allocfail" /usr/include/sys/mbuf.h; then
++ echo "#define HAS_MBUF_SFALLOCFAIL 1"
++else
++ echo "#undef HAS_MBUF_SFALLOCFAIL"
++fi
++if ! grep -q "VM_TOTAL" /usr/include/vm/vm_param.h; then
++ echo "#define VM_TOTAL VM_METER"
++fi
++if grep -q "struct xswdev" /usr/include/vm/vm_param.h; then
++ echo "#define HAS_VM_NSWAPDEV 1"
++else
++ echo "#undef HAS_VM_NSWAPDEV"
++fi
+ if [ -f /usr/include/net/pfvar.h ]; then
+ echo "#define HAS_PFVAR_H 1"
+ else
+ echo "#undef HAS_PFVAR_H"
+-fi;
+-case `grep -cq "ki_paddr" /usr/include/sys/user.h` in
+-1) echo "#define HAS_KI_PADDR 1" ;;
+-0) echo "#undef HAS_KI_PADDR" ;;
+-esac;
+\ No newline at end of file
++fi
++if grep -q "ki_paddr" /usr/include/sys/user.h; then
++ echo "#define HAS_KI_PADDR 1"
++else
++ echo "#undef HAS_KI_PADDR"
++fi
++if grep -q "struct rusage_ext" /usr/include/sys/proc.h; then
++ echo "#define HAS_RUSAGE_EXT 1"
++else
++ echo "#undef HAS_RUSAGE_EXT"
++fi
diff --git a/sysutils/symon/files/patch-sm_proc.c b/sysutils/symon/files/patch-sm_proc.c
new file mode 100644
index 000000000000..83d12e8132da
--- /dev/null
+++ b/sysutils/symon/files/patch-sm_proc.c
@@ -0,0 +1,18 @@
+--- platform/FreeBSD/sm_proc.c.orig Thu Mar 10 09:29:00 2005
++++ platform/FreeBSD/sm_proc.c Thu Mar 10 09:27:52 2005
+@@ -181,9 +181,15 @@
+ if (proc_kd) {
+ if (kvm_read(proc_kd, (unsigned long)pp->ki_paddr, &pproc,
+ sizeof(pproc)) == sizeof(pproc)) {
++#ifdef HAS_RUSAGE_EXT
++ cpu_uticks += pproc.p_rux.p_uticks; /* user */
++ cpu_sticks += pproc.p_rux.p_sticks; /* sys */
++ cpu_iticks += pproc.p_rux.p_iticks; /* int */
++#else
+ cpu_uticks += pproc.p_uticks; /* user */
+ cpu_sticks += pproc.p_sticks; /* sys */
+ cpu_iticks += pproc.p_iticks; /* int */
++#endif
+ } else {
+ warning("while reading kvm: %s", kvm_geterr(proc_kd));
+ }
diff --git a/sysutils/symon/files/patch-symon-Makefile b/sysutils/symon/files/patch-symon-Makefile
new file mode 100644
index 000000000000..07904dceb65f
--- /dev/null
+++ b/sysutils/symon/files/patch-symon-Makefile
@@ -0,0 +1,14 @@
+--- symon/Makefile.orig Fri Mar 4 10:39:20 2005
++++ symon/Makefile Fri Mar 4 10:43:13 2005
+@@ -26,9 +26,9 @@
+ clean:
+ rm -f conf.h symon symon.cat8 symon.core ${OBJS}
+
+-install: symon symon.cat8 symon.conf
++install: symon symon.8 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} -c -m 444 -g wheel -o root symon.8 ${PREFIX}/${MANDIR}/man8/symon.8
+ ${INSTALL} -d -m 555 -g bin -o root ${PREFIX}/${SHRDIR}
+ ${INSTALL} -c -m 555 -g wheel -o root c_config.sh ${PREFIX}/${SHRDIR}
+ ${INSTALL} -d -m 555 -g bin -o root ${PREFIX}/${EXADIR}
diff --git a/sysutils/symon/files/patch-symux-Makefile b/sysutils/symon/files/patch-symux-Makefile
new file mode 100644
index 000000000000..34b06a396c4d
--- /dev/null
+++ b/sysutils/symon/files/patch-symux-Makefile
@@ -0,0 +1,14 @@
+--- symux/Makefile.orig Fri Mar 4 10:43:43 2005
++++ symux/Makefile Fri Mar 4 10:44:01 2005
+@@ -17,9 +17,9 @@
+ clean:
+ rm -f conf.h symux symux.cat8 symux.core ${OBJS}
+
+-install: symux symux.cat8 c_smrrds.sh symux.conf
++install: symux symux.8 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} -c -m 444 -g wheel -o root symux.8 ${PREFIX}/${MANDIR}/man8/symux.8
+ ${INSTALL} -d -m 555 -g bin -o root ${PREFIX}/${SHRDIR}
+ ${INSTALL} -c -m 544 -g bin -o root c_smrrds.sh ${PREFIX}/${SHRDIR}
+ ${INSTALL} -d -m 555 -g bin -o root ${PREFIX}/${EXADIR}
diff --git a/sysutils/symon/pkg-descr b/sysutils/symon/pkg-descr
new file mode 100644
index 000000000000..7ab684932af6
--- /dev/null
+++ b/sysutils/symon/pkg-descr
@@ -0,0 +1,16 @@
+The symon project consists of three parts; a data monitor, a data consolidator
+and a data displayer.
+
+symon is a is a lightweight system monitor that measures cpu, memory, pf,
+interface and disk statistics every 5 seconds. It sends this data on to symux
+for further processing. symon has been designed to inflict minimal performance
+and security impact -- it can be run as nobody on the system it monitors.
+
+symux is a non-priviledged daemon that listens to incoming symon traffic. symux
+can write the incoming symon streams into rrd files. Clients interested in
+monitoring machine state can also log into symux and receive data as ascii as
+it arrives.
+
+symon2web is a php script that can show the data stored in the rrd files.
+
+WWW: http://www.xs4all.nl/~wpd/symon
diff --git a/sysutils/symon/pkg-install b/sysutils/symon/pkg-install
new file mode 100644
index 000000000000..411bce8db330
--- /dev/null
+++ b/sysutils/symon/pkg-install
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+PATH=/bin:/usr/sbin
+
+USER=_symon
+GROUP=daemon
+UID=115
+
+case $2 in
+ PRE-INSTALL)
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ else
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -s /usr/sbin/nologin -L daemon -d /var/empty -c "Symon Account"
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+ ;;
+esac
diff --git a/sysutils/symon/pkg-message b/sysutils/symon/pkg-message
new file mode 100644
index 000000000000..b4501d4026f8
--- /dev/null
+++ b/sysutils/symon/pkg-message
@@ -0,0 +1,15 @@
+For the system monitor symon, use the following steps
+
+ 1. Copy %%LOCALBASE%%/share/examples/symon/symon.conf
+ to %%LOCALBASE%%/etc and edit.
+ 2. Run symon
+
+For the data collector symux, use the following steps
+
+ 1. Copy %%LOCALBASE%%/share/examples/symon/symux.conf
+ to %%LOCALBASE%%/etc and edit.
+ 2. Enter the directory, where symux should store its data
+ (e.g. /var/db/symux) and run
+ %%LOCALBASE%%/share/symon/c_smrrds.sh all
+ to create the RR database.
+ 3. Run symux
diff --git a/sysutils/symon/pkg-plist b/sysutils/symon/pkg-plist
new file mode 100644
index 000000000000..14d0b3a8eee3
--- /dev/null
+++ b/sysutils/symon/pkg-plist
@@ -0,0 +1,13 @@
+bin/symon
+bin/symux
+%%EXAMPLESDIR%%/symon.conf
+%%EXAMPLESDIR%%/symux.conf
+%%DATADIR%%/c_config.sh
+%%DATADIR%%/c_smrrds.sh
+%%DATADIR%%/client/SymuxClient.0
+%%DATADIR%%/client/SymuxClient.pm
+%%DATADIR%%/client/getsymonitem.pl
+@dirrm share/symon/client
+@dirrm %%DATADIR%%
+@dirrm %%EXAMPLESDIR%%
+@unexec echo "Warning: If you will *NOT* use this package anymore, please remove the _symon user manually."