1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-24 09:57:09 +00:00

Reduce number of categories

This commit is contained in:
dipohl 2017-02-23 20:45:01 +01:00
parent f5b816df9e
commit 99542938b1
20 changed files with 30 additions and 30 deletions

View file

@ -21,22 +21,22 @@ if [ "$1" = "config" ]
then
echo multigraph dbox_adsl_bw
echo graph_title DartyBox Adsl Bandwidth
echo graph_category DartyBox
echo graph_category other
echo up.label UpStream
echo down.label DownStream
echo multigraph dbox_adsl_att
echo graph_title DartyBox Adsl Attenuation
echo graph_category DartyBox
echo graph_category other
echo up.label UpStream
echo down.label DownStream
echo multigraph dbox_adsl_snr
echo graph_title DartyBox Adsl SignalNoise Ratio
echo graph_category DartyBox
echo graph_category other
echo up.label UpStream
echo down.label DownStream
echo multigraph dbox_adsl_pkt
echo graph_title DartyBox Adsl Packets
echo graph_category DartyBox
echo graph_category other
echo up.label UpStream
echo down.label DownStream
echo up_c.label UpStream "(Correctable)"
@ -57,7 +57,7 @@ then
echo down_u.min 0
echo multigraph dbox_adsl_uptime
echo graph_title DartyBox Adsl Uptime
echo graph_category DartyBox
echo graph_category other
echo graph_vlabel days
echo uptime.label Uptime

View file

@ -1,156 +0,0 @@
#!/usr/bin/perl -w
#
# tor-bandwidth-usage - munin plugin to monitor Tor traffic
#
# To use this plugin you need the following:
# o Enable accounting on torrc configuration file (even if you dont want to limit bandwidth usage,
# just put a huge value for on AccountingMax)
# example:
# AccountingStart day 12:00
# AccountingMax 100 GB
# o Enable CookieAuthentication (CookieAuthentication 1 in torrc) or define a HashedControlPassword
# o Add something like the following to /etc/munin/plugin-conf.d/munin-node:
# [tor-bandwidth-usage]
# user debian-tor
# env.cookiefile /var/run/tor/control.authcookie
#
#
# tested with Tor releases: 0.2.1.28, 0.2.1.29, 0.2.2.35
#
# Author: tazoi <dev AT tazoi DOT it>, based on a plugin by Ævar Arnfjörð Bjarmason <avarab@gmail.com>
#
# Parameters understood (defined in file /etc/munin/plugin-conf.d/munin-node or in environment)
# host - Change which host to graph (default localhost)
# port - Change which port to connect to (default 9051)
# password - Plain-text control channel password (see torrc
# HashedControlPassword parameter)
# cookiefile - Name of the file containing the control channel cookie
# (see torrc CookieAuthentication parameter)
#
# Using HashedControlPassword authentication has the problem that you
# must include the plain-text password in the munin config file. To
# have any effect, that file shouldn't be world-readable.
#
# If you're using CookieAuthentication, you should run this plugin as
# a user which has read access to the tor datafiles. Also note that
# bugs in versions up to and including 0.1.1.20 prevent
# CookieAuthentication from working.
#
# Usage: place in /etc/munin/plugins (or link it there using ln -s)
#
#%# family=contrib
#%# capabilities=autoconf
use strict;
use feature ':5.10';
use IO::Socket::INET;
use Munin::Plugin;
# Config
my $address = $ENV{host} || "localhost";
my $port = $ENV{port} || 9051;
# Don't edit below this line
sub Authenticate
{
my ($socket) = @_;
my $authline = "AUTHENTICATE";
if (defined($ENV{cookiefile})) {
if (open(COOKIE, "<$ENV{cookiefile}")) {
my $cookie;
binmode COOKIE;
$authline .= " ";
while (read(COOKIE, $cookie, 32)) {
foreach my $byte (unpack "C*", $cookie) {
$authline .= sprintf "%02x", $byte;
}
}
close COOKIE;
}
} elsif (defined($ENV{password})) {
$authline .= ' "' . $ENV{password} . '"';
}
say $socket "$authline";
my $replyline = <$socket>;
if (substr($replyline, 0, 1) != '2') {
$replyline =~ s/\s*$//;
return "Failed to authenticate: $replyline";
}
return;
}
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
# Try to connect to the daemon
my $socket = IO::Socket::INET->new("$address:$port") or my $failed = 1;
if ($failed) {
say "no (failed to connect to $address port $port)";
exit 1;
}
my $msg = Authenticate($socket);
if (defined($msg)) {
say $socket "QUIT";
close($socket);
say "no ($msg)";
exit 1;
}
say $socket "QUIT";
close($socket);
say "yes";
exit 0;
}
if ($ARGV[0] and $ARGV[0] eq "config") {
say "graph_order down up";
say "graph_title Tor traffic";
say "graph_args --base 1000";
say "graph_vlabel bits in (-) / out (+) per \${graph_period}";
say "graph_category network";
say "graph_info This graph shows the traffic through this Tor node.";
say "down.label received";
say "down.type DERIVE";
say 'down.graph no';
say "down.cdef down,8,*";
say "down.min 0";
say "up.label b/s";
say "up.type DERIVE";
say "up.negative down";
say "up.cdef up,8,*";
say "up.min 0";
exit 0;
}
my $socket = IO::Socket::INET->new("$address:$port")
or die("Couldn't connect to $address port $port: $!");
my $msg = Authenticate($socket);
if (defined($msg)) {
say $socket "QUIT";
close($socket);
die "$msg\n";
}
say $socket "GETINFO accounting/bytes";
my $down = 0;
my $up = 0;
my $replyline = <$socket>;
chomp($replyline);
if ($replyline =~ /^250-accounting\/bytes=(\d+)\s(\d+)/) {
$down = $1;
$up = $2;
} else {
die "Failed to get accounting info: $replyline\n";
}
say $socket "QUIT";
close($socket);
say "down.value $down";
say "up.value $up";
exit 0;

View file

@ -1,119 +0,0 @@
#!/usr/bin/php
<?php
$cookiepath = "/etc/tor/control_auth_cookie";
$controlport = 9051;
// Nothing to change down here...
$cmd = $argv['1'];
$cookie = file_get_contents($cookiepath);
if ($cmd == "config") {
print "graph_title Connections\n";
print "graph_args -l 0 --base 1000\n";
print "graph_vlabel connections\n";
print "graph_category Tor\n";
print "graph_info This graph shows the number of Tor OR connections.\n";
print "graph_period second\n";
print "new.label new\n";
print "new.type GAUGE\n";
print "new.max 50000\n";
print "new.min 0\n";
print "launched.label launched\n";
print "launched.type GAUGE\n";
print "launched.max 50000\n";
print "launched.min 0\n";
print "connected.label connected\n";
print "connected.type GAUGE\n";
print "connected.max 50000\n";
print "connected.min 0\n";
print "failed.label failed\n";
print "failed.type GAUGE\n";
print "failed.max 50000\n";
print "failed.min 0\n";
print "closed.label closed\n";
print "closed.type GAUGE\n";
print "closed.max 50000\n";
print "closed.min 0\n";
exit;
} elseif ($cmd == "autoconf") {
$socket = fsockopen("tcp://127.0.0.1", $controlport);
fputs($socket, "AUTHENTICATE \"".$cookie."\"\n");
$buffer = fgets($socket, 1024);
if (ereg("250", $buffer)) echo "Yes";
else echo "No (".trim($buffer).")";
fclose($socket);
exit;
}
$socket = fsockopen("tcp://127.0.0.1", $controlport);
fputs($socket, "AUTHENTICATE \"".$cookie."\"\n");
$buffer .= fgets($socket, 4096);
if (!ereg("250", $buffer)) {
echo "Unable to connect to Tor ControlPort (".$buffer.")";
fclose($socket);
exit;
} else {
$buffer = fputs($socket, "GETINFO orconn-status\n");
$buffer = fgets($socket, 1024);
$buffer = fgets($socket, 1024);
while (strlen($buffer) > 3) {
$bits = explode(" ", $buffer);
$connections[trim($bits['1'])]++;
$buffer = fgets($socket, 1024);
}
if (!empty($connections['NEW'])) echo "new.value ".$connections['NEW']."\n";
else echo "new.value 0\n";
if (!empty($connections['LAUNCHED'])) echo "launched.value ".$connections['LAUNCHED']."\n";
else echo "launched.value 0\n";
if (!empty($connections['CONNECTED'])) echo "connected.value ".$connections['CONNECTED']."\n";
else echo "connected.value 0\n";
if (!empty($connections['FAILED'])) echo "failed.value ".$connections['FAILED']."\n";
else echo "failed.value 0\n";
if (!empty($connections['CLOSED'])) echo "closed.value ".$connections['CLOSED']."\n";
else echo "closed.value 0\n";
}
fclose($socket);
?>

View file

@ -1,76 +0,0 @@
#!/usr/bin/php
<?php
$cookiepath = "/etc/tor/control_auth_cookie";
$controlport = 9051;
// Nothing to change down here...
$cmd = $argv['1'];
$cookie = file_get_contents($cookiepath);
if ($cmd == "config") {
echo "graph_title Traffic\n";
echo "graph_args --base 1000 \n";
echo "graph_vlabel bits in (-) / out (+) per ${graph_period}\n";
echo "graph_category Tor\n";
echo "down.label Download\n";
echo "down.type GAUGE\n";
echo "up.label Upload\n";
echo "up.type GAUGE\n";
exit;
} elseif ($cmd == "autoconf") {
$socket = fsockopen("tcp://127.0.0.1", $controlport);
fputs($socket, "AUTHENTICATE \"".$cookie."\"\n");
$buffer = fgets($socket, 1024);
if (ereg("250", $buffer)) echo "Yes";
else echo "No (".trim($buffer).")";
fclose($socket);
exit;
}
$socket = fsockopen("tcp://127.0.0.1", $controlport);
fputs($socket, "AUTHENTICATE \"".$cookie."\"\n");
$buffer .= fgets($socket, 4096);
if (!ereg("250", $buffer)) {
echo "Unable to connect to Tor ControlPort (".$buffer.")";
fclose($socket);
exit;
} else {
fputs($socket, "SETEVENTS bw\n");
$buffer = fgets($socket, 1024);
$buffer = fgets($socket, 1024);
$bits = explode(" ", $buffer);
echo "down.value ".($bits['2'] / 1024)."\n";
echo "up.value ".($bits['3'] / 1024)."\n";
}
fclose($socket);
?>

View file

@ -1,151 +0,0 @@
#!/usr/bin/perl -w
#
# Munin plugin to monitor Tor routers
#
# Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>, based on a plugin by Ge van Geldorp <ge@gse.nl>
#
# Parameters understood:
#
# host - Change which host to graph (default localhost)
# port - Change which port to connect to (default 9051)
# password - Plain-text control channel password (see torrc
# HashedControlPassword parameter)
# cookiefile - Name of the file containing the control channel cookie
# (see torrc CookieAuthentication parameter)
#
# Using HashedControlPassword authentication has the problem that you must
# include the plain-text password in the munin config file. To have any
# effect, that file shouldn't be world-readable.
# If you're using CookieAuthentication, you should run this plugin as a user
# which has read access to the tor datafiles. Also note that bugs in versions
# up to and including 0.1.1.20 prevent CookieAuthentication from working.
#
# Usage: place in /etc/munin/node.d/ (or link it there using ln -s)
#
# Parameters understood:
# config (required)
# autoconf (optional - used by munin-config)
#
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=contrib
#%# capabilities=autoconf
use strict;
use IO::Socket::INET;
# Config
our $address = $ENV{host} || "localhost"; # Default: localhost
our $port = $ENV{port} || 9051; # Default: 9051
# Don't edit below this line
sub Authenticate
{
my ($socket) = @_;
my $authline = "AUTHENTICATE";
if (defined($ENV{cookiefile})) {
if (open(COOKIE, "<$ENV{cookiefile}")) {
binmode COOKIE;
my $cookie;
$authline .= " ";
while (read(COOKIE, $cookie, 32)) {
foreach my $byte (unpack "C*", $cookie) {
$authline .= sprintf "%02x", $byte;
}
}
close COOKIE;
}
} elsif (defined($ENV{password})) {
$authline .= ' "' . $ENV{password} . '"';
}
print $socket "$authline\r\n";
my $replyline = <$socket>;
if (substr($replyline, 0, 1) != '2') {
$replyline =~ s/\s*$//;
return "Failed to authenticate: $replyline";
}
return;
}
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
# Try to connect to the daemon
my $socket = IO::Socket::INET->new("$address:$port")
or my $failed = 1;
if ($failed) {
print "no (failed to connect to $address port $port)\n";
exit 1;
}
my $msg = Authenticate($socket);
if (defined($msg)) {
print $socket "QUIT\r\n";
close($socket);
print "no ($msg)\n";
exit 1;
}
print $socket "QUIT\r\n";
close($socket);
print "yes\n";
exit 0;
}
if ($ARGV[0] and $ARGV[0] eq "config") {
print "graph_title Routers\n";
print "graph_args -l 0\n";
print "graph_vlabel routers\n";
print "graph_category Tor\n";
print "graph_info This graph shows the number of known Tor ORs.\n";
print "ors.label routers\n";
print "ors.type GAUGE\n";
print "ors.info The number of known Tor ORs (onion routers)\n";
exit 0;
}
my $socket = IO::Socket::INET->new("$address:$port")
or die("Couldn't connect to $address port $port: $!");
my $msg = Authenticate($socket);
if (defined($msg)) {
print $socket "QUIT\r\n";
close($socket);
die "$msg\n";
}
print $socket "GETINFO ns/all\r\n";
my $replyline = <$socket>;
if (substr($replyline, 0, 1) != '2') {
print $socket "QUIT\r\n";
close($socket);
$replyline =~ s/\s*$//;
die "Failed to get orconn-status info: $replyline\n";
}
my $count;
while (! (($replyline = <$socket>) =~ /^\.\s*$/)) {
my @reply = split(/\s+/, $replyline);
$count++ if $reply[0] eq 'r';
}
$replyline = <$socket>;
if (substr($replyline, 0, 1) != '2') {
print $socket "QUIT\r\n";
close($socket);
$replyline =~ s/\s*$//;
die "Failed to authenticate: $replyline\n";
}
print $socket "QUIT\r\n";
close($socket);
print "ors.value $count\n";
exit 0;
# vim:syntax=perl

View file

@ -1,28 +0,0 @@
#!/bin/sh
#
# (c)2010 lists@nerdbynature.de
#
# Get accounting information from a running Tor server.
#
COOKIE=/opt/tor/.tor/control_auth_cookie
PORT=9051
if [ "$1" = config ]; then
echo "graph_title Tor Traffic"
echo "graph_args --base 1000"
echo "graph_vlabel bytes in / out"
echo "graph_category network"
echo "down.label Download"
echo "down.type GAUGE"
echo "up.label Upload"
echo "up.type GAUGE"
exit 0
fi
/bin/echo -e "AUTHENTICATE \"`cat $COOKIE`\"\nGETINFO accounting/bytes\nQUIT" | nc localhost $PORT | \
awk -F= '/accounting\/bytes/ {print $2}' | \
tr -d '\015' | \
awk '{print "down.value "$1 "\nup.value "$2}'