summaryrefslogtreecommitdiff
path: root/sysutils/munin-node/files
diff options
context:
space:
mode:
authorabs <abs@pkgsrc.org>2006-07-21 23:28:37 +0000
committerabs <abs@pkgsrc.org>2006-07-21 23:28:37 +0000
commitb99437cd9c4807fc463566a58f995ad00c73bfa3 (patch)
treed17ecc127820b3c8e3b66525517be2213fb8364e /sysutils/munin-node/files
parentf1156afc25070013a94b138e7161fef86beb03b1 (diff)
downloadpkgsrc-b99437cd9c4807fc463566a58f995ad00c73bfa3.tar.gz
Use PKG_SYSCONFSUBDIR so PKG_SYSCONFBASE can be set
Use REPLACE_PERL on all plugins Adjust sensors_ to work with NetBSD 3 Bump PKGREVISION
Diffstat (limited to 'sysutils/munin-node/files')
-rw-r--r--sysutils/munin-node/files/munin-node.sh4
-rwxr-xr-xsysutils/munin-node/files/node/node.d.netbsd/sensors_.in122
2 files changed, 52 insertions, 74 deletions
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