aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/fetch-portlist.sh42
-rwxr-xr-xtools/ping-graph.pl62
2 files changed, 0 insertions, 104 deletions
diff --git a/tools/fetch-portlist.sh b/tools/fetch-portlist.sh
deleted file mode 100755
index 978b590..0000000
--- a/tools/fetch-portlist.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-print_range() {
- FIRST=$1
- LAST=$2
- if [ "$1" = "$2" ]; then
- echo $FIRST
- else
- echo $FIRST-$LAST
- fi
-}
-
-walk_ports() {
- IP=$1
- COMMUNITY=$2
-
- FIRST_PORT=
- LAST_PORT=
-
- for PORT in $( snmpwalk -Os -m IF-MIB -v 2c -c $COMMUNITY $IP ifDescr 2>/dev/null | grep -E ' ge|et|xe' | cut -d. -f2 | cut -d" " -f1 ); do
- if ! snmpget -m IF-MIB -v 2c -c $COMMUNITY $IP ifHCInOctets.$PORT 2>/dev/null | grep -q 'No Such Instance'; then
- if [ "$LAST_PORT" ] && [ `expr $LAST_PORT + 1` = $PORT ]; then
- LAST_PORT=$PORT
- else
- if [ "$LAST_PORT" ]; then
- print_range $FIRST_PORT $LAST_PORT
- fi
- FIRST_PORT=$PORT
- LAST_PORT=$PORT
- fi
- fi
- done
-
- print_range $FIRST_PORT $LAST_PORT
-}
-
-COMMUNITY=$1
-IP=$2
-SYSNAME=$3
-PORTS=$( walk_ports $IP $COMMUNITY | tr "\n" "," | sed 's/,$//' )
-
-echo "insert into switchtypes values ('$SYSNAME','$PORTS',true);"
-echo "insert into switches values (default,'$IP','$SYSNAME','$SYSNAME',null,default, default, '1 minute', '$COMMUNITY');"
-
diff --git a/tools/ping-graph.pl b/tools/ping-graph.pl
deleted file mode 100755
index 2cd6996..0000000
--- a/tools/ping-graph.pl
+++ /dev/null
@@ -1,62 +0,0 @@
-#! /usr/bin/perl
-
-# Makes latency-against-time graphs, one per switch.
-
-use warnings;
-use strict;
-use DBI;
-use lib '../include';
-use nms;
-
-BEGIN {
- require "../include/config.pm";
- eval {
- require "../include/config.local.pm";
- };
-}
-
-my $dbh = db_connect();
-my $switches = $dbh->selectall_hashref('SELECT sysname,switch FROM switches ORDER BY sysname', 'sysname');
-if (1) {
- my %switchfds = ();
- while (my ($sysname, $switch) = each %$switches) {
- print "$sysname -> $switch->{switch}\n";
- open my $fh, ">", "$sysname.txt"
- or die "$sysname.txt: $!";
- $switchfds{$switch->{'switch'}} = $fh;
- }
-
- my $q = $dbh->prepare('SELECT switch,EXTRACT(EPOCH FROM updated),latency_ms FROM ping');
- $q->execute;
-
- my $i = 0;
- while (my $ref = $q->fetchrow_arrayref) {
- next if (!defined($ref->[2]));
- my $fh = $switchfds{$ref->[0]};
- next if (!defined($fh));
- print $fh $ref->[1], " ", $ref->[2], "\n";
- if (++$i % 1000000 == 0) {
- printf "%dM records...\n", int($i / 1000000);
- }
- }
-
- while (my ($sysname, $switch) = each %$switches) {
- close $switchfds{$switch->{'switch'}};
- }
-}
-
-while (my ($sysname, $switch) = each %$switches) {
- print "$sysname -> $switch->{switch}\n";
- open my $gnuplot, "|-", "gnuplot"
- or die "gnuplot: $!";
- print $gnuplot <<"EOF";
-set timefmt "%s"
-set xdata time
-set format x "%d/%m %H:%M"
-set term png size 1280,720
-set output '$sysname.png'
-set yrange [0:200]
-plot "$sysname.txt" using (int(\$1)):2 ps 0.1
-EOF
- close $gnuplot;
-}