From 173eda6d0ad1c0a3008a3ee19155d1a3785b476a Mon Sep 17 00:00:00 2001 From: rhatto Date: Tue, 5 Dec 2006 17:52:49 +0000 Subject: munin update git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@852 370017ae-e619-0410-ac65-c121f96126d4 --- net/analyzer/munin/munin.build | 33 ++++++------ net/analyzer/munin/qos_ | 113 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 17 deletions(-) create mode 100755 net/analyzer/munin/qos_ (limited to 'net/analyzer') diff --git a/net/analyzer/munin/munin.build b/net/analyzer/munin/munin.build index 2dd27f7e..8b2f79bb 100755 --- a/net/analyzer/munin/munin.build +++ b/net/analyzer/munin/munin.build @@ -2,9 +2,6 @@ # # build script for munin # by rhatto at riseup.net by rhatto | gpl -# build it with slacktrack, example: -# -# ARCH=x86_64 slacktrack -jefkzp "munin-1.2.4-x86_64-2rha.tgz" "./munin.build" # # @@ -25,11 +22,17 @@ fi # default settings PACKAGE="munin" TMP=${TMP:=/tmp} -VERSION=${VERSION:=1.2.4} +VERSION=${VERSION:=1.2.5} ARCH=${ARCH:=i386} BUILD=${BUILD:=3rha} SRC_DIR=${SRC:=$CWD} +# ------- error codes for createpkg -------------- +ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 +ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 +ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 +ERROR_PATCH=40 + if ! grep -qe "^$PACKAGE:" /etc/passwd || ! grep -qe "^$PACKAGE:" /etc/group; then echo "WARNING: user and/or group $PACKAGE does not exist" echo "Create it manually with \"groupadd $PACKAGE ; useradd $PACKAGE -g $PACKAGE\" and run this script again." @@ -41,10 +44,12 @@ Attention: be sure that theres no munin installed on this system, otherwiser ins procedure will fail to copy plugins to their right place. Please uninstall any munin packages before continue. -Hit enter to proceed. EOCAT -read garbage +if [ "$INTERACT" != "no" ]; then + echo Hit enter to proceed. + read garbage +fi if [ "$ARCH" == "x86_64" ]; then LIBDIR=/usr/lib64 @@ -65,13 +70,7 @@ fi if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then rm -f $SRC_DIR/$SRC - wget "$URL" -O "$SRC_DIR/$SRC" -fi - -if [ "$PACKAGE_EXT" == "bz2" ]; then - tarflag="j" -else - tarflag="z" + wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET fi TMP="$TMP/$PACKAGE" @@ -82,7 +81,7 @@ fi cd $TMP -tar xvf$tarflag $SRC_DIR/$SRC +tar xvf $SRC_DIR/$SRC || exit $ERROR_TAR cd $PACKAGE-$VERSION # config and install! @@ -98,9 +97,9 @@ sed -e 's/PREFIX = $(DESTDIR)\/opt\/munin/PREFIX = $(DESTDIR)\/usr/' \ mv Makefile.config.new Makefile.config -make install-main -make install-doc install-man -make install-node install-node-plugins +make install-main || exit $ERROR_INSTALL +make install-doc install-man || exit $ERROR_INSTALL +make install-node install-node-plugins || exit $ERROR_INSTALL # make the package diff --git a/net/analyzer/munin/qos_ b/net/analyzer/munin/qos_ new file mode 100755 index 00000000..98bc80e9 --- /dev/null +++ b/net/analyzer/munin/qos_ @@ -0,0 +1,113 @@ +#!/usr/bin/perl -w +# -*- perl -*- +# Wildcard plugin to monitor QoS queues. +# +# Requirements: +# - tc program installed and in path +# +# Parameters supported: +# +# config +# autoconf +# suggest +# +# Configurable variables +# +# tc - Override default program +# ignore_queue - Queue with handle (ex ignore_queue0 for root queue) not be plotted +# label_name - Queue with handle as define label +# +# $Log$ +# Revision 1.1 2006/03/05 17:11:36 fra519 +# +# +# Magic markers: +#%# family=manual +#%# capabilities=autoconf suggest + +use strict; + +my $TC = $ENV{'tc'} || 'tc'; + +if ($ARGV[0] and $ARGV[0] eq 'suggest') { + my $text = `egrep '^ *(eth|wlan|ath|ra)[0-9]+:' /proc/net/dev | cut -f1 -d:`; + print $text; + exit; +} + +$0 =~ /qos_(.+)*$/; +my $IFACE = $1; +exit 2 unless defined $IFACE; + +if ( exists $ARGV[0] and $ARGV[0] eq 'autoconf' ) { + # Now see if "tc" can run + my $text = `$TC qdisc show dev $IFACE`; + if ($?) { + if ($? == -1) { + print "no (program $TC not found)\n"; + } else { + print "no (program $TC died)\n"; + } + exit 1; + } + print "yes\n"; + exit 0; +} + +my %queues; +my $qdisc; +my $queue; +my $handle; +my $one; +my $sent; + +open(TEXT, "$TC -s qdisc show dev $IFACE|"); +while (! eof(TEXT)) { + ($qdisc, $queue, $handle) = split(" ", ); + if ($qdisc eq "backlog") { + ($qdisc, $queue, $handle) = split(" ", ); + } + ($one, $sent) = split(" ", ); + $handle =~ s/://; + $queues{$handle} = { + queue => $queue, + handle => $handle, + sent => $sent + }; +} + +if ( exists $ARGV[0] and $ARGV[0] eq 'config' ) { + print "graph_title QoS queue on $IFACE\n"; + print "graph_args --base 1000\n"; + print "graph_vlabel bits per \${graph_period}\n"; + print "graph_category network\n"; + print "graph_info This graph shows the QoS queue of the $IFACE network interface.\n"; + print "graph_order "; + foreach my $key (sort by_handle keys %queues) { + print $queues{$key}->{queue},$queues{$key}->{handle}, " "; + } + print "\n"; + foreach my $key (sort by_handle keys %queues) { + print $queues{$key}->{queue},$queues{$key}->{handle}, ".label "; + if (exists $ENV{"label_name$queues{$key}->{handle}"}) { + print $ENV{"label_name$queues{$key}->{handle}"}; + } else { + print $queues{$key}->{queue},$queues{$key}->{handle}; + } + print "\n"; + print $queues{$key}->{queue},$queues{$key}->{handle}, ".type COUNTER\n"; + print $queues{$key}->{queue},$queues{$key}->{handle}, ".graph no\n" if exists $ENV{"ignore_queue$queues{$key}->{handle}"}; + print $queues{$key}->{queue},$queues{$key}->{handle}, ".cdef ", $queues{$key}->{queue},$queues{$key}->{handle}, ",8,*\n"; + } + exit 0; +} + +sub by_handle { + return $a cmp $b; +} + +foreach my $key (sort by_handle keys %queues) { + print $queues{$key}->{queue},$queues{$key}->{handle}, ".value ",$queues{$key}->{sent}, "\n"; +} +# +# vim:syntax=perl \ No newline at end of file -- cgit v1.2.3