diff options
author | Florian Pritz <bluewind@xssn.at> | 2009-08-20 19:20:36 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xssn.at> | 2009-08-20 19:20:36 +0200 |
commit | f0d152ea0fe92423f39a487e97908d409f98047b (patch) | |
tree | 6396fb8e6a851f46f0cfc978c4720b3d2c3726b5 /munin-node | |
parent | 4955b0d9fc05950c5794c9cc37923deb00e9cfa5 (diff) | |
download | aur-packages-f0d152ea0fe92423f39a487e97908d409f98047b.tar.gz aur-packages-f0d152ea0fe92423f39a487e97908d409f98047b.tar.xz |
some updates again
Diffstat (limited to 'munin-node')
-rw-r--r-- | munin-node/Makefile.config | 106 | ||||
-rw-r--r-- | munin-node/PKGBUILD | 32 | ||||
-rw-r--r-- | munin-node/munin-node.finish | 18 | ||||
-rw-r--r-- | munin-node/munin-node.init | 38 | ||||
-rw-r--r-- | munin-node/munin-node.install | 34 | ||||
-rw-r--r-- | munin-node/munin-node.runit | 23 |
6 files changed, 251 insertions, 0 deletions
diff --git a/munin-node/Makefile.config b/munin-node/Makefile.config new file mode 100644 index 0000000..9542429 --- /dev/null +++ b/munin-node/Makefile.config @@ -0,0 +1,106 @@ +# This file specifies where Munin will look for things after you've +# run 'make' in the source directory. Modify it to suit your needs. + +# DESTDIR is empty during building, and optionally set to point to +# a shadow tree during make install. + +# +# the base of the Munin installation. +# +PREFIX = $(DESTDIR) + +# Where Munin keeps its configurations (server.conf, client.conf, ++) +CONFDIR = $(DESTDIR)/etc/munin + +# Server only - where to put munin-cron +BINDIR = $(PREFIX)/usr/bin + +# Client only - where to put munin-node, munin-node-configure, and munin-run +SBINDIR = $(PREFIX)/sbin + +# Where to put text and html documentation +DOCDIR = $(PREFIX)/usr/share/doc/munin + +# Where to put man pages +MANDIR = $(PREFIX)/usr/share/man + +# Where to put internal binaries and plugin repository +LIBDIR = $(PREFIX)/usr/lib/munin + +# Server only - Output directory +HTMLDIR = $(PREFIX)/srv/http/munin +CGIDIR = $(HTMLDIR)/cgi + +# Client only - Where to put RRD files and other intenal data +DBDIR = $(DESTDIR)/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 + +# Location of PID files and other statefiles. On the server, must be +# writable by the user "munin". +STATEDIR = $(DESTDIR)/var/run/munin + +# The perl interpreter to use +PERL = $(shell which perl) + +# The python interpreter to use (used by some plugins) +PYTHON = /usr/bin/env python + +# A modern (posix) shell. We're not looking for arrays, but $() and +# other modern stuff is expected. On a posix-system the expression +# below will find the right shell. Most Unixes released the last 10 +# years are POSIX compliant enough for this to work (he said bravely). +# +# 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` sh -c 'type sh | sed "s/.* //"') + +# Path of bash for bash specific plugins +BASH = /bin/bash + +# Server only - Where to install the perl libraries +PERLLIB = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2) + +# Client only - Install plugins for this architecture +OSTYPE = $(shell uname | tr '[A-Z]' '[a-z]') + +# How to figure out the hostname. (Only used in default configuration +# files) +HOSTNAME = $(shell hostname) + +# What is the safest way to create a tempfile. +# Default is to figure it out by testing various methods. +# Replace this with a known platform-specific method +MKTEMP = $(shell ./test-mktemp) + +# Munin version number. +VERSION = $(shell cat RELEASE) + +# User to run munin as +USER = munin +GROUP = munin + +# Default user to run the plugins as +PLUGINUSER = nobody + +# Which command to use to check if the USER and GROUP to run Munin as, exists. +GETENT = $(shell 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")) + +# For OSX, comment out the previous two lines and comment in these +#CHECKUSER = $(shell nicl . -read /users/$(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2")) +#CHECKGROUP = $(shell nicl . -read /groups/$(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2")) + +CHOWN = true +CHMOD = chmod +CHGRP = true +# 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/munin-node/PKGBUILD b/munin-node/PKGBUILD new file mode 100644 index 0000000..de756a4 --- /dev/null +++ b/munin-node/PKGBUILD @@ -0,0 +1,32 @@ +# Contributor: Roberto Alsina <ralsina@kde.org> +pkgname=munin-node +pkgver=1.2.6 +pkgrel=12 +pkgdesc="A distributed monitoring/graphing agent" +arch=('i686' 'x86_64') +url="http://munin.sf.net" +license=("GPL") +depends=(perl perl-net-server which) +backup=(etc/munin/munin-node.conf) +install=munin-node.install +source=(http://downloads.sourceforge.net/sourceforge/munin/munin_$pkgver.tar.gz \ + Makefile.config munin-node.init munin-node.runit munin-node.finish munin-node.install) + +md5sums=('45f84d58f80642ce914f147232f0d396' '686cef93dee285949a0451c81b691085'\ + '14872c731f99d5f9d831115b2f5e282e' '422000b064a03023b8dee2c76eee0548'\ + '39eb25fec876123cff9c6927d4a9d46a' 'aa8e338183ae2f4602bcaedfc6ca8927') + +build() { +cd $srcdir/munin-$pkgver +cp $srcdir/Makefile.config $srcdir/munin-$pkgver || exit 1 + +make PREFIX='' || exit 1 +make DESTDIR=$pkgdir install-node install-node-plugins || exit 1 + +sed -i "s|\$ENV{'MUNIN_HOSTNAME'}.*|\$ENV{'MUNIN_HOSTNAME'} = \`hostname\`;|g" $pkgdir/sbin/munin-node +sed -i "s|\$ENV{'MUNIN_HOSTNAME'}.*|\$ENV{'MUNIN_HOSTNAME'} = \`hostname\`;|g" $pkgdir/sbin/munin-run + +install -D -m0755 -o root ../munin-node.init $pkgdir/etc/rc.d/munin-node +install -D -m0755 -o root ../munin-node.runit $pkgdir/etc/munin-node/run +install -D -m0755 -o root ../munin-node.finish $pkgdir/etc/munin-node/finish +} diff --git a/munin-node/munin-node.finish b/munin-node/munin-node.finish new file mode 100644 index 0000000..934ad4a --- /dev/null +++ b/munin-node/munin-node.finish @@ -0,0 +1,18 @@ +#!/bin/sh + +# general config +. /etc/rc.conf +. /etc/rc.d/functions + +BIN=/sbin/munin-node +OPTS="" +SVC=munin-node + +echo "Stopping $SVC daemon" +PID=`pidof $BIN` +if [ -z "$PID" ] +then +rm -f /var/run/munin/$SVC.pid +rm_daemon $SVC +fi + diff --git a/munin-node/munin-node.init b/munin-node/munin-node.init new file mode 100644 index 0000000..e62b43b --- /dev/null +++ b/munin-node/munin-node.init @@ -0,0 +1,38 @@ +#!/bin/sh + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /sbin/munin-node` + +case "$1" in + start) + stat_busy "Starting munin-node" + /sbin/munin-node >/dev/null + stat_done + ;; + stop) + stat_busy "Stopping munin-node" + if [ ! -z "$PID" ]; then + kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + rm -f /var/run/munin/munin-node.pid &>/dev/null + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" + ;; +esac diff --git a/munin-node/munin-node.install b/munin-node/munin-node.install new file mode 100644 index 0000000..2f190f4 --- /dev/null +++ b/munin-node/munin-node.install @@ -0,0 +1,34 @@ +# arg 1: the new package version +post_install () { + +# Check user/group munin exists + + getent group munin > /dev/null || groupadd munin + getent passwd munin > /dev/null || useradd -c "Munin system monitor" -g munin -s /bin/false -d /var/munin munin + +# Fix permissions + chown munin.munin -R /var/log/munin /var/munin /var/run/munin + + +# Do basic configuration + + echo "==> Configuring default plugins for this system" + /sbin/munin-node-configure --shell | sh + + echo "==> To use the SNMP plugins you will need perl-net-snmp" + +} + +pre_remove() { + +# Only remove the user if munin is not installed, +# because both packages need this user + killall munin-node + pacman -Q munin >& /dev/null || ( /usr/sbin/userdel munin >& /dev/null ; \ + /usr/sbin/groupdel munin >& /dev/null ) +} + +op=$1 +shift + +$op $* diff --git a/munin-node/munin-node.runit b/munin-node/munin-node.runit new file mode 100644 index 0000000..60156e9 --- /dev/null +++ b/munin-node/munin-node.runit @@ -0,0 +1,23 @@ +#!/bin/sh +exec 2>&1 +# general config +. /etc/rc.conf +. /etc/rc.d/functions + +BIN=/sbin/munin-node +OPTS="" +SVC=munin-node + +PID=`pidof $BIN` +if [ -z "$PID" ] +then + if [ -f /var/run/munin/$SVC.pid ] + then + rm /var/run/munin/$SVC.pid + rm_daemon $SVC + fi + echo "Starting $SVC daemon" + $BIN $OPTS +else + [ -z $PID ] || exec watchpid $PID +fi |