From 44d1498baf4f15ef6798154f661b4653653ae6c4 Mon Sep 17 00:00:00 2001 From: abs Date: Fri, 21 Jul 2006 23:28:37 +0000 Subject: Use PKG_SYSCONFSUBDIR so PKG_SYSCONFBASE can be set Use REPLACE_PERL on all plugins Adjust sensors_ to work with NetBSD 3 Bump PKGREVISION --- sysutils/munin-node/Makefile | 9 +- sysutils/munin-node/distinfo | 5 +- sysutils/munin-node/files/munin-node.sh | 4 +- .../files/node/node.d.netbsd/sensors_.in | 122 +++++++++------------ sysutils/munin-node/patches/patch-aa | 6 +- sysutils/munin-node/patches/patch-ae | 15 +++ 6 files changed, 79 insertions(+), 82 deletions(-) create mode 100644 sysutils/munin-node/patches/patch-ae (limited to 'sysutils/munin-node') diff --git a/sysutils/munin-node/Makefile b/sysutils/munin-node/Makefile index c1c1c6c74bd..99e3dd121ab 100644 --- a/sysutils/munin-node/Makefile +++ b/sysutils/munin-node/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2006/07/07 22:10:07 jlam Exp $ +# $NetBSD: Makefile,v 1.7 2006/07/21 23:28:37 abs Exp $ # DISTNAME= munin_${VER} @@ -6,7 +6,7 @@ VER= 1.3.1 PKGNAME= munin-node-${VER} CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=munin/} -PKGREVISION= 3 +PKGREVISION= 4 MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= http://munin.sourceforge.net/ @@ -27,6 +27,8 @@ MUNIN_USER?= munin PKG_GROUPS= ${MUNIN_GROUP} PKG_USERS= ${MUNIN_USER}:${MUNIN_GROUP}::Munin\\ user +PKG_SYSCONFSUBDIR?= munin +REPLACE_PERL+= node/node.d/*.in STATEDIR?= ${VARBASE}/munin/plugin-state MUNIN_RUN?= ${VARBASE}/run/munin @@ -51,6 +53,7 @@ INSTALL_TARGET= install-node install-node-plugins BUILD_TARGET= build #MAKE_ENV+= PERL5_SITELIB=${PERL5_SITELIB} +MAKE_ENV+= CONFDIR=${PKG_SYSCONFDIR} MAKE_ENV+= MUNIN_USER=${MUNIN_USER} MAKE_ENV+= MUNIN_GROUP=${MUNIN_GROUP} MAKE_ENV+= PERL5=${PERL5:Q} @@ -68,7 +71,7 @@ RCD_SCRIPTS+= munin-node EGDIR= ${PREFIX}/share/examples/munin -CONF_FILES+= ${EGDIR}/munin-node.conf ${PKG_SYSCONFDIR}/munin/munin-node.conf +CONF_FILES+= ${EGDIR}/munin-node.conf ${PKG_SYSCONFDIR}/munin-node.conf pre-configure: diff --git a/sysutils/munin-node/distinfo b/sysutils/munin-node/distinfo index 5e4838c30e2..b6b969ff493 100644 --- a/sysutils/munin-node/distinfo +++ b/sysutils/munin-node/distinfo @@ -1,9 +1,10 @@ -$NetBSD: distinfo,v 1.1.1.1 2006/06/04 20:53:57 he Exp $ +$NetBSD: distinfo,v 1.2 2006/07/21 23:28:37 abs Exp $ SHA1 (munin_1.3.1.tar.gz) = f7783b645abbb25524c3f1b6e0fe27185f1de3db RMD160 (munin_1.3.1.tar.gz) = a6ea4e1839f4c787457e4051d55007b7bcebd1d4 Size (munin_1.3.1.tar.gz) = 315743 bytes -SHA1 (patch-aa) = f4c75a11a5fa026d968a2685f55061c74f51e537 +SHA1 (patch-aa) = df9b128721166912c086a54b29b7971a00581ea0 SHA1 (patch-ab) = bb0f63cdef893d8c224cdd03a4a4125d03f85f80 SHA1 (patch-ac) = 9ef503b4d20f65e990c332c7789188a6fbad618e SHA1 (patch-ad) = 8accd3875324035f2c95903fc37cee4b4a55948a +SHA1 (patch-ae) = 63b6acf126bc8baaed0ff429cfa0fa63945e5915 diff --git a/sysutils/munin-node/files/munin-node.sh b/sysutils/munin-node/files/munin-node.sh index 4aab73ce298..fb1502ee7d1 100644 --- a/sysutils/munin-node/files/munin-node.sh +++ b/sysutils/munin-node/files/munin-node.sh @@ -1,6 +1,6 @@ #! /bin/sh # -# $NetBSD: munin-node.sh,v 1.2 2006/06/27 13:05:49 he Exp $ +# $NetBSD: munin-node.sh,v 1.3 2006/07/21 23:28:37 abs Exp $ # # PROVIDE: munin-node # REQUIRE: DAEMON @@ -20,7 +20,7 @@ name="munin_node" rcvar=$name command=@PREFIX@/sbin/munin-node command_interpreter=@PERL@ -required_files=@PKG_SYSCONFDIR@/munin/munin-node.conf +required_files=@PKG_SYSCONFDIR@/munin-node.conf if [ ! -d @STATEDIR@ ]; then mkdir @STATEDIR@ diff --git a/sysutils/munin-node/files/node/node.d.netbsd/sensors_.in b/sysutils/munin-node/files/node/node.d.netbsd/sensors_.in index 5f8d8723ab8..3b7b8e20d1a 100755 --- a/sysutils/munin-node/files/node/node.d.netbsd/sensors_.in +++ b/sysutils/munin-node/files/node/node.d.netbsd/sensors_.in @@ -14,6 +14,12 @@ # suggest # # $Log: sensors_.in,v $ +# Revision 1.2 2006/07/21 23:28:37 abs +# Use PKG_SYSCONFSUBDIR so PKG_SYSCONFBASE can be set +# Use REPLACE_PERL on all plugins +# Adjust sensors_ to work with NetBSD 3 +# Bump PKGREVISION +# # Revision 1.1.1.1 2006/06/04 20:53:57 he # Import the client version of the Munin system monitoring/graphing # tool -- project homepage is at http://munin.sourceforge.net/ @@ -65,18 +71,14 @@ END { exit 0 fi - -if [ "$1" = "config" ]; then - case $0 in - sensors_temp) - echo 'graph_title Fans' - echo 'graph_vtitle RPM' - echo 'graph_args --base 1000 -l 0' - /usr/sbin/envstat -r | awk ' +envstat_config() +{ + /usr/sbin/envstat -r | awk -v "lookfor=$1" -F: ' BEGIN { p=0 } -/degC$/ { - gsub(":", "", $1); - print "temp." $1 ".label " $1; +match($0, lookfor "$") { + l=$1 + gsub("[^A-Za-z0-9\\-]", "", $1); + print tolower(lookfor) "_" tolower($1) ".label " l; p=1; } END { @@ -84,52 +86,43 @@ END { exit 1; } }' - if [ $? != 0 ]; then - echo 'No temperature sensors found' >&2 - exit 1 - fi - ;; - sensors_fans) + if [ $? != 0 ]; then + echo "No $1 sensors found" >&2 + exit 1 + fi +} + +envstat_value() +{ + /usr/sbin/envstat -r | awk -v "lookfor=$1" -F: ' +match($0, lookfor "$") { + gsub("[^A-Za-z0-9\\-]", "", $1); + sub(" *", "", $2); + sub(" .*", "", $2); + print tolower(lookfor) "_" tolower($1) ".value " $2; +} +' +} + +if [ "$1" = "config" ]; then + case $0 in + *sensors_temp) echo 'graph_title Temperatures' echo 'graph_vtitle deg Celcius' echo 'graph_args --base 1000 -l 0' - /usr/sbin/envstat -r | awk ' -BEGIN { p=0 } -/RPM$/ { - gsub(":", "", $1); - print "fans." $1 ".label " $1; - p=1; -} -END { - if (!p) { - exit 1; - } -}' - if [ $? != 0 ]; then - echo 'No fan sensors found' >&2 - exit 1 - fi + envstat_config degC ;; - sensors_volt) + *sensors_fans) + echo 'graph_title Fans' + echo 'graph_vtitle RPM' + echo 'graph_args --base 1000 -l 0' + envstat_config RPM + ;; + *sensors_volt) echo 'graph_title Voltages' echo 'graph_vtitle Volt' echo 'graph_args --base 1000 --logarithmic' - /usr/sbin/envstat -r | awk ' -BEGIN { p=0 } -/V$/ { - gsub(":", "", $1); - print "volt." $1 ".label " $1; - p=1; -} -END { - if (!p) { - exit 1; - } -}' - if [ $? != 0 ]; then - echo 'No voltage sensors found' >&2 - exit 1 - fi + envstat_config V ;; esac echo 'graph_category sensors' @@ -139,28 +132,13 @@ fi case $0 in - sensors_temp) - /usr/sbin/envstat -r | awk ' -/degC$/ { - gsub(":", "", $1); - print "temp." $1 ".value " $2; -} -' + *sensors_temp) + envstat_value degC ;; - sensors_fans) - /usr/sbin/envstat -r | awk ' -/RPM$/ { - gsub(":", "", $1); - print "fans." $1 ".value " $2; -} -' + *sensors_fans) + envstat_value RPM + ;; + *sensors_volt) + envstat_value V ;; - sensors_volt) -/usr/sbin/envstat -r | awk ' -/V$/ { - gsub(":", "", $1); - print "volt." $1 ".value " $2; -} -' - ;; esac diff --git a/sysutils/munin-node/patches/patch-aa b/sysutils/munin-node/patches/patch-aa index ad4384ef6fa..cede4fe637c 100644 --- a/sysutils/munin-node/patches/patch-aa +++ b/sysutils/munin-node/patches/patch-aa @@ -1,6 +1,6 @@ -$NetBSD: patch-aa,v 1.1.1.1 2006/06/04 20:53:57 he Exp $ +$NetBSD: patch-aa,v 1.2 2006/07/21 23:28:37 abs Exp $ ---- Makefile.config.orig 2005-01-10 11:38:22.000000000 +0100 +--- Makefile.config.orig 2005-01-10 10:38:22.000000000 +0000 +++ Makefile.config @@ -7,32 +7,36 @@ # @@ -15,7 +15,7 @@ $NetBSD: patch-aa,v 1.1.1.1 2006/06/04 20:53:57 he Exp $ # Where Munin keeps its configurations (server.conf, client.conf, ++) -CONFDIR = $(DESTDIR)/etc/opt/munin -+CONFDIR = $(UPREFIX)/etc/munin ++CONFDIR ?= $(UPREFIX)/etc/munin # Server only - where to put munin-cron -BINDIR = $(PREFIX)/bin diff --git a/sysutils/munin-node/patches/patch-ae b/sysutils/munin-node/patches/patch-ae new file mode 100644 index 00000000000..fd67e929445 --- /dev/null +++ b/sysutils/munin-node/patches/patch-ae @@ -0,0 +1,15 @@ +$NetBSD: patch-ae,v 1.1 2006/07/21 23:28:37 abs Exp $ + +--- node/node.d/hddtemp_smartctl.in.orig 2005-01-29 22:14:02.000000000 +0000 ++++ node/node.d/hddtemp_smartctl.in +@@ -93,6 +93,10 @@ if ($^O eq 'linux') { + } + } elsif ($^O eq 'solaris') { + @drives = map { s@.*/@@ } glob '/dev/rdsk/c*t*d*s2'; ++} elsif ($^O eq 'netbsd') { ++ my $rawpart = chr(`sysctl -n kern.rawpartition` + 97); # 'c' or 'd' ++ @drives = map { $_ . $rawpart } grep { /^wd/ } split ' ', ++ `sysctl -n hw.disknames`; + } + + @drives = split ' ', $ENV{drives} if exists $ENV{drives}; -- cgit v1.2.3