ports/62479: New port: sysutils/munin-node Node-specific part of Munin

Lupe Christoph lupe at lupe-christoph.de
Sat Feb 7 15:30:20 UTC 2004


>Number:         62479
>Category:       ports
>Synopsis:       New port: sysutils/munin-node Node-specific part of Munin
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 07 07:30:19 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Lupe Christoph
>Release:        FreeBSD 4.8-RELEASE i386
>Organization:
>Environment:
System: FreeBSD sebastian.lupe-christoph.de 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Mon Apr 21 10:07:38 CEST 2003 root at sebastian.lupe-christoph.de:/usr/obj/usr/src/sys/SEBASTIAN i386


	
>Description:
	Node-specific part of Munin
	http://www.linpro.no/projects/munin/
	Munin is a tool for graphing all sorts of information about one or
	more servers and displaying it in a web interface. It uses the
	execellent RRDTool (written by Tobi Oetiker) and is written in Perl.
	Munin has a master/node architecture. The master connects to all
	the nodes at regular intervals, and asks them for data. It then
	stores the data in RRD-files, and (if needed) updates the graphs.
	One of the main goals have been ease of creating own "plugins"
	(graphs).

>How-To-Repeat:

>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	munin-node
#	munin-node/Makefile
#	munin-node/distinfo
#	munin-node/files
#	munin-node/files/munin-node.sh
#	munin-node/files/pkg-message
#	munin-node/files/patch-Makefile.config
#	munin-node/files/patch-munin-node.conf.in
#	munin-node/pkg-descr
#	munin-node/pkg-plist
#	munin-node/pkg-install
#	munin-node/pkg-deinstall
#	munin-node/pkg-message
#
echo c - munin-node
mkdir -p munin-node > /dev/null 2>&1
echo x - munin-node/Makefile
sed 's/^X//' >munin-node/Makefile << 'END-of-munin-node/Makefile'
X# New ports collection makefile for:	munin-node
X# Date created:				25 Januar 2004
X# Whom:					Lupe Christoph <lupe at lupe-christoph.de>
X#
X# $FreeBSD$
X#
X# $Log: Makefile,v $
X# Revision 1.3  2004/02/06 18:48:59  lupe
X# Update to pre3.
X#
X#
X
XPORTNAME=	munin
XPORTVERSION=	1.0.0.p3
XPORTREVISION=	1
XCATEGORIES=	sysutils perl5
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	munin
XPKGNAMESUFFIX=	-node
XDISTNAME=	munin_1.0.0pre3
X
XMAINTAINER=	lupe at lupe-christoph.de
XCOMMENT=	Node-specific part of Munin
X
X.include <bsd.port.pre.mk>
X
X#RUN_DEPENDS=	${SITE_PERL}/Net/Server/Fork.pm:${PORTSDIR}/net/p5-Net-Server \
X#		${SITE_PERL}/Config/General.pm:${PORTSDIR}/devel/p5-Config-General
XRUN_DEPENDS=	${SITE_PERL}/Net/Server/Fork.pm:${PORTSDIR}/net/p5-Net-Server
X.if ${PERL_LEVEL} < 500800
XRUN_DEPENDS+=	${SITE_PERL}/Net/Domain.pm:${PORTSDIR}/net/p5-Net
X.endif
XBUILD_DEPENDS=	${RUN_DEPENDS}
X
XUSE_GMAKE=	yes
XPATCH_STRIP=	-p1
XWRKSRC=		${WRKDIR}/munin-1.0.0pre3
XALL_TARGET=	DATADIR=${DATADIR} build build-man
XINSTALL_TARGET=	DATADIR=${DATADIR} install-node install-node-plugins
X
XMAN5=		munin-node.conf.5
XMAN8=		munin-node-configure.8 munin-node.8 munin-run.8
X
Xpre-install:
X	@${SED} 's@\$$(PREFIX)@${LOCALBASE}@g' ${FILESDIR}/pkg-message > ${PKGMESSAGE}
X	@PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL
X
Xpost-install:
X	@${SED} 's@%PREFIX%@${LOCALBASE}@g' ${FILESDIR}/munin-node.sh > ${PREFIX}/etc/rc.d/munin-node.sh
X	@${CHMOD} +x ${PREFIX}/etc/rc.d/munin-node.sh
X	@if [ ! -f ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf ]; then \
X		${INSTALL_DATA} ${WRKSRC}/plugins.conf ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf; \
X	fi
X	@${CAT} ${PKGMESSAGE}
X	@${INSTALL_MAN} -d ${PREFIX}/man/man5
X	@${INSTALL_MAN} -d ${PREFIX}/man/man8
X	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-node.conf.5 ${PREFIX}/man/man5
X	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-node-configure.8 ${PREFIX}/man/man8
X	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-node.8 ${PREFIX}/man/man8
X	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-run.8 ${PREFIX}/man/man8
X	@PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} POST-INSTALL
X	@${ECHO} ${DISTNAME} | ${SED} -e 's/munin_//' > ${PREFIX}/etc/munin/VERSION.node
X
X.include <bsd.port.post.mk>
END-of-munin-node/Makefile
echo x - munin-node/distinfo
sed 's/^X//' >munin-node/distinfo << 'END-of-munin-node/distinfo'
XMD5 (munin_1.0.0pre3.tar.gz) = f1aea51a61304b824dd61d7ad7808f6d
END-of-munin-node/distinfo
echo c - munin-node/files
mkdir -p munin-node/files > /dev/null 2>&1
echo x - munin-node/files/munin-node.sh
sed 's/^X//' >munin-node/files/munin-node.sh << 'END-of-munin-node/files/munin-node.sh'
X#!/bin/sh
X
XPROGRAM=%PREFIX%/sbin/munin-node
XCONFIG=%PREFIX%/etc/munin/munin-node.conf
X
Xcase "$1" in
X	start)
X		if [ -x $PROGRAM -a -f $CONFIG -a -d $PLUGINS ]; then
X			$PROGRAM --config $CONFIG && echo -n ' munin-node'
X		fi
X	;;
X
X	stop)
X		if [ -f $CONFIG ]; then
X			PIDFILE=`awk '$1 == "pid_file" { print $2 }' $CONFIG`
X			if [ -f $PIDFILE ]; then
X				/bin/kill `cat $PIDFILE` && echo -n ' munin-node'
X			fi
X		fi
X	;;
X	
X	*)
X		echo "Usage: `basename $0` { start | stop }"
X		exit 64
X	;;
Xesac
END-of-munin-node/files/munin-node.sh
echo x - munin-node/files/pkg-message
sed 's/^X//' >munin-node/files/pkg-message << 'END-of-munin-node/files/pkg-message'
X
X********************************************************************
XUnless this file already existed, a sample configuration file
Xhas been placed in $(PREFIX)/etc/munin/munin-node.conf.
X
XPlease edit it according to your needs.
X
XThe Munin client will be started at system boot automatically.
XYou can start it manually with:
X    $(PREFIX)/etc/rc.d/munin-node.sh start
X********************************************************************
X
END-of-munin-node/files/pkg-message
echo x - munin-node/files/patch-Makefile.config
sed 's/^X//' >munin-node/files/patch-Makefile.config << 'END-of-munin-node/files/patch-Makefile.config'
X--- munin-1.0.0pre3.orig/Makefile.config	Sun Feb  1 22:05:52 2004
X+++ munin-1.0.0pre3/Makefile.config	Sat Feb  7 12:48:23 2004
X@@ -7,42 +7,46 @@
X #
X # the base of the Munin installation.
X # 
X-PREFIX     = $(DESTDIR)/opt/munin
X+ifdef PREFIX
X+UPREFIX=$(PREFIX)
X+else
X+UPREFIX=/usr
X+endif
X 
X # Where Munin keeps its configurations (server.conf, client.conf, ++)
X-CONFDIR    = $(DESTDIR)/etc/opt/munin
X+CONFDIR    = $(PREFIX)/etc/munin
X 
X # Server only - where to put munin-cron
X-BINDIR     = $(PREFIX)/bin
X+BINDIR     = $(UPREFIX)/bin
X 
X # Client only - where to put munin-node, munin-node-configure, and munin-run
X-SBINDIR    = $(PREFIX)/sbin
X+SBINDIR    = $(UPREFIX)/sbin
X 
X # Where to put text and html documentation
X-DOCDIR     = $(PREFIX)/doc
X+DOCDIR     = $(UPREFIX)/doc
X 
X # Where to put man pages
X-MANDIR     = $(PREFIX)/man
X+MANDIR     = $(UPREFIX)/man
X 
X # Where to put internal binaries and plugin repository
X-LIBDIR     = $(PREFIX)/lib
X+LIBDIR     = ${DATADIR}
X 
X # Server only - Output directory
X-HTMLDIR    = $(PREFIX)/var/www
X+HTMLDIR    = $(PREFIX)/www/data/munin
X 
X # Client only - Where to put RRD files and other intenal data
X-DBDIR      = $(DESTDIR)/var/opt/munin
X+DBDIR      = $(PREFIX)/var/munin
X 
X # Client only - Where plugins should put their states. Must be writable by
X # group "munin", and should be preserved between reboots
X PLUGSTATE  = $(DBDIR)/plugin-state
X 
X # Where Munin should place its logs.
X-LOGDIR     = $(DESTDIR)/var/log/munin
X+LOGDIR     = /var/log
X 
X # Location of PID files and other statefiles. On the server, must be
X # writable by the user "munin".
X-STATEDIR   = $(DESTDIR)/var/run/munin
X+STATEDIR   = /var/run/munin
X 
X # The perl interpreter to use
X PERL       = $(shell which perl)
X@@ -65,9 +69,8 @@
X GROUP      = munin
X 
X # Which command to use to check if the USER and GROUP to run Munin as, exists.
X-GETENT = $(shell which getent || which true 2>/dev/null)
X-CHECKUSER  = $(shell $(GETENT) passwd $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
X-CHECKGROUP = $(shell $(GETENT) group $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))
X+CHECKUSER:= $(shell grep $(USER) /etc/passwd >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
X+CHECKGROUP:= $(shell grep $(GROUP) /etc/group >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))
X 
X CHOWN      = chown
X CHMOD      = chmod
END-of-munin-node/files/patch-Makefile.config
echo x - munin-node/files/patch-munin-node.conf.in
sed 's/^X//' >munin-node/files/patch-munin-node.conf.in << 'END-of-munin-node/files/patch-munin-node.conf.in'
X--- munin-1.0.0pre1.orig/node/munin-node.conf.in	Thu Jan 15 15:28:57 2004
X+++ munin-1.0.0pre1/node/munin-node.conf.in	Sun Jan 25 14:26:15 2004
X@@ -12,7 +12,7 @@
X # Which port to bind to;
X host *
X user root
X-group root
X+group wheel
X setsid yes
X 
X # Regexps for files to ignore
END-of-munin-node/files/patch-munin-node.conf.in
echo x - munin-node/pkg-descr
sed 's/^X//' >munin-node/pkg-descr << 'END-of-munin-node/pkg-descr'
XMunin network-wide graphing framework (node)
XWWW: http://www.linpro.no/projects/munin/
X
XMunin is a tool for graphing all sorts of information about one or more
Xservers and displaying it in a web interface. It uses the execellent
XRRDTool (written by Tobi Oetiker) and is written in Perl. Munin has a
Xmaster/node architecture. The master connects to all the nodes at regular
Xintervals, and asks them for data. It then stores the data in RRD-files,
Xand (if needed) updates the graphs. One of the main goals have been ease
Xof creating own "plugins" (graphs).
X
XThis is the node part. It is used on all machines Munin shall watch.
END-of-munin-node/pkg-descr
echo x - munin-node/pkg-plist
sed 's/^X//' >munin-node/pkg-plist << 'END-of-munin-node/pkg-plist'
Xetc/munin/munin-node.conf
Xetc/munin/plugin-conf.d/plugins.conf
Xetc/rc.d/munin-node.sh
Xshare/munin/plugins/apache_accesses
Xshare/munin/plugins/apache_processes
Xshare/munin/plugins/apache_volume
Xshare/munin/plugins/bind9
Xshare/munin/plugins/cpu
Xshare/munin/plugins/df
Xshare/munin/plugins/df_inode
Xshare/munin/plugins/exim_mailqueue
Xshare/munin/plugins/exim_mailstats
Xshare/munin/plugins/hddtemp
Xshare/munin/plugins/if_
Xshare/munin/plugins/if_errcoll_
Xshare/munin/plugins/ircu
Xshare/munin/plugins/load
Xshare/munin/plugins/mailman
Xshare/munin/plugins/memory
Xshare/munin/plugins/munin_graph
Xshare/munin/plugins/munin_update
Xshare/munin/plugins/mysql_bytes
Xshare/munin/plugins/mysql_isam_space_
Xshare/munin/plugins/mysql_queries
Xshare/munin/plugins/mysql_slowqueries
Xshare/munin/plugins/mysql_threads
Xshare/munin/plugins/named
Xshare/munin/plugins/netstat
Xshare/munin/plugins/open_files
Xshare/munin/plugins/plugins.history
Xshare/munin/plugins/pop_stats
Xshare/munin/plugins/postfix_mailqueue
Xshare/munin/plugins/postfix_mailstats
Xshare/munin/plugins/postfix_mailvolume
Xshare/munin/plugins/processes
Xshare/munin/plugins/ps_
Xshare/munin/plugins/psu_
Xshare/munin/plugins/samba
Xshare/munin/plugins/snmp__if_
Xshare/munin/plugins/spamstats
Xshare/munin/plugins/squid_cache
Xshare/munin/plugins/squid_icp
Xshare/munin/plugins/squid_requests
Xshare/munin/plugins/squid_traffic
Xshare/munin/plugins/surfboard
Xshare/munin/plugins/swap
Xshare/munin/plugins/sybase_space
Xshare/munin/plugins/vmstat
Xsbin/munin-node
Xsbin/munin-node-configure
Xsbin/munin-run
X at unexec rmdir %D/var/munin/plugin-state
X at unexec rmdir %D/var/munin
X at dirrm lib/plugins
X at unexec rmdir %D/etc/munin/plugins
X at unexec rmdir %D/etc/munin/plugin-conf.d
X at unexec rmdir %D/etc/munin
END-of-munin-node/pkg-plist
echo x - munin-node/pkg-install
sed 's/^X//' >munin-node/pkg-install << 'END-of-munin-node/pkg-install'
X#! /bin/sh
X#
X# $Log: pkg-install,v $
X# Revision 1.2  2004/02/06 18:49:58  lupe
X# Fixes for pkg_add compatibility.
X#
X#
X
Xask() {
X    local question default answer
X
X    question=$1
X    default=$2
X    if [ -z "${PACKAGE_BUILDING}" ]; then
X        read -p "${question} [${default}]? " answer
X    fi
X    if [ x${answer} = x ]; then
X        answer=${default}
X    fi
X    echo ${answer}
X}
X
Xyesno() {
X    local dflt question answer
X
X    question=$1
X    dflt=$2
X    while :; do
X        answer=$(ask "${question}" "${dflt}")
X        case "${answer}" in
X        [Yy]*)          return 0;;
X        [Nn]*)          return 1;;
X        esac
X        echo "Please answer yes or no."
X    done
X}
X
Xmake_group() {
X    local g
X
X    g=$1
X
X    if pw group show "${g}" >/dev/null 2>&1; then
X	echo "You already have a group \"${g}\", so I will use it."
X    else
X	echo "You need a group \"${g}\"."
X	if which -s pw && yesno "Would you like me to create it" y; then
X	    pw groupadd ${g} || exit
X	    echo "Done."
X	else
X	    echo "Please create it, and try again."
X	    if ! grep -q "^${u}:" /etc/passwd; then
X		echo "While you're at it, please create a user \"${u}\" too,"
X		echo "with a default group of \"${g}\"."
X	    fi
X	    exit 1
X	fi
X    fi
X}
X
Xinit_plugins() {
X    if [ -f ${PKG_PREFIX}/etc/munin/VERSION.node ]; then
X	prevver=$(cat ${PKG_PREFIX}/etc/munin/VERSION.node)
X    fi
X
X    mkdir -p ${PKG_PREFIX}/etc/munin/plugins ${PKG_PREFIX}/var/munin/plugin-state
X
X    if [ -n "$prevver" ]; then
X	echo -n "Initializing new plugins.."
X	${PKG_PREFIX}/sbin/munin-node-configure --shell --newer "${prevver%-*}" | sh -x
X    else
X	echo -n "Initializing plugins.."
X	${PKG_PREFIX}/sbin/munin-node-configure --shell | sh -x
X    fi
X    echo "done."
X}
X
X
X########################################################################
X
Xcase $2 in
X    PRE-INSTALL)
X	make_group munin
X	;;      
X    POST-INSTALL)
X	init_plugins
X	;;      
Xesac
END-of-munin-node/pkg-install
echo x - munin-node/pkg-deinstall
sed 's/^X//' >munin-node/pkg-deinstall << 'END-of-munin-node/pkg-deinstall'
X#! /bin/sh
X#
X# $Log: pkg-deinstall,v $
X# Revision 1.2  2004/02/06 18:49:58  lupe
X# Fixes for pkg_add compatibility.
X#
X#
X
Xask() {
X    local question default answer
X
X    question=$1
X    default=$2
X    if [ -z "${PACKAGE_BUILDING}" ]; then
X	read -p "${question} [${default}]? " answer
X    fi
X    if [ x${answer} = x ]; then
X	answer=${default}
X    fi
X    echo ${answer}
X}
X
Xyesno() {
X    local dflt question answer
X
X    question=$1
X    dflt=$2
X    while :; do
X	answer=$(ask "${question}" "${dflt}")
X	case "${answer}" in
X	[Yy]*)		return 0;;
X	[Nn]*)		return 1;;
X	esac
X	echo "Please answer yes or no."
X    done
X}
X
Xstop_process() {
X    if [ -x ${PKG_PREFIX}/etc/rc.d/munin-node.sh ]; then
X	${PKG_PREFIX}/etc/rc.d/munin-node.sh stop
X    fi
X}
X
Xdelete_group() {
X    local g
X
X    g=$1
X    if yesno "Do you want me to remove group \"${g}\"" y; then
X	pw groupdel -n ${g}
X	echo "Done."
X    fi
X}
X
Xcase $2 in
X    DEINSTALL)
X	stop_process
X	;;
X    POST-DEINSTALL)
X	delete_group munin
X	;;
Xesac
END-of-munin-node/pkg-deinstall
echo x - munin-node/pkg-message
sed 's/^X//' >munin-node/pkg-message << 'END-of-munin-node/pkg-message'
X
X********************************************************************
XUnless this file already existed, a sample configuration file
Xhas been placed in /usr/local/etc/munin/munin-node.conf.
X
XPlease edit it according to your needs.
X
XThe Munin client will be started at system boot automatically.
XYou can start it manually with:
X    /usr/local/etc/rc.d/munin-node.sh start
X********************************************************************
X
END-of-munin-node/pkg-message
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list