Package: munin-plugins-extra
Version: 1.4.2-1
Severity: wishlist

Hi,

Please review the attached debdiff that add support for autoconf/suggest
in vserver_* plugins.
- vserver_cpu_: autoconf/suggest
- vserver_loadavg: autoconf
- vserver_resources: autoconf

It also escape commandlines in the plugins documentation to prevent the
following errors:
No code specified for -e.
plugins/node.d.linux/vserver_cpu_.in: line 5: print 
POSIX::sysconf(_SC_PAGESIZE), "\n";: command not found

Test cases could be run using the following commands to ensure patched
plugins works as expected:
$ hg clone http://bitbucket.org/proppy/munin-plugins
$ cd munin-plugins/
$ make check
./test-vserver_cpu_
SUCCEED
./test-vserver_loadavg
SUCCEED
./test-vserver_resources
SUCCEED

Works as been sponsored by ISVTEC.
-- 
Johan Euphrosine <pro...@aminche.com>
diff -u munin-1.4.2/debian/changelog munin-1.4.2/debian/changelog
--- munin-1.4.2/debian/changelog
+++ munin-1.4.2/debian/changelog
@@ -1,3 +1,10 @@
+munin (1.4.2-2) unstable; urgency=low
+
+  * Add patches/301-vserver-autoconf-suggest.patch to add support
+    for autoconf and suggest in vserver plugins.
+
+ -- Johan Euphrosine (proppy) <pro...@aminche.com>  Sat, 19 Dec 2009 16:35:59 +0100
+
 munin (1.4.2-1) unstable; urgency=low
 
   [ Tom Feiner ]
diff -u munin-1.4.2/debian/patches/series munin-1.4.2/debian/patches/series
--- munin-1.4.2/debian/patches/series
+++ munin-1.4.2/debian/patches/series
@@ -3,0 +4 @@
+301-vserver-autoconf-suggest.patch
only in patch2:
unchanged:
--- munin-1.4.2.orig/debian/patches/301-vserver-autoconf-suggest.patch
+++ munin-1.4.2/debian/patches/301-vserver-autoconf-suggest.patch
@@ -0,0 +1,150 @@
+Description: Add support for autoconf/suggest in vserver plugins.
+ Escape command lines in TODO items.
+
+Origin: other
+Bug-Debian: none
+Forwarded: no
+Author: Johan Euphrosine (proppy) <pro...@aminche.com>
+Last-Update: 2009-12-19
+Index: munin-1.4.2/plugins/node.d.linux/vserver_cpu_.in
+===================================================================
+--- munin-1.4.2.orig/plugins/node.d.linux/vserver_cpu_.in	2009-12-19 16:25:25.000000000 +0100
++++ munin-1.4.2/plugins/node.d.linux/vserver_cpu_.in	2009-12-19 16:27:47.000000000 +0100
+@@ -1,5 +1,7 @@
+ #!@@BASH@@
+ # -*- sh -*-
++#%# family=auto
++#%# capabilities=autoconf suggest
+ 
+ : <<EOF
+ 
+@@ -80,8 +82,8 @@
+ =item Less use of /proc
+ 
+ use /proc less often (100 times more overhead than talking to the
+-kernel directly) i.e. use something like pagesize=`perl -MPOSIX -e
+-'print POSIX::sysconf(_SC_PAGESIZE), "\n";'`
++kernel directly) i.e. use something like pagesize=\`perl -MPOSIX -e
++'print POSIX::sysconf(_SC_PAGESIZE), "\n";'\`
+ 
+ =back
+ 
+@@ -93,6 +95,25 @@
+ 
+ EOF
+ 
++if [ "$1" = "autoconf" ]; then
++	if [ -r ${PROC_PATH}/virtual/info ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (${PROC_PATH}/virtual/info not found)"
++		exit 1
++	fi
++fi
++
++if [ "$1" = "suggest" ]; then
++	if [ ! -r ${PROC_PATH}/virtual/info ]; then
++		exit 1
++	fi
++	#
++	# 'else' clause is after XIDS definition
++	#
++fi
++
+ VSERVERS="$vservers"
+ 
+ INFO=(`sed 's/.*:\t//' /proc/virtual/info 2>/dev/null || echo '<none>'`)
+@@ -124,6 +145,16 @@
+     done
+ fi
+ 
++if [ "$1" = "suggest" ]; then
++	if [ -r ${PROC_PATH}/virtual/info ]; then
++	        for i in $XIDS ; do
++			LABEL=`cat ${PROC_PATH}/virtual/$i/$NAMELOC |grep NodeName |cut -f2`
++			echo $LABEL
++		done
++		exit 0
++	fi
++fi
++
+ BASEPARAM=`basename $0 | sed 's/^vserver_//'`
+ MODE=`echo $BASEPARAM | sed 's/^hold.*//'`
+ 
+Index: munin-1.4.2/plugins/node.d.linux/vserver_loadavg.in
+===================================================================
+--- munin-1.4.2.orig/plugins/node.d.linux/vserver_loadavg.in	2009-12-19 16:25:29.000000000 +0100
++++ munin-1.4.2/plugins/node.d.linux/vserver_loadavg.in	2009-12-19 16:26:57.000000000 +0100
+@@ -1,5 +1,7 @@
+ #!@@BASH@@
+ # -*- sh -*-
++#%# family=auto
++#%# capabilities=autoconf
+ 
+ : <<EOF
+ 
+@@ -65,15 +67,18 @@
+ 
+ # If run with the "autoconf"-parameter, give our opinion on whether we
+ # should be run on this system or not. This is optional, and only used by
+-# munin-config. In the case of this plugin, we should most probably
+-# always be included whwn there is a vserver kernel.
++# munin-config.
+ 
+ if [ "$1" = "autoconf" ]; then
+-        echo yes
+-        exit 0
++	if [ -r ${PROC_PATH}/virtual/info ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (${PROC_PATH}/virtual/info not found)"
++		exit 1
++	fi
+ fi
+ 
+-
+ # if vservers are specified, use them; the default is to use all.
+ VSERVERS="$vservers"
+ 
+Index: munin-1.4.2/plugins/node.d.linux/vserver_resources.in
+===================================================================
+--- munin-1.4.2.orig/plugins/node.d.linux/vserver_resources.in	2009-12-19 16:25:31.000000000 +0100
++++ munin-1.4.2/plugins/node.d.linux/vserver_resources.in	2009-12-19 16:26:57.000000000 +0100
+@@ -1,5 +1,7 @@
+ #!@@BASH@@
+ # -*- sh -*-
++#%# family=auto
++#%# capabilities=autoconf
+ 
+ : <<EOF
+ 
+@@ -151,8 +153,8 @@
+ =item Use /proc less often
+ 
+ use /proc less often (100 times more overhead than talking to the
+-kernel directly) i.e. use something like pagesize=`perl -MPOSIX -e
+-'print POSIX::sysconf(_SC_PAGESIZE), "\n";'`
++kernel directly) i.e. use something like pagesize=\`perl -MPOSIX -e
++'print POSIX::sysconf(_SC_PAGESIZE), "\n";'\`
+ 
+ =back
+ 
+@@ -168,6 +170,16 @@
+ 
+ EOF
+ 
++if [ "$1" = "autoconf" ]; then
++	if [ -r ${PROC_PATH}/virtual/info ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (${PROC_PATH}/virtual/info not found)"
++		exit 1
++	fi
++fi
++
+ VSERVERS="$vservers"
+ LIMITS="$limits"
+ RESOURCE="$resource"

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to