ports/62480: New port: sysutils/munin-main Collector part of Munin
Lupe Christoph
lupe at lupe-christoph.de
Sat Feb 7 15:30:26 UTC 2004
>Number: 62480
>Category: ports
>Synopsis: New port: sysutils/munin-main Collector 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:24 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:
Collector 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-main
# munin-main/Makefile
# munin-main/distinfo
# munin-main/files
# munin-main/files/pkg-message
# munin-main/files/patch-Makefile.config
# munin-main/pkg-descr
# munin-main/pkg-plist
# munin-main/pkg-install
# munin-main/pkg-deinstall
# munin-main/pkg-message
#
echo c - munin-main
mkdir -p munin-main > /dev/null 2>&1
echo x - munin-main/Makefile
sed 's/^X//' >munin-main/Makefile << 'END-of-munin-main/Makefile'
X# New ports collection makefile for: munin
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:40:21 lupe
X# Update to pre3.
X# Fixes for pkg_add compatibility.
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= -main
XDISTNAME= munin_1.0.0pre3
X
XMAINTAINER= lupe at lupe-christoph.de
XCOMMENT= Collector part of Munin
X
X.include <bsd.port.pre.mk>
X
XRUN_DEPENDS= ${SITE_PERL}/${PERL_ARCH}/RRDs.pm:${PORTSDIR}/net/rrdtool
XRUN_DEPENDS+= ${SITE_PERL}/Net/Domain.pm:${PORTSDIR}/net/p5-Net
XRUN_DEPENDS+= ${SITE_PERL}/HTML/Template.pm:${PORTSDIR}/www/p5-HTML-Template
X.if ${PERL_LEVEL} < 500700
XRUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Storable.pm:${PORTSDIR}/devel/p5-Storable
X.endif
X.if ${PERL_LEVEL} < 500701
XRUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Digest/MD5.pm:${PORTSDIR}/security/p5-Digest-MD5
X.endif
X.if ${PERL_LEVEL} < 500702
XRUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Time/HiRes.pm:${PORTSDIR}/devel/p5-Time-HiRes
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-main
X
XMAN5= munin.conf.5
XMAN8= munin-cron.8 munin-graph.8 munin-html.8 munin-nagios.8 munin-update.8
X
Xpre-install:
X @${SED} 's@\$$(PREFIX)@${PREFIX}@g' ${FILESDIR}/pkg-message > ${PKGMESSAGE}
X @PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL
X
Xpost-install:
X @${INSTALL_MAN} -d ${PREFIX}/man/man5
X @${INSTALL_MAN} -d ${PREFIX}/man/man8
X @${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin.conf.5 ${PREFIX}/man/man5
X @${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-cron.8 ${PREFIX}/man/man8
X @${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-graph.8 ${PREFIX}/man/man8
X @${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-html.8 ${PREFIX}/man/man8
X @${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-nagios.8 ${PREFIX}/man/man8
X @${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-update.8 ${PREFIX}/man/man8
X @PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} POST-INSTALL
X @${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.post.mk>
END-of-munin-main/Makefile
echo x - munin-main/distinfo
sed 's/^X//' >munin-main/distinfo << 'END-of-munin-main/distinfo'
XMD5 (munin_1.0.0pre3.tar.gz) = f1aea51a61304b824dd61d7ad7808f6d
END-of-munin-main/distinfo
echo c - munin-main/files
mkdir -p munin-main/files > /dev/null 2>&1
echo x - munin-main/files/pkg-message
sed 's/^X//' >munin-main/files/pkg-message << 'END-of-munin-main/files/pkg-message'
X
X********************************************************************
XUnless this file already existed, a sample configuration file
Xhas been placed in $(PREFIX)/etc/munin/munin.conf.
X
XPlease edit it according to your needs.
X
XThe Munin server will be run from cron under the user 'munin'.
X********************************************************************
X
END-of-munin-main/files/pkg-message
echo x - munin-main/files/patch-Makefile.config
sed 's/^X//' >munin-main/files/patch-Makefile.config << 'END-of-munin-main/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-main/files/patch-Makefile.config
echo x - munin-main/pkg-descr
sed 's/^X//' >munin-main/pkg-descr << 'END-of-munin-main/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 collector. It is installed on the machine that shall collect
Xand display perfromance data.
END-of-munin-main/pkg-descr
echo x - munin-main/pkg-plist
sed 's/^X//' >munin-main/pkg-plist << 'END-of-munin-main/pkg-plist'
Xbin/munin-cron
Xetc/munin/munin.conf
Xetc/munin/templates/logo.gif
Xetc/munin/templates/munin-domainview.tmpl
Xetc/munin/templates/munin-nodeview.tmpl
Xetc/munin/templates/munin-overview.tmpl
Xetc/munin/templates/munin-serviceview.tmpl
Xetc/munin/templates/style.css
Xshare/munin/munin-graph
Xshare/munin/munin-html
Xshare/munin/munin-nagios
Xshare/munin/munin-update
X at dirrm www/data/munin
X at dirrm var/munin/plugin-state
X at dirrm var/munin
X at dirrm etc/munin/templates
X at dirrm etc/munin
END-of-munin-main/pkg-plist
echo x - munin-main/pkg-install
sed 's/^X//' >munin-main/pkg-install << 'END-of-munin-main/pkg-install'
X#! /bin/sh
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_account() {
X local u g gcos
X
X u=$1
X g=$2
X gcos=$3
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 if pw user show "${u}" >/dev/null 2>&1; then
X echo "You already have a user \"${u}\", so I will use it."
X else
X echo "You need a user \"${u}\"."
X if which -s pw && yesno "Would you like me to create it" y; then
X pw useradd ${u} -g ${g} -h - \
X -s /bin/sh -c "${gcos}" || exit
X echo "Done."
X else
X echo "Please create it, and try again."
X exit 1
X fi
X fi
X}
X
Xmake_directories() {
X for dir in ${PKG_PREFIX}/www/data/munin \
X ${PKG_PREFIX}/var/munin \
X /var/run/munin; do
X mkdir -p $dir
X chown munin $dir
X done
X}
X
Xcreate_crontab_entries() {
X local b e
X b=$1
X e=$2
X
X if [ crontab -u munin -l > /dev/null 2>&1 ]; then
X TMPFILE=`mktemp -t munin` || exit 1
X sed -n -e "/^$b\$/,/^$e\$/p" > $TMPFILE
X crontab -u munin -l | sed -e '/^#BEGIN_MUNIN$/,/^#END_MUNIN$/d' | \
X cat - $TMPFILE | crontab -u munin -
X rm $TMPFILE
X else
X crontab -u munin -
X fi
X}
X
X
X########################################################################
X
Xcase $2 in
X PRE-INSTALL)
X make_account munin munin "Munin owner"
X make_directories
X ;;
X POST-INSTALL)
X create_crontab_entries '#BEGIN_MUNIN' '#END_MUNIN' <<EOT
X#
X# cron-jobs for munin
X#
X
X#BEGIN_MUNIN
XMAILTO=root
X
X*/5 * * * * ${PKG_PREFIX}/bin/munin-cron
X10 10 * * * ${PKG_PREFIX}/lib/munin-nagios --removeok
X#END_MUNIN
XEOT
X ;;
Xesac
END-of-munin-main/pkg-install
echo x - munin-main/pkg-deinstall
sed 's/^X//' >munin-main/pkg-deinstall << 'END-of-munin-main/pkg-deinstall'
X#! /bin/sh
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
Xdelete_account() {
X local u g home
X
X u=$1
X g=$2
X if yesno "Do you want me to remove group \"${g}\"" y; then
X pw groupdel -n ${g}
X echo "Done."
X fi
X if yesno "Do you want me to remove user \"${u}\"" y; then
X eval home=~${u}
X pw userdel -n ${u} -r
X echo "Done."
X if [ -d "${home}" ]; then
X echo "Please remember to remove the home directory \"${home}\""
X fi
X fi
X}
X
Xdelete_crontab_entries() {
X local b e
X b=$1
X e=$2
X
X TMPFILE=`mktemp -t munin` || exit 1
X crontab -u munin -l | sed -e "/^$b\$/,/^$e\$/d" -e '/^[ ]*#/d' -e '/^$/d' > $TMPFILE
X if [ -s $TMPFILE ]; then
X crontab -u munin -l | sed -e "/^$b\$/,/^$e\$/d" | crontab -u munin -
X echo "The crontab for user munin had manually created entries."
X echo "Only the automatically created entries have been removed."
X echo "These are the remaining lines:"
X crontab -u munin -l
X else
X crontab -u munin -r
X echo "crontab for user munin removed"
X fi
X rm $TMPFILE
X}
X
Xcase $2 in
X DEINSTALL)
X delete_crontab_entries '#BEGIN_MUNIN' '#END_MUNIN'
X ;;
X POST-DEINSTALL)
X delete_account munin munin
X ;;
Xesac
END-of-munin-main/pkg-deinstall
echo x - munin-main/pkg-message
sed 's/^X//' >munin-main/pkg-message << 'END-of-munin-main/pkg-message'
X
X********************************************************************
XUnless this file already existed, a sample configuration file
Xhas been placed in /usr/local/etc/munin/munin.conf.
X
XPlease edit it according to your needs.
X
XThe Munin server will be run from cron under the user 'munin'.
X********************************************************************
X
END-of-munin-main/pkg-message
exit
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list