Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Oct 2014 14:43:48 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r371586 - in head/sysutils: munin-common munin-master munin-master/files munin-node munin-node/files
Message-ID:  <201410271443.s9REhmYg004336@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Mon Oct 27 14:43:47 2014
New Revision: 371586
URL: https://svnweb.freebsd.org/changeset/ports/371586
QAT: https://qat.redports.org/buildarchive/r371586/

Log:
  Update to 2.0.24.
  
  Fixup the if_ and if_errcoll_ plugins, interface names can be longer than 5
  chars.  Add an if_packets_ plugin.
  
  Allow people to have a custom crontab that won't be touched when
  installing/deinstalling.
  
  Sponsored by:	Absolight

Added:
  head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_packets_.in   (contents, props changed)
Modified:
  head/sysutils/munin-common/distinfo
  head/sysutils/munin-common/munin.mk
  head/sysutils/munin-master/Makefile
  head/sysutils/munin-master/files/pkg-message.in
  head/sysutils/munin-master/pkg-deinstall
  head/sysutils/munin-master/pkg-install
  head/sysutils/munin-node/Makefile
  head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_.in
  head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_errcoll_.in
  head/sysutils/munin-node/pkg-plist

Modified: head/sysutils/munin-common/distinfo
==============================================================================
--- head/sysutils/munin-common/distinfo	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-common/distinfo	Mon Oct 27 14:43:47 2014	(r371586)
@@ -1,2 +1,2 @@
-SHA256 (munin-2.0.23.tar.gz) = efc23be5a2fd31eacbd6a55eb3526858c4618baff01c16cbe64918a5cfa5df5a
-SIZE (munin-2.0.23.tar.gz) = 1337241
+SHA256 (munin-2.0.24.tar.gz) = 74940896326bbb33d5607c39d1f972f69c5fc4278c93ae185338113a62a6a4e6
+SIZE (munin-2.0.24.tar.gz) = 1337330

Modified: head/sysutils/munin-common/munin.mk
==============================================================================
--- head/sysutils/munin-common/munin.mk	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-common/munin.mk	Mon Oct 27 14:43:47 2014	(r371586)
@@ -1,8 +1,11 @@
-MUNIN_VERSION=	2.0.23
+MUNIN_VERSION=	2.0.24
 MUNIN_SITES=	SF/${PORTNAME}/stable/${MUNIN_VERSION}
-MUNIN_DISTINFO=	${PORTSDIR}/sysutils/munin-common/distinfo
-MUNIN_PATCHES=	${PORTSDIR}/sysutils/munin-common/files/patch-Makefile \
+DISTINFO_FILE=	${PORTSDIR}/sysutils/munin-common/distinfo
+
+.if ${PKGNAMESUFFIX} != -common
+EXTRA_PATCHES+=	${PORTSDIR}/sysutils/munin-common/files/patch-Makefile \
 		${PORTSDIR}/sysutils/munin-common/files/patch-Makefile.config
+.endif
 
 PORTSCOUT=	limit:^2\.0\.
 

Modified: head/sysutils/munin-master/Makefile
==============================================================================
--- head/sysutils/munin-master/Makefile	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-master/Makefile	Mon Oct 27 14:43:47 2014	(r371586)
@@ -47,8 +47,6 @@ PKGMESSAGE=	${WRKDIR}/pkg-message
 
 .include "${.CURDIR}/../munin-common/munin.mk"
 
-EXTRA_PATCHES=	${MUNIN_PATCHES}
-DISTINFO_FILE=	${MUNIN_DISTINFO}
 ALL_TARGET=	infiles build-master build-man
 INSTALL_TARGET=	install-master-prime
 NO_ARCH=	yes

Modified: head/sysutils/munin-master/files/pkg-message.in
==============================================================================
--- head/sysutils/munin-master/files/pkg-message.in	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-master/files/pkg-message.in	Mon Oct 27 14:43:47 2014	(r371586)
@@ -5,4 +5,8 @@ has been placed in %%ETCDIR%%/munin.conf
 Please edit it according to your needs.
 
 The Munin server will be run from cron under the user 'munin'.
+
+If you need to customize the munin crontab, remove the lines
+containing #BEGIN_MUNIN_MAIN and #END_MUNIN_MAIN, and add a line
+with #MANUAL_MUNIN_CRONTAB.
 ********************************************************************

Modified: head/sysutils/munin-master/pkg-deinstall
==============================================================================
--- head/sysutils/munin-master/pkg-deinstall	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-master/pkg-deinstall	Mon Oct 27 14:43:47 2014	(r371586)
@@ -1,14 +1,17 @@
 #! /bin/sh
+# ex:sw=4 sts=4
 
 ask() {
     local question default answer
 
     question=$1
     default=$2
-    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]
+    then
 	read -p "${question} [${default}]? " answer
     fi
-    if [ x${answer} = x ]; then
+    if [ x${answer} = x ]
+    then
 	answer=${default}
     fi
     echo ${answer}
@@ -36,7 +39,8 @@ delete_crontab_entries() {
 
     TMPFILE=`mktemp -t munin` || exit 1
     crontab -u munin -l | sed -e "/^$b\$/,/^$e\$/d" -e '/^[ 	]*#/d' -e '/^$/d' > $TMPFILE
-    if [ -s $TMPFILE ]; then
+    if [ -s $TMPFILE ]
+    then
 	crontab -u munin -l | sed -e "/^$b\$/,/^$e\$/d" | crontab -u munin -
 	echo "The crontab for user munin had manually created entries."
 	echo "Only the automatically created entries have been removed."
@@ -50,8 +54,8 @@ delete_crontab_entries() {
 }
 
 delnewsyslog() {
-    tmp="/etc/#munin-node$$"
-    sed -e '/^\/var\/log\/munin\/\*\.log[ 	]/d' /etc/newsyslog.conf >${tmp}
+    tmp=`mktemp -t munin` || exit 1
+    sed -e '/^\/var\/log\/munin\/\*\.log[	]/d' /etc/newsyslog.conf >${tmp}
     cat ${tmp} > /etc/newsyslog.conf
     rm ${tmp}
 }
@@ -59,23 +63,27 @@ delnewsyslog() {
 newsyslog() {
     ENTRY=`fgrep '/var/log/munin/*' /etc/newsyslog.conf`
     DEFAULT='/var/log/munin/*.log munin:munin	644  7	   *	@T00  GNWZ'
-    if [ -z "$ENTRY" ]; then
-        exit 0
-    elif [ "$ENTRY" = "$DEFAULT" ]; then
-        delnewsyslog
+    if [ -z "$ENTRY" ]
+    then
+	exit 0
+    elif [ "$ENTRY" = "$DEFAULT" ]
+    then
+	delnewsyslog
     elif yesno "You have changed the default munin-master entry in \"/etc/newsyslog.conf\".
-Do you want me to delete it?" y; then
-        delnewsyslog
-        echo "Done."
+Do you want me to delete it?" y
+    then
+	delnewsyslog
+	echo "Done."
     fi
 }
 
 
 case $2 in
     DEINSTALL)
-	if [ -z "${PACKAGE_BUILDING}" ]; then
-		delete_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN'
-		newsyslog
+	if [ -z "${PACKAGE_BUILDING}" ]
+	then
+	    delete_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN'
+	    newsyslog
 	fi
 	;;
     POST-DEINSTALL)

Modified: head/sysutils/munin-master/pkg-install
==============================================================================
--- head/sysutils/munin-master/pkg-install	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-master/pkg-install	Mon Oct 27 14:43:47 2014	(r371586)
@@ -1,14 +1,17 @@
 #! /bin/sh
+# ex:sw=4 sts=4
 
 ask() {
     local question default answer
 
     question=$1
     default=$2
-    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]
+    then
         read -p "${question} [${default}]? " answer
     fi
-    if [ x${answer} = x ]; then
+    if [ x${answer} = x ]
+    then
         answer=${default}
     fi
     echo ${answer}
@@ -34,32 +37,33 @@ create_crontab_entries() {
     b=$1
     e=$2
 
-    if crontab -u munin -l > /dev/null 2>&1; then
-	TMPFILE=`mktemp -t munin` || exit 1
-	cat > $TMPFILE
-	crontab -u munin -l | sed -e "/^$b$/,/^$e$/d" | \
-	cat - $TMPFILE | crontab -u munin -
-	rm $TMPFILE
+    if crontab -u munin -l > /dev/null 2>&1
+    then
+	if ! crontab -u munin -l | grep -q MANUAL_MUNIN_CRONTAB
+	then
+	    TMPFILE=`mktemp -t munin` || exit 1
+	    cat > $TMPFILE
+	    crontab -u munin -l | sed -e "/^$b$/,/^$e$/d" | \
+		cat - $TMPFILE | crontab -u munin -
+	    rm $TMPFILE
+	fi
     else
 	crontab -u munin -
     fi
 }
 
-mklogdir() {
-}
-
 newsyslog() {
-    if fgrep -q '/var/log/munin/*' /etc/newsyslog.conf; then
-        :
-    else
+    if ! fgrep -q '/var/log/munin/*' /etc/newsyslog.conf
+    then
         cat >> /etc/newsyslog.conf <<EOT
 /var/log/munin/*.log munin:munin	644  7	   *	@T00  GNWZ
 EOT
-    fi  
+    fi
 }
 
 move_www_dir() {
-    if [ -d ${PKG_PREFIX}/www/data/munin -a ! -d ${PKG_PREFIX}/www/munin ]; then
+    if [ -d ${PKG_PREFIX}/www/data/munin -a ! -d ${PKG_PREFIX}/www/munin ]
+    then
 	echo Migrating ${PKG_PREFIX}/www/data/munin to ${PKG_PREFIX}/www/munin
 	mv ${PKG_PREFIX}/www/data/munin ${PKG_PREFIX}/www/munin
     fi
@@ -71,11 +75,12 @@ move_www_dir() {
 case $2 in
     PRE-INSTALL)
 	move_www_dir # at some point in the installation, the www dir is created
-	;;      
+	;;
     POST-INSTALL)
-	if [ -z "${PACKAGE_BUILDING}" ]; then
-		newsyslog
-		create_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN' <<EOT
+	if [ -z "${PACKAGE_BUILDING}" ]
+	then
+	    newsyslog
+	    create_crontab_entries '#BEGIN_MUNIN_MAIN' '#END_MUNIN_MAIN' <<EOT
 #BEGIN_MUNIN_MAIN
 MAILTO=root
 
@@ -83,5 +88,5 @@ MAILTO=root
 #END_MUNIN_MAIN
 EOT
 	fi
-	;;      
+	;;
 esac

Modified: head/sysutils/munin-node/Makefile
==============================================================================
--- head/sysutils/munin-node/Makefile	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-node/Makefile	Mon Oct 27 14:43:47 2014	(r371586)
@@ -3,7 +3,6 @@
 
 PORTNAME=	munin
 PORTVERSION=	${MUNIN_VERSION}
-PORTREVISION=	1
 CATEGORIES=	sysutils perl5
 MASTER_SITES=	${MUNIN_SITES}
 PKGNAMESUFFIX=	-node
@@ -32,8 +31,6 @@ SHEBANG_FILES=	node/sbin/munin-node node
 
 .include "${.CURDIR}/../munin-common/munin.mk"
 
-DISTINFO_FILE=	${MUNIN_DISTINFO}
-EXTRA_PATCHES+=	${MUNIN_PATCHES}
 ALL_TARGET=	build-node build-plugins
 INSTALL_TARGET=	install-node-prime install-plugins-prime
 NO_ARCH=	yes

Modified: head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_.in
==============================================================================
--- head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_.in	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_.in	Mon Oct 27 14:43:47 2014	(r371586)
@@ -1,6 +1,42 @@
---- plugins/node.d.freebsd/if_.in.orig	2014-04-22 19:29:32 UTC
+--- plugins/node.d.freebsd/if_.in.orig	2014-10-26 14:12:24 UTC
 +++ plugins/node.d.freebsd/if_.in
-@@ -83,9 +83,12 @@
+@@ -22,7 +22,7 @@
+ INTERFACE=${0##*if_}
+ 
+ if [ "$1" = "autoconf" ]; then
+-	if [ -x /usr/bin/netstat ]; then
++	if [ -x /sbin/ifconfig -o -x /usr/bin/netstat ]; then
+ 		echo yes
+ 		exit 0
+ 	else
+@@ -32,8 +32,12 @@
+ fi
+ 
+ if [ "$1" = "suggest" ]; then
+-	if [ -x /usr/bin/netstat ]; then
+-		netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++	if [ -x /sbin/ifconfig ]
++	then
++		ifconfig -l | sed -Ee 's/[[:<:]](pfsync|faith|pf(log|sync)|lo|plip|carp|enc|fwe)[^ ]*//g' | xargs -n 1 echo
++		exit 0
++	elif [ -x /usr/bin/netstat ]; then
++		netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pf(log|sync)/d' -e '/<Link#[0-9]*>/s/\** .*//p'
+ 		exit 0
+ 	else
+ 		exit 1
+@@ -68,8 +72,10 @@
+ /<Link#[0-9]*>/ {
+ 	if (NF == 10) { 
+ 		rsum += $6; osum += $9;
+-	} else {
++	} else if (NF == 11) {
+ 		rsum += $7; osum += $10;
++	} else { # NF == 12
++		rsum += $8; osum += $11;
+ 	}
+ }
+ END {
+@@ -83,9 +89,13 @@
  	if (NF == 10) { 
  		print "rbytes.value", $6;
  		print "obytes.value", $9;
@@ -8,9 +44,10 @@
 +	} else if (NF == 11) {
  		print "rbytes.value", $7;
  		print "obytes.value", $10;
-+	} else {
++	} else { # NF == 12
 +		print "rbytes.value", $8;
 +		print "obytes.value", $11;
  	}
  }'
  fi
++

Modified: head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_errcoll_.in
==============================================================================
--- head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_errcoll_.in	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_errcoll_.in	Mon Oct 27 14:43:47 2014	(r371586)
@@ -1,6 +1,30 @@
---- plugins/node.d.freebsd/if_errcoll_.in.orig	2014-04-22 19:29:32 UTC
+--- plugins/node.d.freebsd/if_errcoll_.in.orig	2014-10-26 14:12:24 UTC
 +++ plugins/node.d.freebsd/if_errcoll_.in
-@@ -59,9 +59,13 @@
+@@ -19,7 +19,7 @@
+ INTERFACE=${0##*if_errcoll_}
+ 
+ if [ "$1" = "autoconf" ]; then
+-	if [ -x /usr/bin/netstat ]; then
++	if [ -x /sbin/ifconfig -o -x /usr/bin/netstat ]; then
+ 		echo yes
+ 		exit 0
+ 	else
+@@ -29,8 +29,12 @@
+ fi
+ 
+ if [ "$1" = "suggest" ]; then
+-	if [ -x /usr/bin/netstat ]; then
+-		netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++	if [ -x /sbin/ifconfig ]
++	then
++		ifconfig -l | sed -Ee 's/[[:<:]](pfsync|faith|pf(log|sync)|lo|plip|carp|enc|fwe)[^ ]*//g' | xargs -n 1 echo
++		exit 0
++	elif [ -x /usr/bin/netstat ]; then
++		netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pf(log|sync)/d' -e '/<Link#[0-9]*>/s/\** .*//p'
+ 		exit 0
+ 	else
+ 		exit 1
+@@ -59,9 +63,13 @@
  		print "ierrors.value", $5;
  		print "oerrors.value", $8;
  		print "collisions.value", $10;
@@ -9,7 +33,7 @@
  		print "ierrors.value", $6;
  		print "oerrors.value", $9;
  		print "collisions.value", $11;
-+	} else {
++	} else { # NF == 12
 +		print "ierrors.value", $6;
 +		print "oerrors.value", $10;
 +		print "collisions.value", $12;

Added: head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_packets_.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/munin-node/files/patch-plugins__node.d.freebsd__if_packets_.in	Mon Oct 27 14:43:47 2014	(r371586)
@@ -0,0 +1,104 @@
+--- plugins/node.d.freebsd/if_packets_.in.orig	2014-10-27 10:21:08 UTC
++++ plugins/node.d.freebsd/if_packets_.in
+@@ -0,0 +1,101 @@
++#!@@GOODSH@@
++# -*- sh -*-
++#
++# Wildcard-plugin to monitor network interfaces. To monitor an
++# interface, link if_<interface> to this file. E.g.
++#
++#    ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
++#
++# ...will monitor eth0.
++#
++# To aggregate all network interfaces on the system (except lo0),
++# link if_aggregated to this file.
++#
++# Any device found in /usr/bin/netstat can be monitored.
++#
++# Magic markers (optional - used by munin-config and some installation
++# scripts):
++#
++#%# family=auto
++#%# capabilities=autoconf suggest
++
++INTERFACE=${0##*if_}
++
++if [ "$1" = "autoconf" ]; then
++	if [ -x /sbin/ifconfig -o -x /usr/bin/netstat ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (/usr/bin/netstat not found)"
++		exit 0
++	fi
++fi
++
++if [ "$1" = "suggest" ]; then
++	if [ -x /sbin/ifconfig ]
++	then
++		ifconfig -l | sed -Ee 's/[[:<:]](pfsync|faith|pf(log|sync)|lo|plip|carp|enc|fwe)[^ ]*//g' | xargs -n 1 echo
++		exit 0
++	elif [ -x /usr/bin/netstat ]; then
++		netstat -i -b -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pf(log|sync)/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++		exit 0
++	else
++		exit 1
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo "graph_order rpackets opackets"
++	echo "graph_title $INTERFACE pps"
++	echo 'graph_args --base 1000'
++	echo 'graph_vlabel packets per ${graph_period} in (-) / out (+)'
++	echo 'graph_category network'
++	echo "graph_info This graph shows the packets counter of the $INTERFACE network interface. Please note that the traffic is shown in packets per second."
++	echo 'rpackets.label received'
++	echo 'rpackets.type COUNTER'
++	echo 'rpackets.graph no'
++
++	echo 'rpackets.min 0'
++	echo 'opackets.label pps'
++	echo 'opackets.type COUNTER'
++	echo 'opackets.negative rpackets'
++
++	echo 'opackets.min 0'
++	echo "opackets.info Packets sent (+) and received (-) on the $INTERFACE network interface."
++	exit 0
++fi
++
++if [ "$INTERFACE" = "aggregated" ]; then
++	/usr/bin/netstat -i -b -n | grep -v '^lo' | awk '
++BEGIN { rsum = 0; osum = 0; }
++/<Link#[0-9]*>/ {
++	if (NF == 10) { 
++		rsum += $4; osum += $7;
++	} else if (NF == 11) {
++		rsum += $5; osum += $8;
++	} else { # NF == 12
++		rsum += $6; osum += $9;
++	}
++}
++END {
++	printf "rpackets.value %i\n", rsum;
++	printf "opackets.value %i\n", osum;
++}'
++
++else
++	/usr/bin/netstat -i -b -n -I $INTERFACE | awk '
++/<Link#[0-9]*>/ {
++	if (NF == 10) {
++		print "rpackets.value", $4;
++		print "opackets.value", $7;
++	} else if (NF == 11) {
++		print "rbytes.value", $5;
++		print "obytes.value", $8;
++	} else { # NF == 12
++		print "rpackets.value", $6;
++		print "opackets.value", $9;
++	}
++}'
++fi
++

Modified: head/sysutils/munin-node/pkg-plist
==============================================================================
--- head/sysutils/munin-node/pkg-plist	Mon Oct 27 13:54:32 2014	(r371585)
+++ head/sysutils/munin-node/pkg-plist	Mon Oct 27 14:43:47 2014	(r371586)
@@ -102,6 +102,7 @@ sbin/munin-sched
 %%DATADIR%%/plugins/http_loadtime
 %%DATADIR%%/plugins/if_
 %%DATADIR%%/plugins/if_errcoll_
+%%DATADIR%%/plugins/if_packets_
 %%DATADIR%%/plugins/ifx_concurrent_sessions_
 %%DATADIR%%/plugins/iostat
 %%DATADIR%%/plugins/ipac-ng



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410271443.s9REhmYg004336>