[Midnightbsd-cvs] mports: mports/sysutils: Add munin-main.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat May 10 01:03:05 EDT 2008
Log Message:
-----------
Add munin-main. Based on FreeBSD port.
Modified Files:
--------------
mports/sysutils:
Makefile (r1.65 -> r1.66)
Added Files:
-----------
mports/sysutils/munin-main:
Makefile (r1.1)
distinfo (r1.1)
pkg-deinstall (r1.1)
pkg-descr (r1.1)
pkg-install (r1.1)
pkg-plist (r1.1)
mports/sysutils/munin-main/files:
patch-Makefile (r1.1)
patch-Makefile.config (r1.1)
pkg-message.in (r1.1)
-------------- next part --------------
--- /dev/null
+++ sysutils/munin-main/pkg-install
@@ -0,0 +1,127 @@
+#! /bin/sh
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ if [ x${answer} = x ]; then
+ answer=${default}
+ fi
+ echo ${answer}
+}
+
+yesno() {
+ local dflt question answer
+
+ question=$1
+ dflt=$2
+ while :; do
+ answer=$(ask "${question}" "${dflt}")
+ case "${answer}" in
+ [Yy]*) return 0;;
+ [Nn]*) return 1;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+make_account() {
+ local u g gcos
+
+ u=$1
+ g=$2
+ gcos=$3
+
+ if pw group show "${g}" >/dev/null 2>&1; then
+ echo "You already have a group \"${g}\", so I will use it."
+ else
+ echo "You need a group \"${g}\"."
+ if which -s pw && yesno "Would you like me to create it" y; then
+ pw groupadd ${g} || exit
+ echo "Done."
+ else
+ echo "Please create it, and try again."
+ if ! /usr/sbin/pw user show ${u} >/dev/null 2>/dev/null; then
+ echo "While you're at it, please create a user \"${u}\" too,"
+ echo "with a default group of \"${g}\"."
+ fi
+ exit 1
+ fi
+ fi
+
+ if pw user show "${u}" >/dev/null 2>&1; then
+ echo "You already have a user \"${u}\", so I will use it."
+ else
+ echo "You need a user \"${u}\"."
+ if which -s pw && yesno "Would you like me to create it" y; then
+ pw useradd ${u} -g ${g} -h - \
+ -s /bin/sh -c "${gcos}" || exit
+ echo "Done."
+ else
+ echo "Please create it, and try again."
+ exit 1
+ fi
+ fi
+}
+
+create_crontab_entries() {
+ local b e
+ 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
+ else
+ crontab -u munin -
+ fi
+}
+
+mklogdir() {
+}
+
+newsyslog() {
+ if fgrep -q '/var/log/munin-main/*' /etc/newsyslog.conf; then
+ :
+ else
+ cat >> /etc/newsyslog.conf <<EOT
+/var/log/munin-main/*.log munin:munin 644 7 * @T00 GNWZ
+EOT
+ fi
+}
+
+move_www_dir() {
+ 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
+}
+
+
+########################################################################
+
+case $2 in
+ PRE-INSTALL)
+ make_account munin munin "Munin owner"
+ 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
+#BEGIN_MUNIN_MAIN
+MAILTO=root
+
+*/5 * * * * ${PKG_PREFIX}/bin/munin-cron
+#END_MUNIN_MAIN
+EOT
+ fi
+ ;;
+esac
--- /dev/null
+++ sysutils/munin-main/pkg-descr
@@ -0,0 +1,14 @@
+Munin network-wide graphing framework (node)
+
+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 excellent
+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).
+
+This is the collector. It is installed on the machine that shall collect
+and display performance data.
+
+WWW: http://www.linpro.no/projects/munin/
--- /dev/null
+++ sysutils/munin-main/pkg-plist
@@ -0,0 +1,54 @@
+ at exec mkdir -p /var/run/munin && chown munin:munin /var/run/munin
+ at exec mkdir -p /var/log/munin-main && chown munin:munin /var/log/munin-main
+ at exec mkdir -p %D/www/munin && chown munin:munin %D/www/munin
+ at exec mkdir -p %D/var/munin && chown munin:munin %D/var/munin
+bin/munin-cron
+ at unexec if cmp -s %D/etc/munin/munin.conf.sample %D/etc/munin/munin.conf; then rm -f %D/etc/munin/munin.conf; fi
+etc/munin/munin.conf.sample
+etc/munin/templates/definitions.html
+ at unexec if cmp -s %D/etc/munin/templates/logo.png %D/www/munin/logo.png; then rm -f %D/www/munin/logo.png; fi
+etc/munin/templates/logo.png
+etc/munin/templates/munin-comparison-day.tmpl
+etc/munin/templates/munin-comparison-month.tmpl
+etc/munin/templates/munin-comparison-week.tmpl
+etc/munin/templates/munin-comparison-year.tmpl
+etc/munin/templates/munin-domainview.tmpl
+etc/munin/templates/munin-nodeview.tmpl
+etc/munin/templates/munin-overview.tmpl
+etc/munin/templates/munin-serviceview.tmpl
+ at unexec if cmp -s %D/etc/munin/templates/style.css %D/www/munin/style.css; then rm -f %D/www/munin/style.css; fi
+etc/munin/templates/style.css
+%%SITE_PERL%%/Munin.pm
+%%DATADIR%%/VeraMono.ttf
+%%DATADIR%%/munin-graph
+%%DATADIR%%/munin-html
+%%DATADIR%%/munin-limits
+%%DATADIR%%/munin-update
+www/cgi-bin/munin-cgi-graph
+ at unexec rm -f /var/run/munin/munin-*.lock
+ at dirrmtry /var/run/munin
+ at dirrmtry /var/log/munin-main
+ at dirrmtry www/munin
+ at dirrmtry www/cgi-bin
+ at dirrmtry var/munin
+ at dirrmtry %%DATADIR%%
+ at dirrmtry etc/munin/templates
+ at dirrmtry etc/munin
+ at unexec echo
+ at unexec echo '********************************************************************'
+ at unexec echo "If you want to *completely* remove munin-main, you have to"
+ at unexec echo
+ at unexec if [ -d %D/www/munin ]; then echo " rm -rf %D/www/munin \\"; fi
+ at unexec if [ -d %D/var/munin ]; then ls -d %D/var/munin/* | grep -v plugin-state | fmt -40 | sed -e 's/^/ /' -e 's/$/ \\/'; fi
+ at unexec if [ -f %D/etc/munin/munin.conf ]; then echo " %D/etc/munin/munin.conf \\"; fi
+ at unexec if [ -d %D/etc/munin/templates ]; then echo " %D/etc/munin/templates \\"; fi
+ at unexec echo " /var/log/munin-main"
+ at unexec echo
+ at unexec echo "If you have already deinstalled munin-node, you can also"
+ at unexec echo
+ at unexec echo " rmdir %D/etc/munin %D/var/munin"
+ at unexec echo
+ at unexec echo "These files and directories have to be left on the system because"
+ at unexec echo "you may be performing an update. This process can't tell."
+ at unexec echo '********************************************************************'
+ at unexec echo
--- /dev/null
+++ sysutils/munin-main/pkg-deinstall
@@ -0,0 +1,118 @@
+#! /bin/sh
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ if [ x${answer} = x ]; then
+ answer=${default}
+ fi
+ echo ${answer}
+}
+
+yesno() {
+ local dflt question answer
+
+ question=$1
+ dflt=$2
+ while :; do
+ answer=$(ask "${question}" "${dflt}")
+ case "${answer}" in
+ [Yy]*) return 0;;
+ [Nn]*) return 1;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+delete_account() {
+ local u g home
+
+ u=$1
+ g=$2
+ if pw group show ${g} > /dev/null 2>&1; then
+ if yesno "Do you want me to remove group \"${g}\"" y; then
+ pw group del -n ${g}
+ echo "Done."
+ else
+ GID=`pw group show ${g} | awk -F: '{ print $3 }'`
+ fi
+ fi
+ if pw user show ${u} > /dev/null 2>&1; then
+ if yesno "Do you want me to remove user \"${u}\"" y; then
+ eval home=~${u}
+ pw user del -n ${u} -r
+ echo "Done."
+ if [ -d "${home}" ]; then
+ echo "Please remember to remove the home directory \"${home}\""
+ fi
+
+ # pw user del may have removed the group, too.
+ # Put it back if the admin asked us to retain it.
+ if [ -n "$GID" ]; then
+ pw group show ${g} > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ pw group add ${g}
+ fi
+ fi
+ fi
+ fi
+}
+
+delete_crontab_entries() {
+ local b e
+ b=$1
+ e=$2
+
+ TMPFILE=`mktemp -t munin` || exit 1
+ crontab -u munin -l | sed -e "/^$b\$/,/^$e\$/d" -e '/^[ ]*#/d' -e '/^$/d' > $TMPFILE
+ 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."
+ echo "These are the remaining lines:"
+ crontab -u munin -l
+ else
+ echo y | crontab -u munin -r
+ echo "crontab for user munin removed"
+ fi
+ rm $TMPFILE
+}
+
+delnewsyslog() {
+ tmp="/etc/#munin-node$$"
+ sed -e '/^\/var\/log\/munin-main\/\*\.log[ ]/d' /etc/newsyslog.conf >${tmp}
+ cat ${tmp} > /etc/newsyslog.conf
+ rm ${tmp}
+}
+
+newsyslog() {
+ ENTRY=`fgrep '/var/log/munin-main/*' /etc/newsyslog.conf`
+ DEFAULT='/var/log/munin-main/*.log munin:munin 644 7 * @T00 GNWZ'
+ if [ -z "$ENTRY" ]; then
+ exit 0
+ elif [ "$ENTRY" = "$DEFAULT" ]; then
+ delnewsyslog
+ elif yesno "You have changed the default munin-main entry in \"/etc/newsyslog.conf\".
+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
+ fi
+ ;;
+ POST-DEINSTALL)
+ delete_account munin munin
+ ;;
+esac
--- /dev/null
+++ sysutils/munin-main/Makefile
@@ -0,0 +1,54 @@
+# New ports collection makefile for: munin-main
+# Date created: May 9 2008
+# Whom: Lucas Holt <luke at midnightbsd.org>
+#
+# $MidnightBSD: mports/sysutils/munin-main/Makefile,v 1.1 2008/05/10 05:03:02 laffer1 Exp $
+#
+
+PORTNAME= munin
+PORTVERSION= 1.2.5
+CATEGORIES= sysutils perl5
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= munin
+PKGNAMESUFFIX= -main
+DISTNAME= ${PORTNAME}_${PORTVERSION:S/.r/rc/}
+
+MAINTAINER= ports at MidnightBSD.org
+COMMENT= Collector part of Munin
+LICENSE= gpl2
+
+USE_PERL5= yes
+
+RUN_DEPENDS= ${SITE_PERL}/${PERL_ARCH}/RRDs.pm:${PORTSDIR}/databases/rrdtool \
+ ${SITE_PERL}/Net/Domain.pm:${PORTSDIR}/net/p5-Net \
+ ${SITE_PERL}/HTML/Template.pm:${PORTSDIR}/www/p5-HTML-Template \
+ ${SITE_PERL}/Date/Manip.pm:${PORTSDIR}/devel/p5-Date-Manip
+BUILD_DEPENDS= ${RUN_DEPENDS}
+
+.include <bsd.port.pre.mk>
+
+USE_GMAKE= yes
+PATCH_STRIP= -p1
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:S/.r/rc/}
+PKGMESSAGE= ${WRKDIR}/pkg-message
+ALL_TARGET= DATADIR=${DATADIR} PERL=${PERL} build build-man
+INSTALL_TARGET= DATADIR=${FAKE_DESTDIR}/${DATADIR} PERL=${PERL} SITE_PERL_REL=$(SITE_PERL_REL) install-main
+
+MAN5= munin.conf.5
+MAN8= munin-cron.8 munin-graph.8 munin-html.8 munin-limits.8 munin-update.8
+
+SUB_FILES=pkg-message
+
+post-install:
+ @${INSTALL_DATA} ${WRKSRC}/build/server/munin.conf ${PREFIX}/etc/munin/munin.conf.sample
+ @for man in ${MAN5}; do \
+ ${INSTALL_MAN} -C ${WRKSRC}/build/doc/$$man ${PREFIX}/man/man5; \
+ done
+ @for man in ${MAN8}; do \
+ ${INSTALL_MAN} -C ${WRKSRC}/build/doc/$$man ${PREFIX}/man/man8; \
+ done
+ @DATADIR=${DATADIR} PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} POST-INSTALL
+ @${CHOWN} munin /var/log/munin-main
+ @${CHGRP} munin /var/run/munin /var/log/munin-main ${PREFIX}/www/munin ${PREFIX}/var/munin
+
+.include <bsd.port.post.mk>
--- /dev/null
+++ sysutils/munin-main/distinfo
@@ -0,0 +1,3 @@
+MD5 (munin_1.2.5.tar.gz) = e863d11693c02bde1c593a6c701e64fd
+SHA256 (munin_1.2.5.tar.gz) = 2d1ea4aa3f0eaf11a5beb0b90f9bbee63e184249e06274fcc9d4c17b70b47a5e
+SIZE (munin_1.2.5.tar.gz) = 353005
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/sysutils/Makefile,v
retrieving revision 1.65
retrieving revision 1.66
diff -L sysutils/Makefile -L sysutils/Makefile -u -r1.65 -r1.66
--- sysutils/Makefile
+++ sysutils/Makefile
@@ -45,6 +45,7 @@
SUBDIR += memtest
SUBDIR += memtest86
SUBDIR += mixer
+ SUBDIR += munin-main
SUBDIR += munin-node
SUBDIR += nautilus-cd-burner
SUBDIR += nodebrain
--- /dev/null
+++ sysutils/munin-main/files/patch-Makefile
@@ -0,0 +1,11 @@
+--- Makefile.orig Tue May 11 22:23:06 2004
++++ Makefile Fri Jun 4 00:25:54 2004
+@@ -26,7 +26,7 @@
+ mkdir -p $(HTMLDIR)
+ mkdir -p $(DBDIR)
+
+- $(CHOWN) $(USER) $(LOGDIR) $(STATEDIR) $(RUNDIR) $(HTMLDIR) $(DBDIR)
++ $(CHOWN) $(USER) $(STATEDIR) $(RUNDIR) $(HTMLDIR) $(DBDIR)
+
+ for p in server/*.tmpl; do \
+ $(INSTALL) -m 0644 "$$p" $(CONFDIR)/templates/ ; \
--- /dev/null
+++ sysutils/munin-main/files/pkg-message.in
@@ -0,0 +1,6 @@
+Unless this file already existed, a sample configuration file
+has been placed in %%PREFIX%%/etc/munin/munin.conf.
+
+Please edit it according to your needs.
+
+The Munin server will be run from cron under the user 'munin'.
--- /dev/null
+++ sysutils/munin-main/files/patch-Makefile.config
@@ -0,0 +1,85 @@
+--- munin-1.2.5.orig/Makefile.config Tue Oct 17 14:27:35 2006
++++ munin-1.2.5/Makefile.config Thu Nov 2 12:09:09 2006
+@@ -7,52 +7,56 @@
+ #
+ # the base of the Munin installation.
+ #
+-PREFIX = $(DESTDIR)/opt/munin
++ifdef PREFIX
++UPREFIX=$(PREFIX)
++else
++UPREFIX=/usr
++endif
+
+ # Where Munin keeps its configurations (server.conf, client.conf, ++)
+-CONFDIR = $(DESTDIR)/etc/opt/munin
++CONFDIR = $(PREFIX)/etc/munin
+
+ # Server only - where to put munin-cron
+-BINDIR = $(PREFIX)/bin
++BINDIR = $(UPREFIX)/bin
+
+ # Client only - where to put munin-node, munin-node-configure, and munin-run
+-SBINDIR = $(PREFIX)/sbin
++SBINDIR = $(UPREFIX)/sbin
+
+ # Where to put text and html documentation
+-DOCDIR = $(PREFIX)/doc
++DOCDIR = $(UPREFIX)/doc
+
+ # Where to put man pages
+-MANDIR = $(PREFIX)/man
++MANDIR = $(UPREFIX)/man
+
+ # Where to put internal binaries and plugin repository
+-LIBDIR = $(PREFIX)/lib
++LIBDIR = $(DATADIR)
+
+ # Server only - Output directory
+-HTMLDIR = $(PREFIX)/var/www
+-CGIDIR = $(HTMLDIR)/cgi
++HTMLDIR = $(PREFIX)/www/munin
++CGIDIR = $(PREFIX)/www/cgi-bin
+
+ # Client only - Where to put RRD files and other intenal data
+-DBDIR = $(DESTDIR)/var/opt/munin
++DBDIR = $(PREFIX)/var/munin
+
+ # Client only - Where plugins should put their states. Must be writable by
+ # group "munin", and should be preserved between reboots
+ PLUGSTATE = $(DBDIR)/plugin-state
+
+ # Where Munin should place its logs.
+-LOGDIR = $(DESTDIR)/var/log/munin
++LOGDIR = /var/log/munin-main
+
+ # Location of PID files and other statefiles. On the server, must be
+ # writable by the user "munin".
+-STATEDIR = $(DESTDIR)/var/run/munin
++STATEDIR = /var/run/munin
+
+ # The perl interpreter to use
+-PERL = $(shell which perl)
++# Passed in from FreeBSD port Makefile.
+
+ # The python interpreter to use (used by some plugins)
+ PYTHON = /usr/bin/env python
+
+ # Server only - Where to install the perl libraries
+-PERLLIB = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d= -f2 | sed "s/[\';]//g")
++PERLLIB = $(PREFIX)/$(SITE_PERL_REL)
+
+ # Client only - Install plugins for this architecture
+ OSTYPE = $(shell uname | tr '[A-Z]' '[a-z]')
+@@ -77,9 +81,8 @@
+ PLUGINUSER = nobody
+
+ # Which command to use to check if the USER and GROUP to run Munin as, exists.
+-GETENT = $(shell which getent || which true 2>/dev/null)
+-CHECKUSER = $(shell $(GETENT) passwd $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
+-CHECKGROUP = $(shell $(GETENT) group $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))
++CHECKUSER:= $(shell /usr/sbin/pw user show $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
++CHECKGROUP:= $(shell /usr/sbin/pw group show $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))
+
+ CHOWN = chown
+ CHMOD = chmod
More information about the Midnightbsd-cvs
mailing list