On 2010/10/15 14:01, Anton Maksimenkov wrote: > 2010/10/14 Anton Maksimenkov <anton...@gmail.com>: > > I used symon on my servers (4.5, 4.7, current) and one symux. symux > > runs on -current. > > As you can see, there is "io" from core (4.7), but no "io" from db1 > > (current) and no "io" from mx (current, running symux). > > This is a simple patch which resolves my problem:
The problem is that disknames retrieved by the sysctl now have the uid appended e.g. hw.disknames=sd0:cf1d79bc88d7c156,wd0:184e5f9e9ce4af89 For systems where a uid hasn't been created they are like this: hw.disknames=sd0: hw.disknames=wd0: hw.disknames=sd0:,sd1:,sd2: [...] Two methods to handle this come to mine, we could simply skip a : and any text up to the next "," or terminating NUL, alternatively we could add uid support without too much trouble, the diff below does this and makes a few porting changes: - new-style wantlib/lib_depends - don't use pseudo package names in DESCR, they don't handle port revision number, it's simpler to use the base names - don't strip the binary when building the port with DEBUG set I have tested wd0: and wd0:uid formats, I think it will correctly handle older versions of OpenBSD without uid support but I have not tested that. Any comments/ok? Index: patches/patch-platform_OpenBSD_sm_io_c =================================================================== RCS file: patches/patch-platform_OpenBSD_sm_io_c diff -N patches/patch-platform_OpenBSD_sm_io_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-platform_OpenBSD_sm_io_c 18 Oct 2010 16:27:14 -0000 @@ -0,0 +1,45 @@ +$OpenBSD$ +--- platform/OpenBSD/sm_io.c.orig Sun Jun 28 19:40:29 2009 ++++ platform/OpenBSD/sm_io.c Mon Oct 18 17:22:14 2010 +@@ -51,6 +51,7 @@ + static char *io_dkstr = NULL; + static struct diskstats *io_dkstats = NULL; + static char **io_dknames = NULL; ++static char **io_dkuids = NULL; + static int io_dks = 0; + static int io_maxdks = 0; + static size_t io_maxstr = 0; +@@ -98,6 +99,7 @@ gets_io() + + io_dkstats = xrealloc(io_dkstats, io_maxdks * sizeof(struct diskstats)); + io_dknames = xrealloc(io_dknames, io_maxdks * sizeof(char *)); ++ io_dkuids = xrealloc(io_dkuids, io_maxdks * sizeof(char *)); + io_dkstr = xrealloc(io_dkstr, io_maxstr + 1); + } + +@@ -128,7 +130,13 @@ gets_io() + *p = '\0'; + io_dks++; p++; + io_dknames[io_dks] = p; ++ io_dkuids[io_dks] = NULL; + } ++ if ((*p == ':') && (*p+1 != '\0')) { ++ *p = '\0'; ++ p++; ++ io_dkuids[io_dks] = p; ++ } + p++; + } + } +@@ -146,8 +154,10 @@ get_io(char *symon_buf, int maxlen, struct stream *st) + + /* look for disk */ + for (i = 0; i <= io_dks; i++) { +- if (strncmp(io_dknames[i], st->arg, ++ if ((strncmp(io_dknames[i], st->arg, + (io_dkstr + io_maxstr - io_dknames[i])) == 0) ++ || (io_dkuids[i] && (strncmp(io_dkuids[i], st->arg, ++ (io_dkstr + io_maxstr - io_dkuids[i])) == 0))) + #ifdef HAS_IO2 + return snpack(symon_buf, maxlen, st->arg, MT_IO2, + io_dkstats[i].ds_rxfer, Index: Makefile =================================================================== RCS file: /cvs/ports/sysutils/symon/Makefile,v retrieving revision 1.40 diff -u -p -r1.40 Makefile --- Makefile 15 Jun 2010 10:47:08 -0000 1.40 +++ Makefile 18 Oct 2010 16:12:19 -0000 @@ -2,6 +2,7 @@ COMMENT-main= active monitoring tool V= 2.82 +REVISION= 0 DISTNAME= symon-${V} PKGNAME-main= ${DISTNAME} FULLPKGNAME-mon= symon-mon-${V} @@ -16,30 +17,30 @@ PERMIT_PACKAGE_CDROM= Yes PERMIT_PACKAGE_FTP= Yes PERMIT_DISTFILES_CDROM= Yes PERMIT_DISTFILES_FTP= Yes -WANTLIB= c + +WANTLIB= c fontconfig rrd +LIB_DEPENDS= ::net/rrdtool MASTER_SITES= ${HOMEPAGE}/philes/ MULTI_PACKAGES= -main -mon -mux -WANTLIB-main= ${WANTLIB} fontconfig - # client only package COMMENT-mon= active host monitor +WANTLIB-mon= c LIB_DEPENDS-mon= + # gatherer only package COMMENT-mux= symon data gatherer -LIB_DEPENDS-mux= rrd:rrdtool-*:net/rrdtool -WANTLIB-mux= ${WANTLIB} fontconfig - -LIB_DEPENDS= rrd:rrdtool-*:net/rrdtool USE_X11= Yes NO_REGRESS= Yes WRKDIST= ${WRKDIR}/symon -SUBST_VARS= V - MAKE_ENV= LIBS="-L${X11BASE}/lib" MANDIR="man" +.ifdef DEBUG +# avoid stripping the binaries +MAKE_ENV+= DEBUG=1 +.endif .include <bsd.port.mk> Index: patches/patch-Makefile_inc =================================================================== RCS file: patches/patch-Makefile_inc diff -N patches/patch-Makefile_inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Makefile_inc 18 Oct 2010 16:12:19 -0000 @@ -0,0 +1,15 @@ +$OpenBSD$ +--- Makefile.inc.orig Mon Oct 18 15:33:00 2010 ++++ Makefile.inc Mon Oct 18 15:33:01 2010 +@@ -2,11 +2,7 @@ V=2.82 + + AR?= ar + CC?= cc +-.ifdef DEBUG +-CFLAGS=-g -Wall +-.else + CFLAGS+=-Wall +-.endif + INSTALL?=install + LORDER?=lorder + TSORT?=tsort Index: pkg/DESCR-main =================================================================== RCS file: /cvs/ports/sysutils/symon/pkg/DESCR-main,v retrieving revision 1.2 diff -u -p -r1.2 DESCR-main --- pkg/DESCR-main 15 Apr 2010 14:29:16 -0000 1.2 +++ pkg/DESCR-main 18 Oct 2010 16:12:19 -0000 @@ -3,6 +3,6 @@ interface and disk statistics every 5 se then spooled over "the network" to symux for further processing. The port will yield 3 packages: -symon-mon-${V}.tgz : symon daemon and manual. -symon-mux-${V}.tgz : symux daemon, manual and rrd creation script. -symon-${V}.tgz : all of the above rolled into a single package +symon-mon: symon daemon and manual. +symon-mux: symux daemon, manual and rrd creation script. +symon: all of the above rolled into a single package.