1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

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>
This commit is contained in:
Pav Lucistnik 2005-03-16 20:39:33 +00:00
parent 72038367f7
commit 7eb5b4f04c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=131424
10 changed files with 214 additions and 0 deletions

View File

@ -442,6 +442,7 @@
SUBDIR += stress
SUBDIR += su2
SUBDIR += symlinks
SUBDIR += symon
SUBDIR += synergy
SUBDIR += syslog-ng
SUBDIR += system-tools-backends

40
sysutils/symon/Makefile Normal file
View File

@ -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>

View File

@ -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

View File

@ -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));
}

View File

@ -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}

View File

@ -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}

16
sysutils/symon/pkg-descr Normal file
View File

@ -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

View File

@ -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

View File

@ -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

13
sysutils/symon/pkg-plist Normal file
View File

@ -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."