diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2011-11-03 18:08:56 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2011-11-03 18:08:56 +0000 |
commit | 1a136c0eceee79409b10087fe2a37dcd0673f490 (patch) | |
tree | 409885aca835f316035ebf4112ac2b8d2ec581b8 /net-analyzer/munin | |
parent | Add USE flags to pull in the correct encoders used by the audio profiles inst... (diff) | |
download | gentoo-2-1a136c0eceee79409b10087fe2a37dcd0673f490.tar.gz gentoo-2-1a136c0eceee79409b10087fe2a37dcd0673f490.tar.bz2 gentoo-2-1a136c0eceee79409b10087fe2a37dcd0673f490.zip |
Add two more patches (applied upstream), to support multiple APC UPSes and to allow using the if_ plugin on grsec-enabled kernels. Closes bug #384921.
(Portage version: 2.2.0_alpha72/cvs/Linux x86_64)
Diffstat (limited to 'net-analyzer/munin')
-rw-r--r-- | net-analyzer/munin/ChangeLog | 10 | ||||
-rw-r--r-- | net-analyzer/munin/files/munin-1.4.6-apc-multi.patch | 89 | ||||
-rw-r--r-- | net-analyzer/munin/files/munin-1.4.6-if_-hardened.patch | 146 | ||||
-rw-r--r-- | net-analyzer/munin/munin-1.4.6-r3.ebuild | 155 |
4 files changed, 399 insertions, 1 deletions
diff --git a/net-analyzer/munin/ChangeLog b/net-analyzer/munin/ChangeLog index 3171b22c50dc..26181f36757b 100644 --- a/net-analyzer/munin/ChangeLog +++ b/net-analyzer/munin/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-analyzer/munin # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.61 2011/10/01 03:23:11 phajdan.jr Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/ChangeLog,v 1.62 2011/11/03 18:08:56 flameeyes Exp $ + +*munin-1.4.6-r3 (03 Nov 2011) + + 03 Nov 2011; Diego E. Pettenò <flameeyes@gentoo.org> + +files/munin-1.4.6-apc-multi.patch, +files/munin-1.4.6-if_-hardened.patch, + +munin-1.4.6-r3.ebuild: + Add two more patches (applied upstream), to support multiple APC UPSes and to + allow using the if_ plugin on grsec-enabled kernels. Closes bug #384921. 01 Oct 2011; Pawel Hajdan jr <phajdan.jr@gentoo.org> munin-1.4.6-r2.ebuild: x86 stable wrt bug #383683 diff --git a/net-analyzer/munin/files/munin-1.4.6-apc-multi.patch b/net-analyzer/munin/files/munin-1.4.6-apc-multi.patch new file mode 100644 index 000000000000..042d79518f75 --- /dev/null +++ b/net-analyzer/munin/files/munin-1.4.6-apc-multi.patch @@ -0,0 +1,89 @@ +From 1563eb6b72781fecd58495c358b1fc877c904043 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.eu> +Date: Mon, 22 Aug 2011 15:06:11 +0200 +Subject: [PATCH] apc_nis: support rewriting host and port in configuration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It is possible for APCUPSD to manage multiple UPSes on the same box, and to +export its information to external systems as well. + +Since each UPS needs its own NIS host/port pair to be accessible, allow the +user to access non-default hosts and ports. This also allows to monitor +remote UPSes with Munin. + +Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu> +--- + plugins/node.d/apc_nis.in | 38 +++++++++++++++++++++++--------------- + 1 files changed, 23 insertions(+), 15 deletions(-) + +diff --git a/plugins/node.d/apc_nis.in b/plugins/node.d/apc_nis.in +index 6c06459..9adf96d 100644 +--- a/plugins/node.d/apc_nis.in ++++ b/plugins/node.d/apc_nis.in +@@ -5,17 +5,25 @@ + + apc_nis - Plugin to monitor APC UPS via the nis port of apcupsd + +-=cut ++=head1 CONFIGURATION ++ ++The following configuration parameters are used by this plugin ++ ++ [apc_nis] ++ env.host - hostname to connect to ++ env.port - port number to connect to ++ ++=head2 DEFAULT CONFIGURATION ++ ++ [apc_nis] ++ env.host 127.0.0.1 ++ env.port 3551 + +-# +-# +-# Parameters: +-# +-# config (required) +-# +-# Magic markers (optional - used by munin-config and some installation +-# scripts): +-#%# family=contrib ++=head1 MAGIC MARKERS ++ ++ #%# family=contrib ++ ++=cut + + use IO::Socket; + use strict; +@@ -25,8 +33,11 @@ if($ARGV[0] and $ARGV[0] eq "autoconfig") { + exit 0; + } + ++my $host = exists $ENV{'host'} ? $ENV{'host'} : "127.0.0.1"; ++my $port = exists $ENV{'port'} ? $ENV{'port'} : "3551"; ++ + if($ARGV[0] and $ARGV[0] eq "config") { +- print "graph_title apcupsd\n"; ++ print "graph_title apcupsd $host:$port\n"; + print "graph_args -l 0 --base 1000\n"; + print "graph_vlabel A bit of all (Volt, time, %)\n"; + print "battery_volt.label batt volt (V)\n"; +@@ -50,11 +61,8 @@ if($ARGV[0] and $ARGV[0] eq "config") { + exit 0; + } + +-my $server = "localhost"; +-my $port = "3551"; +- + my $sock = new IO::Socket::INET ( +- PeerAddr => $server, ++ PeerAddr => $host, + PeerPort => $port, + Proto => 'tcp' + ); +-- +1.7.6 + diff --git a/net-analyzer/munin/files/munin-1.4.6-if_-hardened.patch b/net-analyzer/munin/files/munin-1.4.6-if_-hardened.patch new file mode 100644 index 000000000000..4262dc57375a --- /dev/null +++ b/net-analyzer/munin/files/munin-1.4.6-if_-hardened.patch @@ -0,0 +1,146 @@ +diff --git a/plugins/node.d.linux/if_.in b/plugins/node.d.linux/if_.in +index 31b554a..2f08709 100755 +--- a/plugins/node.d.linux/if_.in ++++ b/plugins/node.d.linux/if_.in +@@ -43,7 +43,9 @@ monitored with this plugin. + + =head1 AUTHOR + +-Unknown author ++Original author unknown ++ ++Copyright (C) 2011 Diego Elio Petteno' <flameeyes@flameeyes.eu> + + =head1 LICENSE + +@@ -64,86 +66,65 @@ Unknown license + + INTERFACE=${0##*if_} + +-findspeed () { +- + # Who whould have thought it's so much work to determine the + # maximum speed of a network interface. Buckle up! +- +- IWLIST="$(type -p iwlist)" +- +- WIRELESS=0 ++findspeed_mbps() { + # Do not use interface name to guess technology. Many many + # wifi drivers use "eth*" names. +- case $IWLIST in +- +- '') +- # Used to use iwconfig to look for "no wireless +- # extentions" message - but this seemed un-needed. If we +- # don't have iwlist we can't find out if # the interface +- # is wireless +- :;; +- *) IWO="$($IWLIST $INTERFACE rate 2>&1)" +- case $IWO in +- *no*) :;; +- *) WIRELESS=1;; +- esac +- ;; +- esac ++ IWLIST="$(type -p iwlist)" ++ if [ -x "$IWLIST" ]; then ++ SPEED=$($IWLIST $INTERFACE rate 2>&1 | ++ awk 'BEGIN { RATE=U } ++ { if ($2 == "Mb/s") RATE=$1; } ++ END { print RATE; }') ++ ++ if [ "$SPEED" != "U" ]; then ++ echo $SPEED ++ return ++ fi ++ fi ++ ++ # sysfs can report the speed if the driver supports it (but it ++ # doesn't work as well for wireless cards, thus why we check for ++ # iwlist first) ++ if [ -r /sys/class/net/$INTERFACE/speed ]; then ++ SPEED="$(cat /sys/class/net/$INTERFACE/speed 2>/dev/null)" ++ if [ -n "$SPEED" ]; then ++ echo $SPEED ++ return ++ fi ++ fi + +- SPEED=U +- # Find speed in Mbps. - or not +- case $WIRELESS:$IWLIST in +- 0:*) + ETHTOOL="$(type -p ethtool)" + if [ -x "$ETHTOOL" ]; then + SPEED="$($ETHTOOL $INTERFACE 2>&1 | + awk '/Speed:/ { gsub(/[^0-9]*/,"",$2); print $2; }')" +- case $SPEED in +- [0-9]*) :;; # OK +- *) SPEED=U;; # Could be "unknown" +- esac +- else +- INSTALL="ethtool" +- fi +- ;; +- 1:/*) +- # Current bit rate is not very interesting, it varies too often +- SPEED=$(echo "$IWO" | +- awk 'BEGIN { RATE=U } +- { if ($2 == "Mb/s") RATE=$1; } +- END { print RATE; }') + +- ;; +- *) +- # Wireless interface, cannot find iwlist +- INSTALL="wireless-tools" +- ;; +- esac ++ if [ $SPEED = [0-9]* ]; then ++ echo $SPEED ++ return ++ fi ++ fi + + MIITOOL="$(type -p mii-tool)" +- case $SPEED:$MIITOOL in +- U:/*) +- SPEED="$($MIITOOL $INTERFACE 2>&1)" +- case $SPEED in +- *1000base*) SPEED=1000;; # as if... +- *100base*) SPEED=100;; +- *10base*) SPEED=10;; +- *) SPEED=U;; +- esac +- ;; ++ if [ -x $MIITOOL ]; then ++ case $($MIITOOL $INTERFACE 2>&1) in ++ *1000base*) echo 1000; return ;; ++ *100base*) echo 100; return ;; ++ *10base*) echo 10; return ;; + esac +- +- # sysfs can report the speed if the driver supports it +- SYSFS="$(cat /sys/class/net/$INTERFACE/speed 2>/dev/null)" +- # If it can't, it fails on I/O, so we check cat's return value +- if [ $? -eq 0 -a "$SPEED" = "U" -a -n "$SYSFS" ]; then +- SPEED="$SYSFS" + fi + +- case $SPEED in +- U) echo "up.info Traffic of the $INTERFACE interface. Unable to determine interface speed. Please install ethtool, wireless-tools (or mii-tool), whatever is appropriate for the interface." +- return;; +- esac ++ echo U ++} ++ ++findspeed() { ++ SPEED=$(findspeed_mbps) ++ ++ if [ -z $SPEED ]; then ++ echo "up.info Traffic of the $INTERFACE interface. Unable to determine interface speed. Please install ethtool, wireless-tools, mii-tool or whatever is appropriate for the interface." ++ return ++ fi + + BPS=$(( $SPEED * 1000 * 1000 )) + diff --git a/net-analyzer/munin/munin-1.4.6-r3.ebuild b/net-analyzer/munin/munin-1.4.6-r3.ebuild new file mode 100644 index 000000000000..408143a64ab0 --- /dev/null +++ b/net-analyzer/munin/munin-1.4.6-r3.ebuild @@ -0,0 +1,155 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/munin/munin-1.4.6-r3.ebuild,v 1.1 2011/11/03 18:08:56 flameeyes Exp $ + +EAPI=2 + +inherit eutils + +DESCRIPTION="Munin Server Monitoring Tool" +HOMEPAGE="http://munin.projects.linpro.no/" +SRC_URI="mirror://sourceforge/munin/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~mips ~ppc ~sparc ~x86" +IUSE="asterisk doc irc java memcached minimal mysql postgres ssl" + +# Upstream's listing of required modules is NOT correct! +# Some of the postgres plugins use DBD::Pg, while others call psql directly. +# The mysql plugins use mysqladmin directly. +DEPEND_COM="dev-lang/perl + sys-process/procps + asterisk? ( dev-perl/Net-Telnet ) + irc? ( dev-perl/Net-IRC ) + java? ( >=virtual/jdk-1.5 ) + mysql? ( virtual/mysql dev-perl/Cache-Cache ) + ssl? ( dev-perl/Net-SSLeay ) + postgres? ( dev-perl/DBD-Pg dev-db/postgresql-base ) + memcached? ( dev-perl/Cache-Memcached ) + dev-perl/DateManip + dev-perl/Net-CIDR + dev-perl/Net-Netmask + dev-perl/Net-SNMP + dev-perl/libwww-perl + dev-perl/net-server + dev-perl/DBI + virtual/perl-Digest-MD5 + virtual/perl-Getopt-Long + virtual/perl-MIME-Base64 + virtual/perl-Storable + virtual/perl-Text-Balanced + virtual/perl-Time-HiRes + !minimal? ( dev-perl/HTML-Template + net-analyzer/rrdtool[perl] + dev-perl/Log-Log4perl )" + # Sybase isn't supported in Gentoo + #munin-sybase? ( dev-perl/DBD-Sybase ) + +# Keep this seperate, as previous versions have had other deps here +DEPEND="${DEPEND_COM} + virtual/perl-Module-Build" +RDEPEND="${DEPEND_COM} + !minimal? ( virtual/cron )" + +pkg_setup() { + enewgroup munin + enewuser munin 177 -1 /var/lib/munin munin +} + +src_prepare() { + # upstream needs a lot of DESTDIR loving + # and Gentoo location support + epatch "${FILESDIR}"/${PN}-1.4.4-Makefile.patch + + epatch "${FILESDIR}"/${PN}-1.4.6-apc-temp.patch + epatch "${FILESDIR}"/${PN}-1.4.6-munin-version-identifier.patch + epatch "${FILESDIR}"/${PN}-1.4.6-fix-asterisk-plugins.patch + epatch "${FILESDIR}"/${PN}-1.4.6-if_-hardened.patch + epatch "${FILESDIR}"/${PN}-1.4.6-apc-multi.patch + + # Don't build java plugins if not requested via USE. + if ! use java; then + # sed is needed so the java plugins aren't automagically built. + sed -i -e 's: build-plugins-java : :' \ + -e 's: install-plugins-java : :' Makefile || die + fi + + # Bug 304447, fix for gentoo PS location + sed -i -e 's,/usr/bin/ps,/bin/ps,g' \ + "${S}"/plugins/node.d/ifx_concurrent_sessions_.in || die + + # bug 367785, cleanup make output by disabling HP-UX cruft + sed -i -e "/plugins\/\*\.adv/d" Makefile || die +} + +src_compile() { + emake -j 1 build build-man || die "build/build-man failed" + if use doc; then + emake -j 1 build-doc || die "build-doc failed" + fi + + #Ensure TLS is disabled if built without SSL + if ! use ssl; then + echo "tls disabled" >> ${S}/build/node/munin-node.conf \ + || die "Fixing munin-node.conf Failed!" + echo "tls disabled" >> ${S}/build/master/munin.conf \ + || die "Fixing munin.conf Failed!" + fi + +} + +src_install() { + local dirs + dirs="/var/log/munin/ /var/lib/munin/" + dirs="${dirs} /var/lib/munin/plugin-state/" + dirs="${dirs} /var/run/munin/plugin-state/" + dirs="${dirs} /var/run/munin/spool/" + dirs="${dirs} /etc/munin/plugin-conf.d/" + dirs="${dirs} /etc/munin/munin-conf.d/" + dirs="${dirs} /etc/munin/plugins/" + keepdir ${dirs} + + if use minimal; then + emake -j 1 DESTDIR="${D}" install-common-prime install-node-prime \ + install-plugins-prime || die "install failed" + else + emake -j 1 DESTDIR="${D}" install || die "install failed" + fi + fowners munin:munin ${dirs} || die + + insinto /etc/munin/plugin-conf.d/ + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node || die + + # make sure we've got everything in the correct directory + insinto /var/lib/munin + newins "${FILESDIR}"/${PN}-1.3.3-crontab crontab || die + newinitd "${FILESDIR}"/munin-node_init.d_1.4.6-r2 munin-node || die + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node || die + dodoc README ChangeLog INSTALL logo.eps logo.svg build/resources/apache* \ + || die + + # bug 254968 + insinto /etc/logrotate.d/ + newins "${FILESDIR}"/logrotate.d-munin munin || die +} + +pkg_config() { + einfo "Press enter to install the default crontab for the munin master" + einfo "installation from /var/lib/munin/crontab" + einfo "If you have a large site, you may wish to customize it." + read + # dcron is very fussy about syntax + # the following is the only form that works in BOTH dcron and vixie-cron + crontab - -u munin </var/lib/munin/crontab +} + +pkg_postinst() { + elog "Please follow the munin documentation to set up the plugins you" + elog "need, afterwards start munin-node via /etc/init.d/munin-node." + if ! use minimal; then + elog "To have munin's cronjob automatically configured for you if this is" + elog "your munin master installation, please:" + elog "emerge --config net-analyzer/munin" + fi +} |