summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2011-11-03 18:08:56 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2011-11-03 18:08:56 +0000
commit74bd8d7bae67d84a3e5325cdcaccccc7d8fc46de (patch)
treea9bfb8748c6f93369e0f23b605c5173d9e48f8f0 /net-analyzer/munin/files
parentAdd USE flags to pull in the correct encoders used by the audio profiles inst... (diff)
downloadhistorical-74bd8d7bae67d84a3e5325cdcaccccc7d8fc46de.tar.gz
historical-74bd8d7bae67d84a3e5325cdcaccccc7d8fc46de.tar.bz2
historical-74bd8d7bae67d84a3e5325cdcaccccc7d8fc46de.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.
Package-Manager: portage-2.2.0_alpha72/cvs/Linux x86_64
Diffstat (limited to 'net-analyzer/munin/files')
-rw-r--r--net-analyzer/munin/files/munin-1.4.6-apc-multi.patch89
-rw-r--r--net-analyzer/munin/files/munin-1.4.6-if_-hardened.patch146
2 files changed, 235 insertions, 0 deletions
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 ))
+