Subject: [alpine-aports] [PATCH] testing/munin: new aport

From: Stefan Wagner <[email-masked]>
Date: Fri, 15 Apr 2016 13:11:03 +0200

A distributed monitoring/graphing tool
http://munin-monitoring.org/
---
 testing/munin/APKBUILD               |  77 ++++++++++++++++++++
 testing/munin/munin-config.patch     | 131 +++++++++++++++++++++++++++++++++++
 testing/munin/munin-node.initd       |  22 ++++++
 testing/munin/munin-node.logrotate   |   8 +++
 testing/munin/munin-node.pre-install |  10 +++
 testing/munin/munin.cron.d           |   9 +++
 testing/munin/munin.logrotate        |  12 ++++
 7 files changed, 269 insertions(+)
 create mode 100644 testing/munin/APKBUILD
 create mode 100644 testing/munin/munin-config.patch
 create mode 100644 testing/munin/munin-node.initd
 create mode 100644 testing/munin/munin-node.logrotate
 create mode 100644 testing/munin/munin-node.pre-install
 create mode 100644 testing/munin/munin.cron.d
 create mode 100644 testing/munin/munin.logrotate

diff --git a/testing/munin/APKBUILD b/testing/munin/APKBUILD
new file mode 100644
index 0000000..b551d8d
--- /dev/null
+++ b/testing/munin/APKBUILD
@@ -0,0 +1,77 @@
+# Contributor: Stefan Wagner <[email-masked]>
+# Maintainer: Stefan Wagner <[email-masked]>
+pkgname=munin
+pkgver=2.0.25
+pkgrel=0
+pkgdesc="A distributed monitoring/graphing tool"
+url="http://munin-monitoring.org/"
+arch="noarch"
+license="GPL"
+perl_modules="perl-rrd perl-net-snmp perl-log-log4perl perl-html-template
+	perl-net-ssleay perl-net-server perl-date-manip perl-io-socket-inet6
+	perl-file-copy-recursive perl-fcgi perl-uri"
+depends="$pkgname-node"
+makedepends="bash rrdtool perl perl-module-build $perl_modules"
+pkgusers=munin
+pkggroups=munin
+subpackages="$pkgname-node"
+source="http://downloads.munin-monitoring.org/munin/stable/$pkgver/$pkgname-$pkgver.tar.gz
+	munin-config.patch
+	munin.cron.d
+	munin-node.initd
+	munin.logrotate
+	munin-node.logrotate"
+
+builddir="$srcdir/$pkgname-$pkgver"
+build() {
+	cd "$builddir"
+	make -j1
+}
+
+package() {
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install-master-prime || return 1
+	rm -rf "$pkgdir"/usr/share/man
+
+	install -m644 -D "$srcdir"/munin.cron.d \
+		"$pkgdir"/etc/munin/munin.cron.sample || return 1
+	install -m644 -D "$srcdir"/munin.logrotate \
+		"$pkgdir"/etc/logrotate.d/munin || return 1
+
+	install -d -o $pkgusers -g $pkggroups "$pkgdir"/usr/share/webapps/munin/html
+}
+
+node() {
+	depends="bash rrdtool perl $perl_modules"
+	install="$subpkgname.pre-install"
+
+	mkdir -p "$subpkgdir"
+
+	cd "$builddir"
+	make DESTDIR="$subpkgdir" install-common-prime install-node-prime install-plugins-prime || return 1
+	rm -rf "$subpkgdir"/usr/share/man
+
+	install -m644 -D "$srcdir"/munin-node.logrotate \
+		"$pkgdir"/etc/logrotate.d/munin-node || return 1
+	install -m755 -D "$srcdir"/"$subpkgname".initd \
+		"$subpkgdir"/etc/init.d/"$subpkgname"
+}
+
+md5sums="b418a667ce42665557329a7ac3bd1b93  munin-2.0.25.tar.gz
+4fce4fdc2d1c9d5f3f1d9b77afad6027  munin-config.patch
+b474180bc97e870be7a80d1824fe1ceb  munin.cron.d
+a1bcfd3b2f696b2e56eff81fae5049d8  munin-node.initd
+90ec26232e622fe3c708b519543bd937  munin.logrotate
+f75f125ee68eb60347eb8d57c616eaa1  munin-node.logrotate"
+sha256sums="6832bc5839d03639e4309178d9370697fc8a80a83d9b6653953f40161e949694  munin-2.0.25.tar.gz
+ceec0ba906ffaaa97621bf11c537cca594c96e8f9c86f2aa254b55ca57546b97  munin-config.patch
+f388434231dfd645be85654ac35a09315feac2f923e297f2aa8c11392e2ae4dc  munin.cron.d
+59269b33d23813969f7e9700cb3bb60c687fb502fcfed1ce23985e8b673d9da9  munin-node.initd
+691b40eff51dafac2a5bef5a9c858f25dcb33e3633196ebfcc13353f203689d7  munin.logrotate
+8d1d05ff21328f008acba361d2776651bd2cff44229f7ec570f03c525c9b6d46  munin-node.logrotate"
+sha512sums="a29563cfef26b05237b3813b44b5582563f2f75477ae3c076540cfb4f3e83f89193bd05fd7eae208d9d1bae58aff75977cc2c5f4de81225f0cbb2ba2c41effa9  munin-2.0.25.tar.gz
+a1c691a4c5d7d2619ea6d2605c71a23eeaa65f9cf533477524927bc3244371e271a4dadf24e71d6630f3ea8d6ad56f26bed83330a22ff0573e67c5cafe66cf17  munin-config.patch
+194b742b2ff8312c4c42a8a77d1d9a80bc53ced2343248c36f4229b0b0d366e898487fb5e415f1f5ccea7210a7a86e25de5e45193dbb5d26d2d6a195f0597642  munin.cron.d
+4b2a49a7bcb64eef65eee3b77ce86ca2cd8afef681922fdb830cb382f334c07356576f1151f4423f066ba8ac1c2d9a51cf9ff3d4dd4b18a5c1e2c95abcd9a940  munin-node.initd
+0f4768033f63103cb41b3f3869ebe378098f85409a909afa311a49587cb6afcffe2b2199821cd41a08f41bbeba3d37121561406978960e3345fbccfd230040e6  munin.logrotate
+34cdc04e83067d2fc839efaf06d96da892d76b77555a4b7b633f9a88fb86dc5f4413fe7a4f6c540e95724b23e8a4ad0ff37f521d44046bfcf18cb0428b94e6e2  munin-node.logrotate"
diff --git a/testing/munin/munin-config.patch b/testing/munin/munin-config.patch
new file mode 100644
index 0000000..cae8ec3
--- /dev/null
+++ b/testing/munin/munin-config.patch
@@ -0,0 +1,131 @@
+diff -ur munin-2.0.25.orig/Makefile.config munin-2.0.25/Makefile.config
+--- munin-2.0.25.orig/Makefile.config	2014-11-24 22:46:24.000000000 +0100
++++ munin-2.0.25/Makefile.config	2016-04-14 00:32:53.547838027 +0200
+@@ -17,35 +17,35 @@
+ #
+ # the base of the Munin installation.
+ #
+-PREFIX     = $(DESTDIR)/opt/munin
++PREFIX     = $(DESTDIR)
+ 
+ # Where Munin keeps its configurations (server.conf, client.conf, ++)
+-CONFDIR    = $(DESTDIR)/etc/opt/munin
++CONFDIR    = $(DESTDIR)/etc/munin
+ 
+ # Server only - where to put munin-cron
+-BINDIR     = $(PREFIX)/bin
++BINDIR     = $(PREFIX)/usr/bin
+ 
+ # Client only - where to put munin-node, munin-node-configure, and munin-run
+-SBINDIR    = $(PREFIX)/sbin
++SBINDIR    = $(PREFIX)/usr/sbin
+ 
+ # Where to put text and html documentation
+-DOCDIR     = $(PREFIX)/doc
++DOCDIR     = $(PREFIX)/usr/share/doc/munin
+ 
+ # Where to put man pages
+-MANDIR     = $(PREFIX)/man
++MANDIR     = $(PREFIX)/usr/share/man
+ 
+ # Where to put internal binaries and plugin repository
+-LIBDIR     = $(PREFIX)/lib
++LIBDIR     = $(PREFIX)/usr/lib/munin
+ 
+ # Server only - Output directory
+-HTMLDIR    = $(PREFIX)/www/docs
+-CGIDIR     = $(PREFIX)/www/cgi
++HTMLDIR    = $(PREFIX)/usr/share/webapps/munin/html
++CGIDIR     = $(PREFIX)/usr/share/webapps/munin/cgi
+ 
+ # Where to put internal data for master (RRD, internal files, ...)
+-DBDIR      = $(DESTDIR)/var/opt/munin
++DBDIR      = $(DESTDIR)/var/lib/munin
+ 
+ # Where to put internal data for node (plugin state, ...)
+-DBDIRNODE  = $(DESTDIR)/var/opt/munin-node
++DBDIRNODE  = $(DESTDIR)/var/lib/munin-node
+ 
+ # Client only - Where the spool files are written. Must be writable by
+ # group "munin", and should be preserved between reboots
+@@ -56,17 +56,17 @@
+ PLUGSTATE  = $(DBDIRNODE)/plugin-state
+ 
+ # Where Munin should place its logs.
+-LOGDIR     = $(PREFIX)/log/munin
++LOGDIR     = $(PREFIX)/var/log/munin
+ 
+ # Location of PID files and other statefiles. On the server, must be
+ # writable by the user "munin".
+-STATEDIR   = $(DESTDIR)/var/run/munin
++STATEDIR   = $(DESTDIR)/run/munin
+ 
+ # The perl interpreter to use
+-PERL       := $(shell which perl)
++PERL       := /usr/bin/perl
+ 
+ # The python interpreter to use (used by some plugins)
+-PYTHON     := /usr/bin/env python
++PYTHON     := /usr/bin/env python2
+ 
+ # The ruby interpreter to use (used by some plugins)
+ RUBY       := /usr/bin/env ruby
+@@ -89,13 +89,13 @@
+ # 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 2>/dev/null || echo $(PATH)` LANG=C sh -c 'type sh | sed "s/.* //"')
++GOODSH     := /bin/sh
+ 
+ # Path of bash for bash specific plugins
+ BASH       := /bin/bash
+ 
+ # Server only - Where to install the perl libraries
+-PERLSITELIB := $(shell $(PERL) -V:sitelib | cut -d"'" -f2)
++PERLSITELIB := $(shell $(PERL) -V:vendorlib | cut -d"'" -f2)
+ PERLLIB    = $(DESTDIR)$(PERLSITELIB)
+ 
+ # Client only - Install plugins for this architecture
+@@ -106,7 +106,7 @@
+ 
+ # How to figure out the hostname. (Only used in default configuration
+ # files)
+-HOSTNAME   := $(shell hostname)
++HOSTNAME   := localhost
+ 
+ # What is the safest way to create a tempfile.
+ # Default is to figure it out by testing various methods.
+@@ -129,9 +129,9 @@
+ # Which command to use to check if the USER and GROUP to run Munin as, exists.
+ # These will work on most modern OSes:
+ #
+-GETENT     := $(shell which getent || which true 2>/dev/null)
+-CHECKUSER  := $(shell $(GETENT) passwd $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
+-CHECKGROUP := $(shell $(GETENT) group $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2"))
++GETENT     := /bin/true
++CHECKUSER  := /bin/true
++CHECKGROUP := /bin/true
+ 
+ # For OSX, comment out the previous two lines and comment in these
+ #
+@@ -153,9 +153,9 @@
+ #CHECKUSER  := $(shell id $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2"))
+ #CHECKGROUP := $(shell grep ^$(GROUP): /etc/group >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2"))
+ 
+-CHOWN      := chown
++CHOWN      := true
+ CHMOD      := chmod
+-CHGRP      := chgrp
++CHGRP      := true
+ 
+ # Java compiler stuff - only needed on the buildhost
+ JC         := javac
+@@ -166,7 +166,7 @@
+ #    Note that we defer JCVALID evaluation to runtime, 
+ #    since $(JC) can be redefined later in a specific Makefile.config
+ #    The core Makefile.config is then used as a Makefile.default
+-JCVALID    = $(shell $(JC) -version >/dev/null 2>/dev/null && echo "yes")
++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;' )
diff --git a/testing/munin/munin-node.initd b/testing/munin/munin-node.initd
new file mode 100644
index 0000000..ad497ea
--- /dev/null
+++ b/testing/munin/munin-node.initd
@@ -0,0 +1,22 @@
+#!/sbin/openrc-run
+
+# munin-node init.d file for alpine linux.
+
+name=munin-node
+
+pidfile=/run/munin/${name}.pid
+
+command=/usr/sbin/munin-node
+command_args="${EXTRA_OPTS}"
+command_background="no"
+
+depend() {
+	need net
+	after firewall
+}
+
+start_pre() {
+	checkpath -d -o munin:munin -m755 /run/munin
+	checkpath -d -o munin:munin -m755 /var/lib/munin/spool
+	checkpath -d -o munin:munin -m755 /var/log/munin
+}
diff --git a/testing/munin/munin-node.logrotate b/testing/munin/munin-node.logrotate
new file mode 100644
index 0000000..03b976e
--- /dev/null
+++ b/testing/munin/munin-node.logrotate
@@ -0,0 +1,8 @@
+/var/log/munin/munin-node.log {
+	daily
+	missingok
+	copytruncate
+	rotate 7
+	compress
+	notifempty
+}
diff --git a/testing/munin/munin-node.pre-install b/testing/munin/munin-node.pre-install
new file mode 100644
index 0000000..86c601a
--- /dev/null
+++ b/testing/munin/munin-node.pre-install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+username=munin
+groupname="$username"
+
+addgroup -S "$username" 2>/dev/null
+adduser -S -H -h /run/"$username" -s /sbin/nologin -D -G "$groupname" \
+	"$username" 2>/dev/null
+
+exit 0
diff --git a/testing/munin/munin.cron.d b/testing/munin/munin.cron.d
new file mode 100644
index 0000000..45d5ee6
--- /dev/null
+++ b/testing/munin/munin.cron.d
@@ -0,0 +1,9 @@
+# /etc/cron.d/munin: crontab entries for the munin package
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+MAILTO=root
+
+@reboot         munin if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron; fi
+*/5 * * * *     munin if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron; fi
+
+# EOF
diff --git a/testing/munin/munin.logrotate b/testing/munin/munin.logrotate
new file mode 100644
index 0000000..cf480d7
--- /dev/null
+++ b/testing/munin/munin.logrotate
@@ -0,0 +1,12 @@
+/var/log/munin/munin-graph.log
+/var/log/munin/munin-cgi-graph.log
+/var/log/munin/munin-html.log
+/var/log/munin/munin-limits.log
+/var/log/munin/munin-update.log {
+	daily
+	missingok
+	copytruncate
+	rotate 7
+	compress
+	notifempty
+}
-- 
2.8.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---