From d5c65817b72ac6a07fa3fd21bf47b8b2e6f1108c Mon Sep 17 00:00:00 2001 From: Jonathan Chapman Date: Fri, 9 Oct 2015 23:50:33 +0700 Subject: system/munin-node: Added (Statistics gathering client for Munin). Signed-off-by: Willy Sudiarto Raharjo --- system/munin-node/LICENSE | 166 ++++++++++++++++++++++++ system/munin-node/README | 22 ++++ system/munin-node/README.SLACKWARE | 13 ++ system/munin-node/doinst.sh | 30 +++++ system/munin-node/munin-node.SlackBuild | 72 ++++++++++ system/munin-node/munin-node.info | 10 ++ system/munin-node/munin-node.logrotate | 8 ++ system/munin-node/patches/Makefile.config.patch | 72 ++++++++++ system/munin-node/patches/Makefile.patch | 19 +++ system/munin-node/rc.munin-node | 22 ++++ system/munin-node/slack-desc | 19 +++ 11 files changed, 453 insertions(+) create mode 100644 system/munin-node/LICENSE create mode 100644 system/munin-node/README create mode 100644 system/munin-node/README.SLACKWARE create mode 100644 system/munin-node/doinst.sh create mode 100644 system/munin-node/munin-node.SlackBuild create mode 100644 system/munin-node/munin-node.info create mode 100644 system/munin-node/munin-node.logrotate create mode 100644 system/munin-node/patches/Makefile.config.patch create mode 100644 system/munin-node/patches/Makefile.patch create mode 100644 system/munin-node/rc.munin-node create mode 100644 system/munin-node/slack-desc diff --git a/system/munin-node/LICENSE b/system/munin-node/LICENSE new file mode 100644 index 0000000000..341c30bda4 --- /dev/null +++ b/system/munin-node/LICENSE @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + diff --git a/system/munin-node/README b/system/munin-node/README new file mode 100644 index 0000000000..ac547743ec --- /dev/null +++ b/system/munin-node/README @@ -0,0 +1,22 @@ +munin-node is the client portion of the Munin Monitoring system. It allows the +Munin master to collect statistics for presentation in RRDTool time-series +graphs. + +munin-node is a Perl application and requires several Perl modules as external +dependencies: + + Net::Server + +Additionally, the following modules are required for some plugins: + + Net::SSLeay (for SSL connections) + Net::SNMP + Net::CIDR + +Munin requires that user munin exists and belongs to group munin. Create these +before running the SlackBuild script: + +groupadd -g 308 munin +useradd -u 308 -g 308 -s /sbin/nologin munin + +Once munin-node is installed, configure plugins per the Munin documentation. diff --git a/system/munin-node/README.SLACKWARE b/system/munin-node/README.SLACKWARE new file mode 100644 index 0000000000..a5dccb6b34 --- /dev/null +++ b/system/munin-node/README.SLACKWARE @@ -0,0 +1,13 @@ +README.SLACKWARE for munin-node + +To start munin-node at boot, add the following to /etc/rc.d/rc.local: + + if [ -x /etc/rc.d/rc.munin-node ]; then + /etc/rc.d/rc.munin-node start + fi + +This goes in /etc/rc.d/rc.local_shutdown: + + if [ -x /etc/rc.d/rc.munin-node ]; then + /etc/rc.d/rc.munin-node stop + fi diff --git a/system/munin-node/doinst.sh b/system/munin-node/doinst.sh new file mode 100644 index 0000000000..6afcc2415d --- /dev/null +++ b/system/munin-node/doinst.sh @@ -0,0 +1,30 @@ +# Post-install configuration scripts, borrowed from the fail2ban +# Slackbuild: + +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.munin-node.new +config etc/munin/munin-node.conf.new +config etc/logrotate.d/munin-node.new diff --git a/system/munin-node/munin-node.SlackBuild b/system/munin-node/munin-node.SlackBuild new file mode 100644 index 0000000000..487b4c9ea6 --- /dev/null +++ b/system/munin-node/munin-node.SlackBuild @@ -0,0 +1,72 @@ +#!/bin/sh -e + +# Slackware Package Build Script for munin-node (http://munin-monitoring.org) +# SlackBuild source at https://github.com/chapmajs/munin-node-slackbuild + +# See LICENSE included in the project root for licensing information. + +# Copyright (c) 2015 Jonathan Chapman +# glitch@glitchwrks.com +# All rights reserved. + +PRGNAM=munin-node +VERSION=${VERSION:-2.0.25} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +ARCH="noarch" + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +ARCHIVE_NAME=munin + +set -e + +# Clean up old builds +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar zxvf $CWD/$ARCHIVE_NAME-$VERSION.tar.gz +cd $ARCHIVE_NAME-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Fix a bug in Perldoc extension detection +patch Makefile < $CWD/patches/Makefile.patch + +# Patch Makefile.config for Slackware-esque install locations +patch Makefile.config < $CWD/patches/Makefile.config.patch + +make LIBDIR=/usr/lib${LIBDIRSUFFIX} +make install-common-prime install-node-prime \ + install-plugins-prime LIBDIR=/usr/lib${LIBDIRSUFFIX} DESTDIR=$PKG + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mv $PKG/usr/local/share/ $PKG/usr/ +rm -rf $PKG/usr/local + +# move config files to .new +cd $PKG/etc/munin +for file in $(find . -type f); do + mv $file "$file.new" +done + +install -D -m 0644 $CWD/rc.munin-node $PKG/etc/rc.d/rc.munin-node.new +install -D -m 0644 $CWD/munin-node.logrotate $PKG/etc/logrotate.d/munin-node.new + +# Finish up the package +mkdir -p $PKG/install +cat $CWD/doinst.sh > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/munin-node/munin-node.info b/system/munin-node/munin-node.info new file mode 100644 index 0000000000..e589075e0f --- /dev/null +++ b/system/munin-node/munin-node.info @@ -0,0 +1,10 @@ +PRGNAM="munin-node" +VERSION="2.0.25" +HOMEPAGE="http://munin-monitoring.org" +DOWNLOAD="http://downloads.munin-monitoring.org/munin/stable/2.0.25/munin-2.0.25.tar.gz" +MD5SUM="b418a667ce42665557329a7ac3bd1b93" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="perl-Net-Server Net-SSLeay" +MAINTAINER="Jonathan Chapman" +EMAIL="glitch@glitchwrks.com" diff --git a/system/munin-node/munin-node.logrotate b/system/munin-node/munin-node.logrotate new file mode 100644 index 0000000000..6a68573f86 --- /dev/null +++ b/system/munin-node/munin-node.logrotate @@ -0,0 +1,8 @@ +/var/log/munin/munin-node.log { + weekly + rotate 7 + missingok + compress + copytruncate + notifempty +} diff --git a/system/munin-node/patches/Makefile.config.patch b/system/munin-node/patches/Makefile.config.patch new file mode 100644 index 0000000000..8617deeebb --- /dev/null +++ b/system/munin-node/patches/Makefile.config.patch @@ -0,0 +1,72 @@ +--- Makefile.config 2014-11-24 16:46:24.000000000 -0500 ++++ Makefile.config.new 2015-07-16 14:12:13.868927186 -0400 +@@ -17,10 +17,10 @@ + # + # the base of the Munin installation. + # +-PREFIX = $(DESTDIR)/opt/munin ++PREFIX = $(DESTDIR)/usr + + # 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 +@@ -35,17 +35,17 @@ + MANDIR = $(PREFIX)/man + + # Where to put internal binaries and plugin repository +-LIBDIR = $(PREFIX)/lib ++LIBDIR = $(PREFIX)/lib/munin + + # Server only - Output directory + HTMLDIR = $(PREFIX)/www/docs + CGIDIR = $(PREFIX)/www/cgi + + # Where to put internal data for master (RRD, internal files, ...) +-DBDIR = $(DESTDIR)/var/opt/munin ++DBDIR = $(DESTDIR)/var/munin + + # Where to put internal data for node (plugin state, ...) +-DBDIRNODE = $(DESTDIR)/var/opt/munin-node ++DBDIRNODE = $(DESTDIR)/var/db/munin-node + + # Client only - Where the spool files are written. Must be writable by + # group "munin", and should be preserved between reboots +@@ -56,7 +56,7 @@ + PLUGSTATE = $(DBDIRNODE)/plugin-state + + # Where Munin should place its logs. +-LOGDIR = $(PREFIX)/log/munin ++LOGDIR = $(DESTDIR)/var/log/munin + + # Location of PID files and other statefiles. On the server, must be + # writable by the user "munin". +@@ -133,26 +133,6 @@ + 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")) + +-# 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) nonexistent. Create the user and retry; exit 2")) +-#CHECKGROUP := $(shell nicl . -read /groups/$(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2")) +- +-# For OSX 10.5 (Leopard), use the following two lines instead of what's above +-# +-#CHECKUSER := $(shell dscl . -read /Users/$(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2")) +-#CHECKGROUP := $(shell dscl . -read /Groups/$(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2")) +- +- +-# For HP-UX, use these instead: +-# +-#CHECKUSER := $(shell pwget -n $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2")) +-#CHECKGROUP := $(shell grget -n $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2")) +- +-# For Cygwin, use these instead: +-#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 + CHMOD := chmod + CHGRP := chgrp diff --git a/system/munin-node/patches/Makefile.patch b/system/munin-node/patches/Makefile.patch new file mode 100644 index 0000000000..345022b941 --- /dev/null +++ b/system/munin-node/patches/Makefile.patch @@ -0,0 +1,19 @@ +--- /home/glitch/builds/munin-node/munin-2.0.25/Makefile 2014-11-24 16:46:24.000000000 -0500 ++++ Makefile 2015-07-16 14:32:54.688903959 -0400 +@@ -30,6 +30,7 @@ + MAN8 := master/_bin/munin-update master/_bin/munin-limits master/_bin/munin-html master/_bin/munin-graph + PODMAN8 := build/master/doc/munin-cron master/doc/munin master/doc/munin-check + PODMAN5 := build/master/doc/munin.conf node/doc/munin-node.conf ++MAN3EXT := $(shell $(PERL) -e 'use Config; print $$Config{man3ext};') + + .PHONY: install install-pre install-master-prime install-node-prime install-node-pre install-common-prime install-doc install-man \ + build build-common-prime build-common-pre build-doc \ +@@ -284,7 +285,7 @@ + -e 's|\@\@GOODSH\@\@|$(GOODSH)|g;' \ + -e 's|\@\@BASH\@\@|$(BASH)|g;' \ + -e 's|\@\@HASSETR\@\@|$(HASSETR)|g;' \ +- ./master/blib/libdoc/Munin::Master::HTMLOld.3pm \ ++ ./master/blib/libdoc/Munin::Master::HTMLOld.$(MAN3EXT) \ + ./master/blib/lib/Munin/Master/HTMLOld.pm \ + ./node/blib/sbin/munin-node-configure \ + ./node/blib/sbin/munin-node \ diff --git a/system/munin-node/rc.munin-node b/system/munin-node/rc.munin-node new file mode 100644 index 0000000000..ee0327730c --- /dev/null +++ b/system/munin-node/rc.munin-node @@ -0,0 +1,22 @@ +#!/bin/sh + +# Startup script for munin-node + +function munin_start { + /usr/sbin/munin-node +} + +function munin_stop { + killall munin-node +} + +if [ "$1" == 'start' ]; then + munin_start +elif [ "$1" == 'stop' ]; then + munin_stop +elif [ "$1" == 'restart' ]; then + munin_stop + munin_start +else + echo "usage: rc.munin-node start|stop|restart" +fi diff --git a/system/munin-node/slack-desc b/system/munin-node/slack-desc new file mode 100644 index 0000000000..3ab8f04c20 --- /dev/null +++ b/system/munin-node/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +munin-node: munin-node (System statistics gathering client for Munin) +munin-node: +munin-node: munin-node is the statistics gatherling client used with Munin. This +munin-node: client can be queried by a Munin master which processes the report +munin-node: data into RRDTool graphs. +munin-node: +munin-node: munin-node is written in Perl and requires several external Perl +munin-node: modules. See the project documentation for requirements. +munin-node: +munin-node: Homepage: http://munin-monitoring.org +munin-node: -- cgit v1.2.3