]> gitweb.fluxo.info Git - slackbuilds.git/commitdiff
munin update
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Tue, 5 Dec 2006 17:52:49 +0000 (17:52 +0000)
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Tue, 5 Dec 2006 17:52:49 +0000 (17:52 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@852 370017ae-e619-0410-ac65-c121f96126d4

net/analyzer/munin/munin.build
net/analyzer/munin/qos_ [new file with mode: 0755]

index 2dd27f7ed920b6debc145eaf683636d43f761fcc..8b2f79bb6b8df54260d44cf4948c9d755b04ca96 100755 (executable)
@@ -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 (executable)
index 0000000..98bc80e
--- /dev/null
@@ -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<n>   - Queue with handle <n> (ex ignore_queue0 for root queue) not be plotted
+#       label_name<n>     - Queue with handle <n> 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(" ", <TEXT>);
+  if ($qdisc eq "backlog") {
+    ($qdisc, $queue, $handle) = split(" ", <TEXT>);
+  }
+  ($one, $sent) = split(" ", <TEXT>);
+  $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