From 74bd8d7bae67d84a3e5325cdcaccccc7d8fc46de Mon Sep 17 00:00:00 2001 From: =?utf8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 3 Nov 2011 18:08:56 +0000 Subject: [PATCH] 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. Package-Manager: portage-2.2.0_alpha72/cvs/Linux x86_64 --- net-analyzer/munin/ChangeLog | 10 +- net-analyzer/munin/Manifest | 15 +- .../munin/files/munin-1.4.6-apc-multi.patch | 89 ++++++++++ .../files/munin-1.4.6-if_-hardened.patch | 146 +++++++++++++++++ net-analyzer/munin/munin-1.4.6-r3.ebuild | 155 ++++++++++++++++++ 5 files changed, 408 insertions(+), 7 deletions(-) create mode 100644 net-analyzer/munin/files/munin-1.4.6-apc-multi.patch create mode 100644 net-analyzer/munin/files/munin-1.4.6-if_-hardened.patch create mode 100644 net-analyzer/munin/munin-1.4.6-r3.ebuild 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ò + +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 munin-1.4.6-r2.ebuild: x86 stable wrt bug #383683 diff --git a/net-analyzer/munin/Manifest b/net-analyzer/munin/Manifest index f8b0e4e4e4f4..b40a56704672 100644 --- a/net-analyzer/munin/Manifest +++ b/net-analyzer/munin/Manifest @@ -1,12 +1,14 @@ -----BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 +Hash: SHA1 AUX logrotate.d-munin 386 RMD160 527eb49f80c70dfb6f3207df449147000f4e8a0f SHA1 84d5b125973f68076b361b92576453dc064ac7ea SHA256 42bcc50a21e72d9b68df4fad2f1016587f7b033301de754cf956a4d5789ffbea AUX munin-1.3.2-plugins.conf 1623 RMD160 05aa9ba00e714c26d62bc06f6008714cb837f026 SHA1 979d416741dd0c6d79f00746570c67572d4390b5 SHA256 4fbd0d0f6ef37b055283dbd25f7e400a06dc0be6ede1bfd4f3f5c9b2f57b98a1 AUX munin-1.3.3-crontab 994 RMD160 ab7cc5acaeaf478413e1eb6d1dafe561d79448b0 SHA1 7a372182c407be60895a4817f9bb74f3a63fda49 SHA256 a5d9a160fc15d152a9cbdbf817a44c9c3450c60d61eeead647bf167fbe55fb89 AUX munin-1.4.4-Makefile.patch 2531 RMD160 f0a492267fd1078139a9f80997173cd1d4823e1b SHA1 6ef37d8a5df64be5e6aaa4fb5e526f48069aad0a SHA256 9f19d908b7097267b82b773d8644a775f76d16921e4efaf41e93835e53613bbc +AUX munin-1.4.6-apc-multi.patch 2329 RMD160 752c3a98ef7b8f11130381e38dbcdd159d9a51dd SHA1 c6e5465103ad0c9a56865bd3f9763b46c5e82a09 SHA256 128884796d3f5972136526254cfeaf76f40360be3be35ce63a76da2f6f2ab28e AUX munin-1.4.6-apc-temp.patch 1548 RMD160 884a9a0ec0cbc85a3ae7b9082a4c5915f5cac2af SHA1 d90bce289de037502f86ab6841d8a7b23f449140 SHA256 8b51c301cdd90f11e0d3fa5c16ae7bf4717bac2f6321765b6d37ecae4d9d6e27 AUX munin-1.4.6-fix-asterisk-plugins.patch 6639 RMD160 60be6ab42c0983ddc56e3dacbd25210fdc0492e3 SHA1 07d176e8b1ac7658d27982df8586a3e23f3df080 SHA256 29c8c30b69420453676cc173c232dd3ed1a561e6f0a8fd82ed2b750867ae4ee0 +AUX munin-1.4.6-if_-hardened.patch 4067 RMD160 6632190bafc5dc3e0f9a4dcd519404252892f7d1 SHA1 526494ebdbf76d6f8edd013c4f44b06156de74dd SHA256 10a39a3c3ec7a7be4e462671dc695dc4c7361fbf6f0c2983c344139af2b922ea AUX munin-1.4.6-munin-version-identifier.patch 10903 RMD160 373e5a9f3c89a0642adc7aa8b6c8a8f7ff6fc585 SHA1 40615deac2ae75b2767e65f8c321c11ba1f97305 SHA256 a403e5f1ade8b8b3c917fd4a1b72eb1857d6d67c6c955c63a72f5876c5eb4dd4 AUX munin-node_conf.d_1.4.5-r3 398 RMD160 d2ec21e963a0cb8618866e282bfb1f3bfaab22a8 SHA1 fb184d277f01256234362268f323bdec64bf395b SHA256 1599bf39d048f8330403d14b43dbc839cb7dfe2e4bc7531f52b4af9d00afd6d0 AUX munin-node_conf.d_1.4.6-r2 316 RMD160 7e20d734fe0e83f10c117a2fe440c9405ed2aac7 SHA1 db3678e68a74d933827217a6f5db251ce567df40 SHA256 cf250f39eae1ee564f51cd99ec20510accb8a68d59469893c5f6c474263f5b50 @@ -16,12 +18,13 @@ DIST munin-1.4.5.tar.gz 1231622 RMD160 883aa4baacfa5be1ec6a83737d5d241c40ad6912 DIST munin-1.4.6.tar.gz 1238782 RMD160 c4e5129641fa279f8b2668c7cafbb9d2656fd895 SHA1 055bf7da181941ce965e57cab7fe9a71fe57779f SHA256 1795812d9ad60e60f81c7f08c8be455ce44e1d4f966f7dd6be620e4c356de9c6 EBUILD munin-1.4.5-r3.ebuild 4629 RMD160 1a65cd42f60a281a314a3d48b029e093c44804f0 SHA1 39c9e7b4f49d1df3bd6c58ca10e0897e9673074a SHA256 6f6198d9b815da6a1c587d65c1205eaa56d30c38fe8db508277ce190b3e469fc EBUILD munin-1.4.6-r2.ebuild 4867 RMD160 a2a8c77079df50d61cb49fa4d19ee6d5ca15ad18 SHA1 009918bd3baa8bc324b4d017f1c3d2ac470c0569 SHA256 d1e3327c9d38904c03c846552a89b9631f565a2d117453d67c8df7d7f8e45bb8 -MISC ChangeLog 11932 RMD160 0e28641f3354ea9bf4f6824fe469dca927634fa6 SHA1 996381e5a9886c2844c9d59227f5fd3e97a7a4f1 SHA256 1922e6aa59592d62dab9eb87622cf206ff26195338e3d5e1e010007f00809fca +EBUILD munin-1.4.6-r3.ebuild 4971 RMD160 ca7251ec7296a81596f3effbeb8a4242d5783106 SHA1 ddfcf733c874777c645dc2ad0d5c0bd667676a40 SHA256 c6b7c3ec35fe0a057f3a6debe27ef6d76f1e53c763c3ad3479bbcbce3c11565e +MISC ChangeLog 12277 RMD160 54562c58364e950628e5db0cc6a92fd95abbfd0e SHA1 c9707a9ea6b65659f9127425ce3befbb00c3887e SHA256 2f139af4b344c0202bd0143293deb53acf71bb93cf408dc92b2f16cdd0602074 MISC metadata.xml 1249 RMD160 cd80a2d4d99585103b30a431c66bf8af5b2f8e96 SHA1 634e2949f42ab86ff056ac28891830ccf3d1a749 SHA256 1a37b6137d5f3e8c9cac67754bf18a2a83ff31e553fd5123aa9abe79a4ce4883 -----BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.17 (GNU/Linux) +Version: GnuPG v2.0.18 (GNU/Linux) -iEYEAREKAAYFAk6Gh6YACgkQuUQtlDBCeQK/7ACdG9ro8S3jGySOAyGHOGj+OQS0 -3C0AnjwWRm6Q/3ECUh1CiBy7CtDKyhe2 -=j4gT +iEYEARECAAYFAk6y2LgACgkQAiZjviIA2XieogCfdPFPaxpq9Qisn7rW7A6Rj97y +D4QAn3W+wgqh5A0B/FYdWRzdMWpCc8ZS +=6re6 -----END PGP SIGNATURE----- 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?= +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ò +--- + 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' + + =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