Skip to content

Commit

Permalink
Use PKG_SYSCONFSUBDIR so PKG_SYSCONFBASE can be set
Browse files Browse the repository at this point in the history
Use REPLACE_PERL on all plugins
Adjust sensors_ to work with NetBSD 3
Bump PKGREVISION
  • Loading branch information
abs committed Jul 21, 2006
1 parent f1156af commit b99437c
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 82 deletions.
9 changes: 6 additions & 3 deletions sysutils/munin-node/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# $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}
VER= 1.3.1
PKGNAME= munin-node-${VER}
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=munin/}
PKGREVISION= 3
PKGREVISION= 4

MAINTAINER= [email protected]
HOMEPAGE= http://munin.sourceforge.net/
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions sysutils/munin-node/distinfo
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions sysutils/munin-node/files/munin-node.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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@
Expand Down
122 changes: 50 additions & 72 deletions sysutils/munin-node/files/node/node.d.netbsd/sensors_.in
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -65,71 +71,58 @@ 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 {
if (!p) {
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'
Expand All @@ -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
6 changes: 3 additions & 3 deletions sysutils/munin-node/patches/patch-aa
Original file line number Diff line number Diff line change
@@ -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 @@
#
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions sysutils/munin-node/patches/patch-ae
Original file line number Diff line number Diff line change
@@ -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};

0 comments on commit b99437c

Please sign in to comment.