[arch-commits] Commit in munin/trunk (7 files)

Dan McGee dan at archlinux.org
Sun Dec 6 17:11:18 UTC 2009


    Date: Sunday, December 6, 2009 @ 12:11:18
  Author: dan
Revision: 60734

Munin version upgrade

Move to 1.4.x from 1.2.6. Also convert the package to 'any' and a split
package that builds both munin and munin-node. I probably did something
wrong as this is the first split package and 'any' package I've made, even
being the pacman maintainer.

Added:
  munin/trunk/iostat_partition
  munin/trunk/logrotate.munin-node
  munin/trunk/munin-node.init
  munin/trunk/munin-node.install
Modified:
  munin/trunk/Makefile.config
  munin/trunk/PKGBUILD
Deleted:
  munin/trunk/rrdtool-utf8-only.diff

------------------------+
 Makefile.config        |   80 ++++++++++++++++++-------
 PKGBUILD               |   59 ++++++++++++------
 iostat_partition       |  147 +++++++++++++++++++++++++++++++++++++++++++++++
 logrotate.munin-node   |    4 +
 munin-node.init        |   38 ++++++++++++
 munin-node.install     |   10 +++
 rrdtool-utf8-only.diff |   44 --------------
 7 files changed, 298 insertions(+), 84 deletions(-)

Modified: Makefile.config
===================================================================
--- Makefile.config	2009-12-06 16:38:36 UTC (rev 60733)
+++ Makefile.config	2009-12-06 17:11:18 UTC (rev 60734)
@@ -1,9 +1,15 @@
 # This file specifies where Munin will look for things after you've
 # run 'make' in the source directory.  Modify it to suit your needs.
 
+# DESTDIR is meant only for use when making Munin packages.  Unless
+# you're doing packaging do NOT set it. 
 # DESTDIR is empty during building, and optionally set to point to
 # a shadow tree during make install.
 
+# Note: There is a need for a VARDIR, with DBDIR, PLUGSTATE, HTMLDIR
+# and LOGDIR as subdirectories.  Today, DBDIR contains configured
+# domains, as well as PLUGSTATE, and we risk collisions.
+
 #
 # the base of the Munin installation.
 # 
@@ -28,10 +34,20 @@
 LIBDIR     = $(PREFIX)/usr/lib/munin
 
 # Server only - Output directory
-HTMLDIR    = $(PREFIX)/srv/http/munin
-CGIDIR     = $(HTMLDIR)/cgi
+HTMLDIR    = $(PREFIX)/usr/share/munin/www
+CGIDIR     = $(PREFIX)/usr/share/munin/cgi
 
-# Client only - Where to put RRD files and other internal data
+# Server only - spool directory for data gathered from nodes by
+# munin-gather - experimental.  Place on ramdisk to make munin
+# scale better.  On many versions of Linux as well as on Solaris
+# /tmp will be a ramdisk.
+
+SSPOOLDIR  = $(PREFIX)/spool
+
+# Suggested directory name for a pulic ramdisk based tmp directory.
+# SSPOOLDIR := /tmp/muninspool
+
+# Client only - Where to put RRD files and other intenal data
 DBDIR      = $(DESTDIR)/var/lib/munin
 
 # Client only - Where plugins should put their states. Must be writable by
@@ -51,6 +67,19 @@
 # The python interpreter to use (used by some plugins)
 PYTHON     = /usr/bin/env python
 
+# The ruby interpreter to use (used by some plugins)
+RUBY       := /usr/bin/env ruby
+
+# The java runtime to use (used by some plugins)
+JAVARUN    := /usr/bin/java
+
+# The java library dir to use (used by some plugins)
+# this is needed in order to be able to install 
+# java libraries in a custom location. Many distrubutions
+# enforce a spesific location for java libraries.
+JAVALIBDIR:= $(LIBDIR)
+
+
 # A modern (posix) shell.  We're not looking for arrays, but $() and
 # other modern stuff is expected.  On a posix-system the expression
 # below will find the right shell.  Most Unixes released the last 10
@@ -59,44 +88,53 @@
 # On Linux /bin/sh, SunOS/Solaris /usr/xpg4/bin/sh or /bin/ksh
 # In general: bash or ksh will work
 #
-GOODSH     = $(shell PATH=`getconf PATH` sh -c 'type sh | sed "s/.* //"')
+GOODSH     := $(shell PATH=`getconf PATH` sh -c 'type sh | sed "s/.* //"')
 
 # Path of bash for bash specific plugins
-BASH       = /bin/bash
+BASH       := /bin/bash
 
 # Server only - Where to install the perl libraries
-PERLLIB    = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2)
+PERLSITELIB := $(shell $(PERL) -V:sitelib | cut -d"'" -f2)
+PERLLIB    = $(DESTDIR)$(PERLSITELIB)
 
 # Client only - Install plugins for this architecture
-OSTYPE     = $(shell uname | tr '[A-Z]' '[a-z]')
+OSTYPE     := $(shell uname | tr '[A-Z]' '[a-z]')
 
 # How to figure out the hostname. (Only used in default configuration
 # files)
-HOSTNAME   = `hostname`
+HOSTNAME   := myhostname
 
 # What is the safest way to create a tempfile.
 # Default is to figure it out by testing various methods.
 # Replace this with a known platform-specific method
-MKTEMP     = $(shell ./test-mktemp)
+MKTEMP     := $(shell ./test-mktemp)
 
 # Munin version number.
-VERSION    = $(shell cat RELEASE)
+VERSION    := $(shell ./getversion)
 
 # User to run munin as
-USER       = munin
-GROUP      = munin
+USER       := munin
+GROUP      := munin
 
 # Default user to run the plugins as
-PLUGINUSER = nobody
+PLUGINUSER := nobody
 
 # Which command to use to check if the USER and GROUP to run Munin as, exists.
-GETENT = /bin/true
-CHECKUSER  = /bin/true 
-CHECKGROUP = /bin/true
+GETENT     := /bin/true
+CHECKUSER  := /bin/true 
+CHECKGROUP := /bin/true
 
-CHOWN      = true
-CHMOD      = chmod
-CHGRP      = true
+CHOWN      := true
+CHMOD      := chmod
+CHGRP      := true
+
+# Java compiler stuff - only needed on the buildhost
+JC         := javac
+JFLAGS     := -g -source 1.5 -target 1.5
+JAR        := jar
+
+# Check if the java compiler works
+JCVALID    := no
+
 # Check whether setruid functionality can be used
-HASSETR = $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' )
-
+HASSETR    := $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' )

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2009-12-06 16:38:36 UTC (rev 60733)
+++ PKGBUILD	2009-12-06 17:11:18 UTC (rev 60734)
@@ -1,36 +1,57 @@
 # $Id $
 # Maintainer: Dan McGee <dan at archlinux.org>
 # Contributor: Evan LeCompte <evanlec at gmail.com>
-pkgname=munin
-pkgver=1.2.6
-pkgrel=13
+pkgname=('munin' 'munin-node')
+pkgbase=munin
+pkgver=1.4.1
+pkgrel=1
 pkgdesc="A distributed monitoring/graphing tool"
-arch=('i686' 'x86_64')
+arch=('any')
 url="http://munin.projects.linpro.no/"
 license=("GPL")
-depends=('perl>=5.10.1' 'perl<5.10.2' 'rrdtool' 'perl-html-template' 'perl-date-manip' 'ttf-dejavu')
-backup=(etc/munin/munin.conf etc/logrotate.d/munin)
-install=munin.install
-source=(http://downloads.sourceforge.net/sourceforge/munin/munin_$pkgver.tar.gz
-        Makefile.config munin-cron-entry logrotate.munin
-        rrdtool-utf8-only.diff)
+depends=('perl>=5.10.1' 'perl<5.10.2')
+source=(http://downloads.sourceforge.net/sourceforge/munin/munin-$pkgver.tar.gz
+        Makefile.config
+        munin-cron-entry
+        munin-node.init
+        logrotate.munin
+        logrotate.munin-node
+        iostat_partition)
 
 build() { 
-	cd $srcdir/$pkgname-$pkgver
+	cd $srcdir/munin-$pkgver
 	cp $srcdir/Makefile.config $srcdir/$pkgname-$pkgver || exit 1
-	patch -Np3 < $srcdir/rrdtool-utf8-only.diff
-	make PREFIX='' || exit 1
+	# multithreading wrecks havoc on the build, should probably report this upstream
+	make -j1 PREFIX='' || exit 1
 }
 
-package() {
-	cd $srcdir/$pkgname-$pkgver
-	make DESTDIR=$pkgdir install-main install-doc install-man || exit 1
+package_munin() {
+	depends=('perl>=5.10.1' 'perl<5.10.2' 'rrdtool' 'perl-html-template' 'perl-date-manip' 'perl-log-log4perl')
+	backup=(etc/munin/munin.conf etc/logrotate.d/munin)
+	install=munin.install
+	cd $srcdir/munin-$pkgver
+	make DESTDIR=$pkgdir install-master-prime || exit 1
 	install -D -m644 $srcdir/munin-cron-entry $pkgdir/etc/munin/munin-cron-entry
 	install -D -m644 $srcdir/logrotate.munin $pkgdir/etc/logrotate.d/munin
 }
 
-md5sums=('45f84d58f80642ce914f147232f0d396'
-         '5f9b83e0c876821cf2b20012f7cb63f0'
+package_munin-node() {
+	depends=('perl>=5.10.1' 'perl<5.10.2' 'perl-net-server')
+	optdepends=('perl-net-snmp: for SNMP plugins'
+	            'perl-net-ssleay: for SSL/TLS support')
+	backup=(etc/munin/munin-node.conf etc/logrotate.d/munin-node)
+	install=munin-node.install
+	cd $srcdir/munin-$pkgver
+	make DESTDIR=$pkgdir install-common-prime install-node-prime install-plugins-prime || exit 1
+	install -m755 $srcdir/iostat_partition $pkgdir/usr/lib/munin/plugins/
+	install -D -m755 $srcdir/munin-node.init $pkgdir/etc/rc.d/munin-node
+	install -D -m644 $srcdir/logrotate.munin-node $pkgdir/etc/logrotate.d/munin-node
+}
+
+md5sums=('04086f23b657e05e4e5e5a8fa6082f16'
+         '6ebc31eaa09734394606f7a1e19e38a5'
          'dc9c83aa2a278466fb475364462f4119'
+         '9551a2f7c0f0364fd1b7dd010675e47a'
          'db77b53150a906256a71a9f539c7fac2'
-         '36f52b88d6465e198b5cf40e06d30b4d')
+         'cdf139f2b6ae36852113f3411caa6e99'
+         '12289ab5d062449eaa14376f927f5d26')

Added: iostat_partition
===================================================================
--- iostat_partition	                        (rev 0)
+++ iostat_partition	2009-12-06 17:11:18 UTC (rev 60734)
@@ -0,0 +1,147 @@
+#!/usr/bin/perl -w
+#
+# Plugin for watching io-bound traffic (in blocks) on disks.
+# Customized from standard 'iostat' plugin by operating on
+# partitions rather than block devices.
+#
+# Parameters:
+#
+# 	config   (required)
+# 	autoconf (optional - used by lrrd-config)
+#
+# plugin-conf.d/*:
+#
+# 	partitions	-- List partitions to monitor. E.g. "sda1 sda2".
+#
+# Magic markers (optional - used by lrrd-config and some installation
+# scripts):
+#
+#%# family=auto
+#%# capabilities=autoconf
+
+use strict;
+use warnings;
+
+my $detailed_present = 0;
+if (system("grep -q '' /proc/diskstats > /dev/null 2>&1") == 0
+	|| system("grep -q 'rio rmerge rsect ruse wio wmerge wsect wuse running use aveq' /proc/partitions") == 0)
+{
+	$detailed_present = 1;
+}
+
+if ( $ARGV[0] and $ARGV[0] eq "autoconf")
+{
+	if ($detailed_present eq 1)
+	{
+		print "yes\n";
+		exit 0;
+	}
+	print "no\n";
+	exit 1;
+}
+
+my %devs;
+
+&fetch_detailed;
+
+if ( $ARGV[0] and $ARGV[0] eq "config")
+{
+
+	print "graph_title IOstat\n";
+	print "graph_args --base 1024 -l 0\n";
+	print "graph_vlabel blocks per \${graph_period} read (-) / written (+)\n";
+	print "graph_category disk\n";
+	print "graph_total Total\n" if (keys (%devs) > 1);
+	print "graph_info This graph shows the I/O to and from partitions.\n";
+	print "graph_order";
+	foreach my $key (sort by_dev keys %devs)
+	{
+		print " ", $key, "_read ", $key, "_write ";
+	}
+	print "\n";
+	foreach my $key (sort by_dev keys %devs)
+	{
+		print $key . "_read.label $devs{$key}->{name}\n";
+		print $key . "_read.type DERIVE\n";
+		print $key . "_read.max 900000\n";
+		print $key . "_read.min 0\n";
+		print $key . "_read.graph no\n";
+		print $key . "_write.label $devs{$key}->{name}\n";
+		print $key . "_write.info I/O on device $devs{$key}->{name}\n";
+		print $key . "_write.type DERIVE\n";
+		print $key . "_write.max 900000\n";
+		print $key . "_write.min 0\n";
+		print $key . "_write.negative " . $key . "_read\n";
+	}
+	exit 0;
+}
+
+foreach my $key (sort by_dev keys %devs)
+{
+	print $key, "_read.value ", $devs{$key}->{rsect}, "\n";
+	print $key, "_write.value ", $devs{$key}->{wsect}, "\n";
+}
+
+sub by_dev {
+	return $a cmp $b;
+}
+
+my %maj_count;
+sub get_disk_count()
+{
+	my @disk_count;
+	my $major = $_[0];
+	$maj_count{$major} = 0 unless exists($maj_count{$major});
+	$disk_count[0] = $maj_count{$major}++;
+	die "Could not find disk_count for major: $major" unless (exists($disk_count[0]));
+	return $disk_count[0];
+}
+
+sub fetch_detailed()
+{
+	if (open(DETAILED, "/proc/diskstats") or open(DETAILED, "/proc/partitions"))
+	{
+		my %partitions = ();
+		if (exists $ENV{partitions}) {
+			$ENV{partitions} =~ s/["']//g;
+			%partitions = map {$_ => 1} split(' ', $ENV{partitions});
+		}
+		while (<DETAILED>)
+		{
+			if (/^\s+(\d+)\s+\d+\s*\d*\s+([[:alpha:][:digit:]\/]+)\s+(.*)/)
+			{
+				my @fields = split(/\s+/, $3);
+				my $tmpnam = $2;
+				my $major  = $1;
+				next unless exists $partitions{$tmpnam};
+				if ($tmpnam =~ /\d+$/ ) {
+					next unless $tmpnam =~ /(hd|sd|xvd)[[:alpha:]]\d+$/
+				}
+				next unless grep { $_ } @fields;
+
+				$tmpnam =~ s/\/[[:alpha:]]+(\d+)/\/$1/g;
+				$tmpnam =~ s/^([^\/]+)\//$1/;
+				$tmpnam =~ s/\/disc$//;
+
+				$devs{"dev".$major."_".&get_disk_count($major)} =
+				{
+					major => $major,
+					name => $tmpnam,
+					rio => $fields[0],
+					rmerge => $fields[1],
+					rsect => $fields[2],
+					ruse => $fields[3],
+					wio => $fields[4],
+					wmerge => $fields[5],
+					wsect => $fields[6],
+					wuse => $fields[7],
+					running => $fields[8],
+					use => $fields[9],
+					aveq => $fields[10]
+				};
+			}
+		}
+		close (DETAILED);
+	}
+}
+# vim:syntax=perl


Property changes on: munin/trunk/iostat_partition
___________________________________________________________________
Added: svn:executable
   + *

Added: logrotate.munin-node
===================================================================
--- logrotate.munin-node	                        (rev 0)
+++ logrotate.munin-node	2009-12-06 17:11:18 UTC (rev 60734)
@@ -0,0 +1,4 @@
+/var/log/munin/munin-node.log {
+   copytruncate
+   missingok
+}

Added: munin-node.init
===================================================================
--- munin-node.init	                        (rev 0)
+++ munin-node.init	2009-12-06 17:11:18 UTC (rev 60734)
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/munin-node`
+
+case "$1" in
+  start)
+    stat_busy "Starting munin-node"
+    /usr/sbin/munin-node >/dev/null
+    stat_done
+    ;;
+  stop)
+    stat_busy "Stopping munin-node"
+    if [ ! -z "$PID" ]; then
+      kill $PID &> /dev/null
+      if [ $? -gt 0 ]; then
+        stat_fail
+        exit 1
+      else
+        rm -f /var/run/munin/munin-node.pid &>/dev/null
+        stat_done
+      fi
+    else
+      stat_fail
+      exit 1
+    fi
+    ;;
+  restart)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"
+    ;;
+esac


Property changes on: munin/trunk/munin-node.init
___________________________________________________________________
Added: svn:executable
   + *

Added: munin-node.install
===================================================================
--- munin-node.install	                        (rev 0)
+++ munin-node.install	2009-12-06 17:11:18 UTC (rev 60734)
@@ -0,0 +1,10 @@
+post_install () {
+  # Check user/group munin exists
+  getent group munin >/dev/null || groupadd munin
+  getent passwd munin >/dev/null || useradd -c "Munin system monitor" -g munin -s /bin/false -d /var/lib/munin munin
+  # Fix permissions
+  chown munin.munin -R /var/log/munin /var/lib/munin /var/run/munin
+  # Do basic configuration
+  echo "==> Run the following to get a good set of default plugins:"
+  echo "    /usr/sbin/munin-node-configure --shell | sh"
+}

Deleted: rrdtool-utf8-only.diff
===================================================================
--- rrdtool-utf8-only.diff	2009-12-06 16:38:36 UTC (rev 60733)
+++ rrdtool-utf8-only.diff	2009-12-06 17:11:18 UTC (rev 60734)
@@ -1,44 +0,0 @@
-Index: /branches/1.2-stable/server/munin-graph.in
-===================================================================
---- /branches/1.2-stable/server/munin-graph.in (revision 1588)
-+++ /branches/1.2-stable/server/munin-graph.in (revision 1797)
-@@ -31,4 +31,5 @@
- use Getopt::Long;
- use Time::HiRes;
-+if ($RRDs::VERSION >= 1.3) { use Encode; }
- 
- my $graph_time= Time::HiRes::time;
-@@ -832,8 +833,15 @@
- 	    my @complete = ();
- 	    if ($RRDkludge) {
--		push (@complete,
-- 		      '--font' ,'LEGEND:7:@@LIBDIR@@/VeraMono.ttf',
-+		# since rrdtool 1.3 with libpango the LEGEND column alignment 
-+		# only works with monospace fonts
-+	  	if ( $RRDs::VERSION >= 1.3 ) { 
-+		    push (@complete,
-+ 		      '--font' ,'LEGEND:7:monospace');
-+		} else {
-+		    push (@complete,
-+ 		      '--font' ,'LEGEND:7:@@LIBDIR@@/VeraMono.ttf');
-+		}
-+		    push (@complete,
-  		      '--font' ,'UNIT:7:@@LIBDIR@@/VeraMono.ttf',
--
-  		      '--font' ,'AXIS:7:@@LIBDIR@@/VeraMono.ttf');
- 	    }
-@@ -859,4 +867,14 @@
- 	    print "\n\nrrdtool \"graph\" \"",
- 	      join ("\"\n\t\"", at complete), "\"\n" if $DEBUG;
-+
-+	    # Since version 1.3 rrdtool uses libpango which needs its input  
-+	    # as utf8 string. So we assume that every input is in latin1 
-+	    # and decode it to perl's internal representation and then to utf8. 
-+     	    if ( $RRDs::VERSION >= 1.3 ) { 
-+ 	        @complete = map { 
-+		    $_ = encode("utf8", (decode("latin1", $_)));
-+		} @complete;
-+	    }
-+
- 	    RRDs::graph (@complete);
- 	    if (my $ERROR = RRDs::error) {




More information about the arch-commits mailing list