diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c70ce7756b4a86384963632f40c996d9c6e34e73 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/*_amd64 +/*.deb diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1a48379e8d93b375f5ec1bf5b689c4daf642fd23 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM debian:stretch +WORKDIR /root/ +COPY mp-rude mp-rude +COPY build.sh build.sh +RUN ./build.sh +CMD tar c *.deb diff --git a/README.md b/README.md index 39a672947f407cf59d96aff4850f9b3e4e0c93fa..139070871893dadd80d86e322953985444f82921 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,31 @@ -**Running rude/crude on measurement beacons** +# Running rude/crude and traceroute on measurement beacons -Filer -etc/init.d/mp-rude - start/stop rude crude -etc/cron.d/mp-rude - cron to start/stop every day a noon +This package installs an init-script for managing rude/crude, and +scripts for starting and stopping traceroute-measurements. -tools/rude-config-maker - make rude configs from rude-list.conf -tools/mp-ut.sh - script to roll out files -tools/mp-cmd - script to run commands on mp's -tools/udp-buf-check - sjekk udp drops per prosess +Configuration files are managed in /etc/mp-rude, where rude-list.conf +must be managed by an administrator or a configuration utility. -rude-list.conf lists of rude/traceroute destinations -mp-list.txt list of nodes +## The following files are of interest: +* /etc/init.d/mp-rude - start/stop rude crude +* /etc/cron.d/mp-rude - cron to start/stop every day a noon -roll out rude/crude to /usr/local/bin with debian packages. +* /usr/bin/rude-config-maker - make rude configs from rude-list.conf +* /usr/bin/mp-cmd - script to run commands on mp's +* /usr/bin/udp-buf-check - sjekk udp drops per prosess + +* /etc/mp-rude/rude-list.conf lists of rude/traceroute destinations + + +## Building + +### Using Docker + +``` +docker build --no-cache -t mp-rude-debian . +docker run -i mp-rude-debian | tar x +``` + +### Manually + +See build.sh. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..f85afb3ef5d174e6318ed17eeb6bfb197ddb30e2 --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +set -e + +rm -f *.deb + +apt-get update +apt-get -y upgrade + +package="mp-rude" +version="1.2.30" +#version=$(git describe|perl -p -e 'chomp;s/v([^-]+)(-(\d+)-g.+)?$/\1+\3/;s/\+$//') + + +target="${package}_${version}_all" + +rm -rf "$target" +cp -dR --preserve=mode "${package}" "$target" +sed -i -e "s/{VERSION}/${version}/" "${target}/DEBIAN/control" +dpkg -b "$target" + diff --git a/etc/cron.d/mp-rude b/etc/cron.d/mp-rude deleted file mode 100644 index a5a8fcad920fbf5c104aeddcda394343ff7ffdfe..0000000000000000000000000000000000000000 --- a/etc/cron.d/mp-rude +++ /dev/null @@ -1,4 +0,0 @@ -MAILTO=oak@uninett.no -0 0 * * * root /usr/sbin/service mp-rude restart -59 23 * * * root /etc/mp-rude/stop.sh 50 -0 0 * * * root /etc/mp-rude/start.sh diff --git a/etc/init.d/mp-rude b/etc/init.d/mp-rude deleted file mode 100755 index 76f2a5259747f5e959a3a16353e0606e34e61900..0000000000000000000000000000000000000000 --- a/etc/init.d/mp-rude +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env sh -### BEGIN INIT INFO -# Provides: mp-rude -# Required-Start: $network -# Required-Stop: $network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: rude jobs -# Description: Tool for rude running -### END INIT INFO - -PATH=/sbin:/bin:/usr/sbin:/usr/bin -[ -f /etc/default/rcS ] && . /etc/default/rcS -. /lib/lsb/init-functions -RUDE=/usr/local/bin/rude -CRUDE=/usr/local/bin/crude -PIPE=/tmp/mp-rude/crude.pipe - -do_start() { - log_begin_msg "Starting rude/crude..." - HOST=$(hostname) - DATE=$(date +%Y-%m-%d) - LOG=/tmp/mp-rude/$HOST-$DATE.crude - - if test ! -p $PIPE ; then - mkfifo $PIPE - fi - start-stop-daemon --start --background --pidfile /var/run/mp-rude.pid -m --exec $RUDE -- -P 50 -s /etc/mp-rude/rude.conf - start-stop-daemon --start --background --pidfile /var/run/mp-crude.pid -m --exec $CRUDE -- -P 50 -k -l $PIPE - start-stop-daemon --start --background --pidfile /var/run/mp-crude-zip.pid -m --exec /etc/mp-rude/mp-rude-zip -- $PIPE $LOG.gz - log_end_msg $? -} - -do_stop() { - log_begin_msg "Stopping rude/crude..." - start-stop-daemon --stop --pidfile /var/run/mp-rude.pid - start-stop-daemon --stop --pidfile /var/run/mp-crude.pid --signal INT - start-stop-daemon --stop --pidfile /var/run/mp-crude-zip.pid --signal INT - sleep 1 - fuser -k $PIPE # kill all processes using pipe - log_end_msg $? -} - -case "$1" in - start) - do_start - ;; - restart|reload|force-reload) - do_stop - do_start - ;; - stop) - do_stop - ;; - status) - ps -ef | grep [r]ude - ;; - *) - echo "Usage: $0 start|stop" >&2 - exit 3 - ;; -esac diff --git a/etc/mp-rude/make-rude.sh b/etc/mp-rude/make-rude.sh deleted file mode 100644 index 6f2822daceaa05962874cc92023f837780522f63..0000000000000000000000000000000000000000 --- a/etc/mp-rude/make-rude.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -mp-rude=/usr/local/mp-rude -cd $mp-rude/etc -$mp-rude/tools/rude-config-maker -target $(hostname -f) rude-list.conf > rude.conf - - - diff --git a/etc/mp-rude/mp-rude-zip b/etc/mp-rude/mp-rude-zip deleted file mode 100755 index 71d5741a8468fd15408c2ed3cac2051fbee2805f..0000000000000000000000000000000000000000 --- a/etc/mp-rude/mp-rude-zip +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -cat $1 | /bin/gzip > $2 - diff --git a/etc/mp-rude/start.conf b/etc/mp-rude/start.conf deleted file mode 100644 index 8d56e4ac6e751d3cf4f841cb406638b5062e5344..0000000000000000000000000000000000000000 --- a/etc/mp-rude/start.conf +++ /dev/null @@ -1,5 +0,0 @@ -date=`date +%Y-%m-%d` -bin=/etc/mp-rude -logpath=/tmp/mp-rude -trace=$bin/trace.sh -traceconf=/etc/mp-rude/trace.conf diff --git a/etc/mp-rude/start.sh b/etc/mp-rude/start.sh deleted file mode 100755 index e6fa04dba7c8cf5e8f5b6e954bc20dfe29e3d296..0000000000000000000000000000000000000000 --- a/etc/mp-rude/start.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -source /etc/mp-rude/start.conf - -log=$logpath/$date/traceroute_$1 - -#Start traceroute -for i in `cat $traceconf` ; do - $trace $i 23:59 2> /dev/null > /dev/null & - echo "$!" >> $logpath/pids -done - diff --git a/etc/mp-rude/stop.sh b/etc/mp-rude/stop.sh deleted file mode 100755 index 0d1f661ce1713153bcd77b6bb6fabf0a2b965a13..0000000000000000000000000000000000000000 --- a/etc/mp-rude/stop.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -source /etc/mp-rude/start.conf - -if [ ! -e $logpath/pids ] -then - echo "Pid file does not exist: $logpath/pids" - exit -fi - -if test $1. != . ; then - sleep $1 # wait a few seconds closer to midnight -fi - -for i in $(cat $logpath/pids); do kill $i; done - -rm $logpath/pids - diff --git a/etc/mp-rude/trace.sh b/etc/mp-rude/trace.sh deleted file mode 100755 index ae7a2598115919428823d84a0f3716cf1bf0dfb3..0000000000000000000000000000000000000000 --- a/etc/mp-rude/trace.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -source /etc/mp-rude/start.conf - -mkdir -p $logpath/$date -log=$logpath/$date/traceroute_$1 - -if test $2. -ne . ; then - end=$(date --date "$2" +%s) -else - end=$(date --date "2099-12-31" +%s) -fi - -# ( flock -n 9 || ( echo "=== could not start traceroute - locked $log.lock ===" ; exit 1 ) -# > $log.log - - while test $(date +%s) -lt $end ; do - date "+%s starttime %T" | gzip -c >> $log.gz - traceroute -q 6 -n $1 2> /dev/null | gzip -c >> $log.gz - sleep 60 - done -#) 9> $log.lock & -#echo "$!" >> $logpath/pids - diff --git a/mp-list.txt b/mp-list.txt deleted file mode 100644 index 494aded8d069a8e7446e3b31e51414ee9dd501e1..0000000000000000000000000000000000000000 --- a/mp-list.txt +++ /dev/null @@ -1,31 +0,0 @@ -alesund-mp.hials.no -alta-mp.hifm.no -bergen-mp.uib.no -drammen-mp.hibu.no -forde-mp.hisf.no -fredrikstad-mp.hiof.no -gjovik-mp.hig.no -grimstad-mp.uia.no -halden-mp.hiof.no -hamar-mp.hihm.no -harstad-mp.hih.no -haugesund-mp.hsh.no -kalvskinnet-mp.hist.no -kristiansand-mp.uia.no -kunnskapsv-mp.hioa.no -lillehammer-mp.hil.no -molde-mp.himolde.no -narvik-mp.hin.no -nesna-mp.hinesna.no -ntnu-mp.ntnu.no -nyalesund-mp.uninett.no -oslo-mp.uio.no -pil32-mp.hioa.no -porsgrunn-mp.hit.no -sogndal-mp.hisf.no -stavanger-mp.uis.no -steinkjer-mp.hint.no -stord-mp.hsh.no -svalbard-mp.unis.no -tromso-mp.uit.no -volda-mp.hivolda.no diff --git a/mp-rude/DEBIAN/control b/mp-rude/DEBIAN/control new file mode 100644 index 0000000000000000000000000000000000000000..362b2acb117aa3eef09c71b9f2b9e9f1c7116f33 --- /dev/null +++ b/mp-rude/DEBIAN/control @@ -0,0 +1,11 @@ +Package: mp-rude +Priority: extra +Section: uninett +Architecture: all +Depends: rude, crude, traceroute, perl-base, cron, libstatistics-linefit-perl, libjson-xs-perl +Maintainer: kolbjorn.barmen@uninett.no +Version: {VERSION} +Provides: mp-rude +Replaces: mp-rude +Description: Software for measuring network using rude/crude and traceroute. + diff --git a/mp-rude/DEBIAN/postinst b/mp-rude/DEBIAN/postinst new file mode 100755 index 0000000000000000000000000000000000000000..cb11d5b770cf523e4f17ea07c06393e4c0e735e5 --- /dev/null +++ b/mp-rude/DEBIAN/postinst @@ -0,0 +1,14 @@ +#! /bin/sh + +chmod 755 \ + /usr/bin/rude-config-maker \ + /usr/bin/udp-buf-check + +for conf in rude-list rude trace ; do + touch /etc/mp-rude/${conf}.conf +done + +systemctl enable mp-rude.service + +[ -s /var/lib/mp-rude/crude.pipe ] || rm -f /var/lib/mp-rude/crude.pipe +mkfifo /var/lib/mp-rude/crude.pipe diff --git a/mp-rude/etc/cron.d/mp-rude b/mp-rude/etc/cron.d/mp-rude new file mode 100644 index 0000000000000000000000000000000000000000..0f911eac2c323ff0be597425518b8de4046cd28c --- /dev/null +++ b/mp-rude/etc/cron.d/mp-rude @@ -0,0 +1,9 @@ +MAILTO=root + +# rude/crude +0 0 * * * root /usr/sbin/service mp-rude restart + +# traceroute +50 23 * * * root /usr/share/mp-rude/make-rude.sh +59 23 * * * root /usr/share/mp-rude/stop.sh 50 +0 0 * * * root /usr/share/mp-rude/start.sh diff --git a/mp-rude/etc/init.d/mp-rude b/mp-rude/etc/init.d/mp-rude new file mode 100755 index 0000000000000000000000000000000000000000..ff7e50aa704cf51a210eccfe9435ff8872380c9c --- /dev/null +++ b/mp-rude/etc/init.d/mp-rude @@ -0,0 +1,71 @@ +#! /usr/bin/env sh +### BEGIN INIT INFO +# Provides: mp-rude +# Required-Start: $network +# Required-Stop: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: rude jobs +# Description: Tool for rude running +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +[ -f /etc/default/rcS ] && . /etc/default/rcS +. /lib/lsb/init-functions +RUDE=/usr/bin/rude +CRUDE=/usr/bin/crude +PIPE=/var/lib/mp-rude/crude.pipe +PIPE2=/var/lib/mp-rude/crude2.pipe + +do_start() { + log_begin_msg "Starting rude/crude..." + HOST=$(hostname) + DATE=$(date +%Y-%m-%d-%T) + LOG=/var/lib/mp-rude/$HOST-$DATE + + mkdir -p "/var/log/mp-rude" + + if test ! -p $PIPE ; then + mkfifo $PIPE + fi + if test ! -p $PIPE2 ; then + mkfifo $PIPE2 + fi + start-stop-daemon --start --background --pidfile /run/mp-rude.pid -m --exec $RUDE -- -P 50 -s /etc/mp-rude/rude.conf + start-stop-daemon --start --background --pidfile /run/mp-crude.pid -m --exec $CRUDE -- -P 50 -k -l $PIPE + start-stop-daemon --start --background --pidfile /run/mp-crude-zip.pid -m --exec /usr/share/mp-rude/mp-rude-zip -- $PIPE $LOG.crude.gz $PIPE2 + start-stop-daemon --start --background --pidfile /run/mp-crude-ana.pid -m --exec /usr/share/mp-rude/mp-rude-ana -- logs-uninett-mp-rude $PIPE2 /var/log/mp-rude/mp-rude-events.log + log_end_msg $? +} + +do_stop() { + log_begin_msg "Stopping rude/crude..." + start-stop-daemon --stop --pidfile /run/mp-rude.pid + start-stop-daemon --stop --pidfile /run/mp-crude.pid --signal INT + start-stop-daemon --stop --pidfile /run/mp-crude-zip.pid --signal INT + start-stop-daemon --stop --pidfile /run/mp-crude-ana.pid --signal INT + sleep 1 + fuser -k $PIPE # kill all processes using pipe + log_end_msg $? + sleep 3 +} + +case "$1" in + start) + do_start + ;; + restart|reload|force-reload) + do_stop + do_start + ;; + stop) + do_stop + ;; + status) + ps -ef | grep [r]ude + ;; + *) + echo "Usage: $0 start|stop" >&2 + exit 3 + ;; +esac diff --git a/mp-rude/etc/mp-rude/start.conf b/mp-rude/etc/mp-rude/start.conf new file mode 100644 index 0000000000000000000000000000000000000000..4c7b5ab213480154fcb01a938dc689b517d6c035 --- /dev/null +++ b/mp-rude/etc/mp-rude/start.conf @@ -0,0 +1,5 @@ +date="$(date +%Y-%m-%d)" +bin="/usr/share/mp-rude" +logpath="/var/lib/mp-rude" +trace="${bin}"/trace.sh +traceconf="/etc/mp-rude/trace.conf" diff --git a/lib/systemd/system/mp-rude.service b/mp-rude/lib/systemd/system/mp-rude.service similarity index 100% rename from lib/systemd/system/mp-rude.service rename to mp-rude/lib/systemd/system/mp-rude.service diff --git a/tools/rude-config-maker b/mp-rude/usr/bin/rude-config-maker old mode 100644 new mode 100755 similarity index 95% rename from tools/rude-config-maker rename to mp-rude/usr/bin/rude-config-maker index c4414fca3495da555d86e5c0bc5699932cb4fad8..622b5fc85db605262e6b38f18dd3e8756bb4c726 --- a/tools/rude-config-maker +++ b/mp-rude/usr/bin/rude-config-maker @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#! /usr/bin/env perl # make rude config files from host lists # format : src dst1 dst2 ... @@ -52,7 +52,7 @@ foreach $peer ( sort(keys %peers)){ $ip=gethostbyname($dst); if ($ip && $gotit ){ printf $out "0 %d ON 300%d %s:10001 CONSTANT 100 64\n", $flow_no, $flow_no, inet_ntoa($ip); - printf $out "86390000 %d OFF\n", $flow_no; # varer en dag -10 sek + printf $out "86410000 %d OFF\n", $flow_no; # varer en dag -10 sek @$tracetarget{$src} = () if ! $tracetarget{$src}; push (@{$tracetarget{$src}}, inet_ntoa($ip) ); } diff --git a/tools/udp-buf-check b/mp-rude/usr/bin/udp-buf-check similarity index 94% rename from tools/udp-buf-check rename to mp-rude/usr/bin/udp-buf-check index 433273e59f536f6a0ef01aa3cd7736dfafb17343..dc3cb89cf277aa752da1f89f418e92b0eace9c88 100755 --- a/tools/udp-buf-check +++ b/mp-rude/usr/bin/udp-buf-check @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#! /usr/bin/env perl $sov = shift || 1; while(1){ open UDP, "> "${2}" diff --git a/mp-rude/usr/share/mp-rude/qstream-gap-ana b/mp-rude/usr/share/mp-rude/qstream-gap-ana new file mode 100755 index 0000000000000000000000000000000000000000..a4af57b219e9a5f73ac4e5fc0d9daa5b46a5593b --- /dev/null +++ b/mp-rude/usr/share/mp-rude/qstream-gap-ana @@ -0,0 +1,754 @@ +#!/usr/bin/perl + +# use PDL; +# use PDL::Ops; +# use PDL::Fit::Polynomial; +use Socket; +use Statistics::LineFit; +use Date::Format; + +# date --date 'jan 1 2000' +%s +$min_tx=946681200; +$max_tx=1893452400; # 2030-01-01 +$maxseqreorder=1000; # +$max_small_gap=10; # the max size of a small graph +$max_small_graphs=20; +$max_big_graphs=20; +$late_delay=3000; # ms to doom a packet late +my %src_adr=(), %dst_adr=(); + +require "newgetopt.pl"; +$usage="$0 '[-title text] [-minloss n] [-win n] [-graph file] [max-small-graphs n] [-outdir dir] [-head|-rhead] [-id id] [-names file] [-json file] [-v] [file]... +Analyse gaps in a crude packet log + - output a list of statistical qos parameters as text or json + - make linear regression to see the delay trend around a gap + - make curves to show the delay change before and after a gap +Parameters + -rhead n - output headers so that R can make the headings in the text tables + -max-small-graphs n - limit number(20) of graphs to output from small few packet losses + -slep n - number(1000) of crude lines in the circular buffer + -index Elastic Search index name to use + -json file - filename to store json event documents (intended for logstash ?) +"; +&NGetOpt( 'h', 'help', 'id=s', 'slep=s', 'minloss=s', 'win=s', 'max-small-graphs=s', 'head', 'rhead', 'graph=s', 'outdir=s', 'title=s', 'names=s', 'json=s', 'index=s', 'v') || die "$!" . $usage ."\n"; + +if ( $opt_h || $opt_help) { + printf "$usage\n"; + exit(0); +} + +my @heads= qw/id date time tunix x1 nloss tloss seqloss x2 seqtail overlap x3 h_n h_jit h_ddelay h_delay h_min_d h_slope_10 h_slope_20 h_slope_30 h_slope_40 h_slope_50 x4 t_n t_jit t_ddelay t_delay t_min_d t_slope_10 t_slope_20 t_slope_30 t_slope_40 t_slope_50 dTTL/; + +if ($opt_rhead){ + my @a=split(" ", $head); + my $h=""; + foreach $a (@heads ){ + $h.='"'.$a.'", ' } + chop($h); chop($h); # remove ', ' + + printf 'head<-c(' . $h . ")\n"; +#id", "date", "time", "tunix", "x1", "nloss", "tloss", "seqloss", "x2", "seqtail", "overlap", "x3", "head_n", "head_jit", "head_ddelay", "head_delay", "head_slope", "x4", "tail_n", "tail_jit", "tail_ddelay", "tail_delay", "tail_slope_10", "tail_slope_20")'; printf "\n"; + exit 0; +} + +my %hix=(); # hash on name to index in @heads +foreach $i(0..$#heads){ + $hix{$heads[$i]}=$i; +} +my $coder; # json coder + +if ( $opt_json){ + require JSON::XS; + my $json=$opt_json; + open JSON, ">>$json" || die "Could not open $json ; $!"; + # $coder = JSON::XS->new->ascii->pretty->allow_nonref; + $coder = JSON::XS->new->ascii->allow_nonref; + $encoder=$coder->canonical([1]); +} + + +if ($opt_graph){ + require Chart::Clicker; + require Chart::Clicker::Data::Series; + require Chart::Clicker::Data::DataSet; + require Chart::Clicker::Renderer::Point; +} + +if ( $opt_names){ + get_names($opt_names); +} + +$maxslep=$opt_slep || 1000 ; +$maxhead=$opt_win || 10; # packets to keep before +$maxtail=$opt_win || 10; # packets to keep after +$min_slopes=5; # slopes to report on text report +$minloss= $opt_minloss || 1; +$minrecover = $opt_recover || 5; +$outdir=$opt_outdir || "."; +$title=$opt_title || 'Delay'; +$bv_fmt='^([\d]+)\s+([\d\.\:]+)\s+([\d\.]+)\s+([\d\.]+)'; # BV's condensed format for crude +$id= $opt_id || "ukjent" ; +my %npackets=(); # keep track of all ids +my $print_line; +my %duration; # seconds per id +my %late_n=(); + + +read_crude(); + +if ( $opt_v ){ +# foreach $id ( sort keys %dupl){ +# printf STDERR "%-30s %d duplicates\n", $id, $dupl{$id}; +# } + +# foreach $id ( sort keys %reorder){ +# printf STDERR "%-30s %d reordered (%d ppm)\n", $id, $reorder{$id}, $reorder{$id}*10^6/$npackets{$id}; +# } + + foreach $id ( sort keys %npackets){ + my $lates=0; + $lates=$late_sum{$id}/$late_n{$id}/1000 if $late_n{$id} > 0; + + printf STDERR "%-30s lasted %02d:%02d:%02d ( %d seconds ) and has %d small and %d big gaps and lost %.3f small and %.3f big seconds, %d resets, %d late n, %.1fs late, %d duplicates, %d reordered, %d ttl changes and downtime %d ppm.\n", $id, + $duration{$id}/3600, $duration{$id}%3600/60, $duration{$id}%60, $duration{$id}, + $nsmall_gaps{$id}, $nbig_gaps{$id}, + $small_time{$id}, $big_time{$id}, $resets{$id}, $late_n{$id},$lates, + $dupl{$id}, $reorder{$id}, $dttl_sum{$id}, + 10**6 * ($small_time{$id} + $big_time{$id}) / $duration{$id}; # ppm + } + printf STDERR "Big gap limit %d packets.\n", $minloss; + +# if (!%nbreak){ +# print STDERR "No big gaps($minloss) found in $npackets packets."; +# } +} + +foreach $id (keys %small_tx){ + print STDERR "ID $id has Tx to small in $small_tx{$id} packets\n"; +} + + +if ($opt_json){ + emit_summary_json(); + close JSON; + +} + + +exit(0); + + +################################################################################ +#name id dns ip + +sub emit_summary_json{ + + foreach $id ( sort keys %npackets){ + my $latems=0; + $latems=$late_sum{$id}/$late_n{$id} if $late_n{$id} > 0; + + my $json={ + "type" => "gap-sum", + "lasted" => sprintf ( "%02d:%02d:%02d", $duration{$id}/3600, $duration{$id}%3600/60, $duration{$id}%60 ), + "lasted_sec" => sprintf ( "%.3f", $duration{$id} ), + "small_gaps" => $nsmall_gaps{$id}, + "big_gaps" => $nbig_gaps{$id}, + "small_time" => sprintf ( "%.3f", $small_time{$id} ), + "big_time" => sprintf ( "%.3f", $big_time{$id} ), + "resets" => $resets{$id} || 0, + "late" => $late_n{$id} || 0, + "late_sec" => sprintf ( "%.3f", $latems/1000 ), + "duplicates" => $dupl{$id} || 0, + "reordered" => $reorder{$id} || 0, + "dTTL" => $dttl_sum{$id}, + "down_ppm" => sprintf ( "%.3f", 10**6 * ($small_time{$id} + $big_time{$id}) / $duration{$id} ) # ppm + }; + + emit_json( $json, $id, $t0{$id} ); + } +} + +sub emit_json{ + my ($json, $id, $tunix)=@_; + my $to=`hostname`; chomp($to); + my @gt=gmtime $tunix; + my $datems= sprintf "%s.%03d", strftime("%Y-%m-%dT%T", @gt), int( $tunix * 1000 ) % 1000 ; + + my $head= { + "\@date" => $datems, + "timestamp"=> $t0{$id}, + "timestamp_zone" => "GMT", + "datetime"=> $datems, + "from"=> $id, "to"=> $to, + "from_adr" => $src_adr{$id}, + "to_adr" => $dst_adr{$id}}; + # $new{keys %$json} = values %$json; + my $new={ %$head, %$json }; # a reference to hash + + print JSON $coder->encode($new ) ."\n" || warn "JSON print failed : $!"; + +} + +################################################################################ + + +sub get_names { + $file=shift; + if ( open NAMES, "<$file"){ + while(){ + next if /\s*#/; + ($name, $user, $dns, $ip)=split; + $hostname{$ip}=$name; + } + close NAMES; + } +} + +################################################################################ + +sub read_crude { + my $tx; # current transmit time + + while(<>){ + + if ( /crude version 0.9.0/){ + # die "### Versjon med feil i Rx : $_"; + } + my $seq; + + if ( /crude version/){ # new file restart sequence control + undef %pseq, %selp, %gap_slep; + } elsif ( ( ($rudeid,$seq, $src, $dst, $tx, $rx, $size) = /^ID=(\d+) SEQ=(\d+) SRC=([\w\:\.]+):\d+ DST=([\w\:\.]+):\d+.*Tx=([\d\.]+) .*Rx=([\d\.]+) .*SIZE=(\d+)/ ) + || ( ($seq, $src, $tx, $rx) = /$bv_fmt/ ) ){ + + next if $size < 50; # just a sanity filter for the packets i harstad-mp that has SIZE=4 + + if ( $opt_id){ + # use that + } elsif ($hostname{$src}){ + $id=$hostname{$src}; + } else { + if ( $hostname = gethostbyaddr(inet_aton($src), AF_INET) ){ + $id=$hostname{$src}=$hostname; + } else { + $id=$hostname{$src}=$src; + } + } + $src_adr{$id}=$src if ! $src_adr{$id} ; + $dst_adr{$id}=$dst if ! $dst_adr{$id} ; + + if ($tx < $min_tx || $tx > $max_tx){ + $small_tx{$id}++; + next; ######################### + } + + $npackets{$id}++; + my $dt=0; + my $bufferit=1; + + if (defined($pseq{$id})){ + my $dseq=$seq - $pseq{$id}; + $dt=$rx-$tx; + $ids{$id}++; + + if ( $tx < $t0{$id}) { # packets from the past + $late_n{$id}++; + $late_sum{$id}+=$dt; + $late_ss{$id}+=$dt*$dt; + $bufferit=0; + } elsif ( $dseq == 1 ){ # normal packet + if ( $ntail_seq{$id} > 0 ){ # is recovering + $ntail_seq{$id}++; + if ( $ntail_seq{$id} > $minrecover && $in_gap{$id} ){ + + $emit_graph{$id}=1; + + my $missing= $gap_end_seq{$id} - $head_seq{$id}; + if ( $missing <= $max_small_gap ){ + if ($n_small_graphs{$id} > $max_small_graphs){ + $emit_graph{$id}=0; + } else { + $n_small_graphs{$id}++; + } + } else { + if ( $n_big_graphs{$id} > $max_big_graphs){ + $emit_graph{$id}=0; + } else { + $n_big_graphs{$id}++; + } + } + + emit_break_head($id, $missing ); + + # add the ok part of the postgap tail + my $good=$#{$gap_slep{$id}} - $ntail_seq{$id}; + $good = 0 if $bad < 0 ; + my $dttl= get_ttl($gap_slep{$id}[$good])-get_ttl($head_end{$id}); + $dttl_sum{$id}++; + push(@{$dttl{$id}}, $tail_ttl - $head_ttl ); + + for ($lno=0; $lno <= $#{$gap_slep{$id}}; $lno++){ + push( @{$slep{$id}}, $gap_slep{$id}[$lno] ); + $nslep{$id}++; + } + $gap_slep{$id}=[]; # copied - blank it. + $ntail_seq{$id}=0; # + } + } + $pseq{$id}= $seq; + $ptx{$id}=$tx; + + } elsif ($dseq == 0 ){ # + $dupl{$id}++; + $bufferit=0; + } elsif ($dseq < 0 ) { # reordered + if ( $dseq > (-$maxseqreorder) ){ # reordered + $reorder{$id}++; + undef $lost{$id}{$seq}; + if ( $dt > $late_delay ){ # late packet + $late_n{$id}++; + $late_sum{$id}+=$dt; + $late_ss{$id}+=$dt*$dt; + } + $bufferit=0; + } else { # reset + $resets{$id}++; + $seq0{$id}=$seq; + # $pseq{$id}= $seq; + undef $pseq{$id}; + $ptx{$id}=$tx; + } + } elsif ( ( $dseq > 1 ) && ( $nslep{$id} > 0 ) ){ # some packets lost and we got started + + if ( $in_gap{$id} ){ + $ntail_seq{$id} = 1; + } elsif ( $dseq > $minloss ){ # is a new big gap + if ( $ntail_seq{$id} < 1 ){ # start of new gap + my $start=$#{$slep{$id}} - $maxhead; + $start=0 if $start < 0 ; # has to few packets in buffer + $head_start{$id} = $slep{$id}[$start]; + $head_end{$id} = $slep{$id}[$#{$slep{$id}}] ; # last valid record before outage + $head_seq{$id} = $pseq{$id}; + $in_gap{$id}=1; + $ntail_seq{$id} = 1; # restart this if there are more holes + } + $gap_slep{$id}=[]; + $nbig_gaps{$id}++; + $big_gaps{$id}+=$dseq-1; + $big_time{$id}+=$tx-$ptx{$id}; + } else { + $nsmall_gaps{$id}++; + $small_gaps{$id}+=$dseq-1; + $small_time{$id}+=$tx-$ptx{$id}; + } + # note which packets are lost + foreach $lost ( $pseq{$id}+1 .. $seq-1 ){ + $lost{$id}{$lost}=1; + } + $gap_end{$id}=$_; + $gap_end_seq{$id}=$seq; + $ptx{$id}=$tx; + $pseq{$id}= $seq; + } + } else { + $seq0{$id}=$seq; + $pseq{$id}=$seq; + $ptx{$id}=$tx; + $t0{$id}=$tx if !$t0{$id}; + } + + # if ( $dt == 0 || $dt <= $late_delay ){ # buffer lines + if ( $bufferit){ + if ( $in_gap{$id} > 0 ){ # during gap + push(@{$gap_slep{$id}}, $_); + } else { + push(@{$slep{$id}},$_); + $nslep{$id}++; + while ( $nslep{$id} > $maxslep){ + shift @{$slep{$id}}; + $nslep{$id}--; + } + } + } + $in_gap{$id}=0 if $ntail_seq{$id} < 1; + +# handle tail +# count up multiple possibly overlapping tails +# if ($dseq > $minloss && $nslep{$id} > 0 ){ +# if ( $ntail_seq{$id} > 0 ){ + foreach $i (0 .. $#{$ntail{$id}}){ + if ($ntail{$id}[$i] < $maxtail){ + $ntail{$id}[$i]++; + } + } +# } +# +# foreach $i (0 .. $#{$ntail{$id}}){ + if ($nbreak{$id} > 0 && ($ntail{$id}[0] >= $maxtail)){ + my $head=shift(@{$head1{$id}}); + + push(@{$tail{$id}}, report_delay( $id, 'tail', @slep{$id}), 0, 0); + $print_line.= sprintf "%s overlap %8d %2d ", $head, $head_seq{$id}, $#{$ntail{$id}}+1; + shift(@{$ntail{$id}}); + &emit_stats($id); + $nbreak{$id}--; + } +# } +# } +# } + } + + } # while read + foreach $id ( keys %t0 ) { + $duration{$id}=$tx-$t0{$id}; + } + +} + +################################################################################ + +sub get_ttl { + my $line=shift; + my ($txt, $ttl)=/(HOPLIMIT|TTL)=(\d+)/; + return $ttl; +} + +################################################################################## + +sub emit_break_head { + my ($id, $dseq) = @_; + $nbreak{$id}++; +# $tx1=&tx($slep{$id}[$#{$slep{$id}}]); + my $tx1=&tx($head_end{$id}); + my $rx1=&rx($head_end{$id}); +# my $tx2=&tx( $slep{$id}[$#{$slep{$id}} - $ntail_seq{$id} + 2] ); + my $tx2=&tx( $gap_end{$id} ); + my $rx2=&rx( $gap_end{$id} ); + +# my $dt= $rx2 - $tx1 - $min_delay; + my $dt= $tx2 - $tx1 - &p_interval($slep{$id}); # clock from same side more accurate diff + ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = + localtime($tx1); + push( @{$head1{$id}}, sprintf "%-25s %4d-%02d-%02d %02d:%02d:%02d %s gap %5d %5.1f %6d ", + $id, $year+1900,$mon+1,$mday, $hour, $min, $sec, $tx1, + $dseq-1, $dt*1000, $head_seq{$id}-$seq0{$id} ); + + push(@{$ntail{$id}}, 0); # remember this break + push(@{$head{$id}}, report_delay($id, 'head', @slep{$id}, $tx1, $dt)); +# @slep{$id}=(); +# $nslep{$id}=0; +} + +################################################################################ +# guess packet interval by meadian transmit interval +sub p_interval{ + my $lines=shift; + my $ptx; + my @tx; + foreach $l(@$lines){ + my $tx=&tx($l); + if ( $ptx){ + push(@tx, $tx-$ptx); + } + $ptx=$tx; + } + my @txs=sort {$a <=> $b} @tx; + my $median=$txs[ int( ($#txs + 1) / 2) ]; + return $median; +} + +sub tx{ + my $l=shift; + my $seq; + if ( $l =~ /Tx=(\d+\.\d+)/ ){ + return $1 ; + } elsif (($seq, $src, $tx, $rx) = $l=~/$bv_fmt/ ){ + return $tx; + } + return -1; +} +sub rx{ + my $l=shift; + my $seq; + if ( $l =~ /Rx=(\d+\.\d+)/ ){ + return $1 ; + } elsif (($seq, $src, $tx, $rx) = $l=~/$bv_fmt/ ){ + return $rx; + } + return -1; +} + +sub emit_stats{ + my $id=shift; + + my @lostseq= (); + @lostseq= keys %{$lost{$id}}; # if %lost{$id}; + +# print "head###########\n",@{$head{$id}}, "tail ####\n",@{$tail{$id}}; +# printf "head %3d %s tail %3d %s\n", $#{$head{$id}}+1, &report_delay($head{$id}), + + if ( $#lostseq >= 0 ){ # still lost packets later (reorder) + $print_line .= sprintf "head %s tail %s %5d\n", shift(@{$head{$id}}), shift(@{$tail{$id}}), shift(@{$dttl{$id}}); + print_line(\$print_line); + } else { + $print_line=''; + # print stderr "reordering fixed : $print_line\n"; + } + + +# $get_tail{$id}=0; +# $ntail{$id}=0; + $tail{$id}=(); + $lost{$id}=(); + +} + +sub report_delay{ # jitter for one delay + my $id=shift; + my $type=shift; # head, tail + my $refl=shift; # array of lines + my $txgap=shift; + my $dt=shift; + + # my @l=@$refl; + my $ptx=0, $prx=0, $sumjit=0, $njit=0, $ndelay=0, $sumdd=0, $sumdelay=0; + my $start=$#$refl-$maxhead; + my $mindelay, $tail_delay; + my @rdelay=(), @rtx=(), $tx0=0; + my @rrx=(), $rx0=0; + my $rudeid, $seq, $src, $dst, $tx, $rx, $size, $pseq; + foreach $i( 0 .. ($#$refl - 0) ){ # skip the last one which might be after the gap + my $rline=\@$refl[$i]; + if ( ( ($rudeid, $seq, $src, $dst, $tx, $rx, $size)= + $$rline =~ /ID=(\d+)\s+SEQ=(\d+)\s+SRC=([\d.:]+)\s+DST=([\d.:]+)\s+Tx=([\d.,]+)\s+Rx=([\d.,]+).+SIZE=(\d+)/) + || ( ($seq, $src, $tx, $rx) = $$rline =~ /$bv_fmt/ ) + ){ + $delay=$rx-$tx; + + if ( $i < $start ) { + if ( !$mindelay || $delay < $mindelay){ + $mindelay = $delay; + } + } else { + if ( !$taildelay || $delay < $taildelay){ + $taildelay = $delay; + } + if ( $tx0 == 0 ) { + $tx0=$tx; + $rx0=$rx; + if ( $type eq "head" ){ # use start of head for tail also + push(@{$txgap{$id}}, $txgap); # stack head if nested gaps + } elsif ( $type eq "tail"){ # pull from stacked head + $txgap=shift( @{$txgap{$id}} ); + } + } + $sumdelay+=$delay; + $ndelay++; + + if ($ptx && ($seq - $pseq) == 1){ + $dtx=$tx-$ptx; + $drx=$rx-$prx; + $jit=$drx-$dtx; + $sumjit+=$jit; + $njit++; + $sumdd+=$delay; + push(@rtx, ($tx-$tx0)*1000); #ms + push(@rrx, ($rx-$rx0)*1000); #ms + push(@rdelay, $delay); + } + $ptx=$tx; + $prx=$rx; + $pdelay=$delay; + $pseq=$seq; + } + } + } + + for ($i=0; $i<=$#rdelay; $i++){ # relative delay in ms + $rdelay[$i]=($rdelay[$i]-$mindelay)*1000; + } + + $sumdd=$sumdd-$njit*$mindelay; # sum differences from minimum + + if($njit> 0 && $ndelay > 0){ + $lineFit = Statistics::LineFit->new(); + my @slope=(), $slopes=""; my $lr_start; my $lr_a; my $lr_b; + + my $cc; # chart object + my $ctx; # chart context + my $ctx_lr; + + if ( $opt_graph && $emit_graph{$id}){ + $cc = Chart::Clicker->new( width=>800, height=>600); + if ( $dt > 0) { + $cc->title->text(sprintf "$title $type $id %.3fs", $dt); + } else { + $cc->title->text("$title $type $id"); + } + $ctx = $cc->get_context('default'); + $ctx->renderer(Chart::Clicker::Renderer::Point->new); +# $ctx->renderer(Chart::Clicker::Renderer::Line->new); + $ctx->domain_axis->label('Time(ms)'); + $ctx->range_axis->label('d-delay(ms)'); + + my $series = Chart::Clicker::Data::Series->new( name => 'delay', + keys => \@rtx, values => \@rdelay); + my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]); + $cc->add_to_datasets($ds); + + $ctx_lr=Chart::Clicker::Context->new( name => 'LR' ); + $ctx_lr->renderer(Chart::Clicker::Renderer::Line->new); + $ctx_lr->share_axes_with($ctx); + $cc->add_to_contexts($ctx_lr); + } + + foreach ( $i=0; $i < $#rtx-4; $i+=10){ + my $lr_start, $lr_end; + if ( $type eq "head"){ # analyze head from end and tail from start + $lr_start=$i; $lr_end=$#rtx; + } else { + $lr_start=0; $lr_end=min($i+10,$#rtx); + } + + my @drtx=@rtx[$lr_start..$lr_end]; + my @drdelay=@rdelay[$lr_start..$lr_end]; + +# virker ikke +# ($yfit, $coeffs) = fitpoly1d \@drtx, \@drdelay, 4; # Fit a cubi + + $lineFit->setData ( \@drtx, \@drdelay ); + if (! ( ($intercept, $slope) = $lineFit->coefficients() ) ){ + warn "File $ARGV : $!"; + } + push(@slope, sprintf("%9.3f ", $slope) ); + # $slopes.=sprintf("%9.3f ", $slope); + $lr_a=$slope; $lr_b=$intercept; + + if ( $opt_graph && $emit_graph{$id}){ + my $x1=$rtx[$lr_start], $x2=$rtx[$lr_end]; +# for ( $x=$x1; $x<=$x2; $x+=($x2-$x1)/50){ +# for ( $x=$x1; $x<=$x2; $x++){ +# $cc->add_data('LR-'.$i, {$x => $lr_a*$x+$lr_b}); +# } + + my $series=Chart::Clicker::Data::Series->new( name => 'LR-'.$i, + keys=> [$x1, $x2], values=> [$lr_a*$x1+$lr_b, $lr_a*$x2+$lr_b] ); + my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]); + $ds->context('LR'); + $cc->add_to_datasets($ds); + } + + # $cc->add_data('LR', {$x1 => $lr_a*$x+$lr_b, $lr_a*$x2+$lr_b}); + } + if ( $opt_graph && $emit_graph{$id}){ +# $ctx->domain_axis->range->max( $rtx[$#rtx]*1.05); +# $ctx->range_axis->range->max( $rdelay[$#rdelay]*1.05); + + $cc->write_output( sprintf("%s/%s-%.3f-loss-%s%s",$outdir,$id,$txgap,$type,$opt_graph)) + || warn "Chart error : $!"; + undef $cc; # try to free the space used by the graph + } + + # make sure all columns are filled in + while ($#slope < ($min_slopes-1)){ push(@slope, "-"); } + $slopes=join(' ', @slope); + + return sprintf "%3d %9.3f %9.3f %9.3f %9.3f %s", $njit, $sumjit/$njit*1000, $sumdd/$njit*1000, $sumdelay/$ndelay*1000, $taildelay*1000, $slopes; + } else { + return sprintf "%3d %5.3f %5.3f", 0, 0, 0; + } + + +} + +sub min{ + return $_[0] if $_[0] <= $_[1] ; + return $_[1]; +} + +sub max{ + my $ref=shift; + my $max; + foreach $v( @$ref){ + $max = $v if !$max || $max < $v; + } + return max; +} + +# generate header form based on first data line +sub headmaker{ + my $line=shift; + my @l=split //, $line; + $p=0; + for ($i=0;$i<=$#l;$i++){ + if ( ( $l[$i] eq " " || $l[$i] eq "\n" ) && $l[$i-1] ne " "){ + $form.=sprintf "%%%ds ", $i-$p-1; + $p=$i; + } + } + return $form; +} + +sub print_line{ + my $line=shift; + if ( ! $head_done ){ + if($opt_head && $opt_v){ + printf headmaker($$line)."\n", @heads; + } + $head_done=1; + } + if ( $opt_json){ + emit_event_json($line); + } + if ( $opt_v ){ + print $$line; + } + $$line=''; +} + +sub emit_event_json{ + my $line=shift; + if ( $$line =~ /\d\d\d\d-\d\d-\d\d\s+\d\d:/){ #looks like report line : yyy-mm-dd hh: + my @f=split(/\s+/, $$line); + my $from=$f[$hix{id}]; + my $to=`hostname`; chomp($to); + +# my ($date, $t)= ( $f[$hix{date}], $f[$hix{time}] ); +# my @gt=gmtime $f[$hix{tunix}]; +# my $datems= sprintf "%s.%03d", strftime("%Y-%m-%dT%T", @gt), int($f[$hix{tunix}]*1000)%1000 ; + + my $json= { + "type" => "gap", + "tloss"=>$f[$hix{tloss}] , + "h_n" => $f[$hix{h_n}], + "h_jit" => $f[$hix{h_jit}], + "h_ddelay" => $f[$hix{h_ddelay}], + "h_delay" => $f[$hix{h_delay}], + "h_min_d" => $f[$hix{h_min_d}], + "h_slope_10" => $f[$hix{h_slope_10}], + "h_slope_20" => $f[$hix{h_slope_20}], + "h_slope_30" => $f[$hix{h_slope_30}], + "h_slope_40" => $f[$hix{h_slope_40}], + "h_slope_50" => $f[$hix{h_slope_50}], + "t_n" => $f[$hix{t_n}], + "t_jit" => $f[$hix{t_jit}], + "t_ddelay" => $f[$hix{t_ddelay}], + "t_delay" => $f[$hix{t_delay}], + "t_min_d" => $f[$hix{t_min_d}], + "t_slope_10" => $f[$hix{t_slope_10}], + "t_slope_20" => $f[$hix{t_slope_20}], + "t_slope_30" => $f[$hix{t_slope_30}], + "t_slope_40" => $f[$hix{t_slope_40}], + "t_slope_50" => $f[$hix{t_slope_50}], + "overlap" => $f[$hix{overlap}], + "dTTL" => $f[$hix{dTTL}] + # "" => $f[$hix{}], + }; + + emit_json($json, $from, $f[$hix{tunix}]); + + } else { + warn "Could not parse line : $$line"; + } +} + diff --git a/mp-rude/usr/share/mp-rude/start.sh b/mp-rude/usr/share/mp-rude/start.sh new file mode 100755 index 0000000000000000000000000000000000000000..860d005e92bca0d58778ce3d9957091900181091 --- /dev/null +++ b/mp-rude/usr/share/mp-rude/start.sh @@ -0,0 +1,19 @@ +#! /bin/sh + +set -e + +. /etc/mp-rude/start.conf + +log="${logpath}"/"${date}"/"traceroute_$1" + +if [ -f "${logpath}"/pids ] ; then + echo "ERROR: ${logpath}/pids already exists!" + exit 1 +fi + +#Start traceroute +for i in $(cat ${traceconf}) ; do + ${trace} ${i} 23:59 > /dev/null 2>&1 & + echo "$!" >> "${logpath}"/pids +done + diff --git a/mp-rude/usr/share/mp-rude/stop.sh b/mp-rude/usr/share/mp-rude/stop.sh new file mode 100755 index 0000000000000000000000000000000000000000..24bcd2f1530f54b741923de8c821dd48047036eb --- /dev/null +++ b/mp-rude/usr/share/mp-rude/stop.sh @@ -0,0 +1,23 @@ +#! /bin/sh + +set -e + +. /etc/mp-rude/start.conf + +if [ ! -e "${logpath}"/pids ] +then + echo "Pid file does not exist: ${logpath}/pids" + exit +fi + +if test $1. != . ; then + sleep $1 # wait a few seconds closer to midnight +fi + +for pid in $(cat "${logpath}"/pids); do + if [ -d /proc/"${pid}" ] ; then + grep -q trace.sh /proc/"${pid}"/cmdline && kill ${pid} + fi +done + +rm -f "${logpath}"/pids diff --git a/mp-rude/usr/share/mp-rude/trace.sh b/mp-rude/usr/share/mp-rude/trace.sh new file mode 100755 index 0000000000000000000000000000000000000000..3007ccd17f5f2368dbbb696568f3d01f6a421025 --- /dev/null +++ b/mp-rude/usr/share/mp-rude/trace.sh @@ -0,0 +1,28 @@ +#! /bin/sh + +set -e +umask 0002 + +. /etc/mp-rude/start.conf + +mkdir -p "${logpath}"/"${date}" +log="${logpath}"/"${date}"/"traceroute_$1" + +if test $2. -ne . ; then + end=$(date --date "$2" +%s) +else + end=$(date --date "2099-12-31" +%s) +fi + +# ( flock -n 9 || ( echo "=== could not start traceroute - locked $log.lock ===" ; exit 1 ) +# > $log.log + + while test $(date +%s) -lt ${end} ; do + date "+%s starttime %T" | gzip -c >> ${log}.gz + traceroute -q 6 -n $1 2> /dev/null | gzip -c >> ${log}.gz + sleep 60 + done +#) 9> $log.lock & +#echo "$!" >> $logpath/pids + +rmdir --ignore-fail-on-non-empty "${logpath}"/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] diff --git a/mp-rude/var/lib/mp-rude/crude.pipe b/mp-rude/var/lib/mp-rude/crude.pipe new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/rude-list.conf b/rude-list.conf deleted file mode 100644 index db8c881da6963839d752397eb0d9f6cdf000493c..0000000000000000000000000000000000000000 --- a/rude-list.conf +++ /dev/null @@ -1,33 +0,0 @@ -alesund-mp.hials.no bergen-mp.uib.no ntnu-mp.ntnu.no -alta-mp.hifm.no tromso-mp.uit.no ntnu-mp.ntnu.no -bergen-mp.uib.no ntnu-mp.ntnu.no oslo-mp.uio.no tromso-mp.uit.no -bo-mp.hit.no oslo-mp.uio.no bergen-mp.uib.no -drammen-mp.hibu.no oslo-mp.uio.no bergen-mp.uib.no -forde-mp.hisf.no bergen-mp.uib.no ntnu-mp.ntnu.no -fredrikstad-mp.hiof.no oslo-mp.uio.no bergen-mp.uib.no -gjovik-mp.hig.no oslo-mp.uio.no bergen-mp.uib.no -grimstad-mp.uia.no oslo-mp.uio.no bergen-mp.uib.no -halden-mp.hiof.no oslo-mp.uio.no bergen-mp.uib.no -hamar-mp.hihm.no oslo-mp.uio.no ntnu-mp.ntnu.no -harstad-mp.hih.no tromso-mp.uit.no ntnu-mp.ntnu.no -haugesund-mp.hsh.no bergen-mp.uib.no stavanger-mp.uis.no -kalvskinnet-mp.hist.no ntnu-mp.ntnu.no bergen-mp.uib.no -kristiansand-mp.uia.no oslo-mp.uio.no bergen-mp.uib.no -kunnskapsv-mp.hioa.no oslo-mp.uio.no bergen-mp.uib.no -lillehammer-mp.hil.no oslo-mp.uio.no ntnu-mp.ntnu.no -molde-mp.himolde.no bergen-mp.uib.no ntnu-mp.ntnu.no -narvik-mp.hin.no tromso-mp.uit.no ntnu-mp.ntnu.no -nesna-mp.hinesna.no tromso-mp.uit.no ntnu-mp.ntnu.no -ntnu-mp.ntnu.no oslo-mp.uio.no bergen-mp.uib.no tromso-mp.uit.no -nyalesund-mp.uninett.no tromso-mp.uit.no ntnu-mp.ntnu.no -oslo-mp.uio.no bergen-mp.uib.no tromso-mp.uit.no ntnu-mp.ntnu.no -pil32-mp.hioa.no oslo-mp.uio.no bergen-mp.uib.no -porsgrunn-mp.hit.no oslo-mp.uio.no bergen-mp.uib.no -sogndal-mp.hisf.no oslo-mp.uio.no bergen-mp.uib.no -stavanger-mp.uis.no bergen-mp.uib.no oslo-mp.uio.no -steinkjer-mp.hint.no ntnu-mp.ntnu.no bergen-mp.uib.no -stord-mp.hsh.no bergen-mp.uib.no stavanger-mp.uis.no -svalbard-mp.unis.no tromso-mp.uit.no ntnu-mp.ntnu.no -teknobyen-mp.uninett.no ntnu-mp.ntnu.no bergen-mp.uib.no -tromso-mp.uit.no oslo-mp.uio.no bergen-mp.uib.no ntnu-mp.ntnu.no -# volda-mp.hivolda.no ntnu-mp.ntnu.no bergen-mp.uib.no diff --git a/tools/mp-cmd b/tools/mp-cmd deleted file mode 100755 index 27c7c64b1550355da0e646b3f48fc55bc27e0b88..0000000000000000000000000000000000000000 --- a/tools/mp-cmd +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -mps="$1" -cmd="$2" - -for mp in `cat $mps` ; do - echo henter $mp -# ssh -q root@$mp sysctl net.core.rmem_default - ssh -q root@$mp "$cmd" -done diff --git a/tools/mp-cmd~ b/tools/mp-cmd~ deleted file mode 100755 index 2f7826d47d4610cdea84ebb430b6d5b7aa6b2d11..0000000000000000000000000000000000000000 --- a/tools/mp-cmd~ +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -cmd="$1" - -for mp in bo-mp.hit.no stord-mp.hsh.no forde-mp.hisf.no harstad-mp.hih.no volda-mp.hivolda.no haugesund-mp.hsh.no tromso-mp.uit.no molde-mp.himolde.no alesund-mp.hials.no fredrikstad-mp.hiof.no svalbard-mp.unis.no porsgrunn-mp.hit.no alta-mp.hifm.no hamar-mp.hihm.no narvik-mp.hin.no pil32-mp.hioa.no ntnu-mp.ntnu.no kristiansand-mp.uia.no sogndal-mp.hisf.no stavanger-mp.uis.no bergen-mp.uib.no grimstad-mp.uia.no lillehammer-mp.hil.no oslo-mp.uio.no halden-mp.hiof.no nesna-mp.hinesna.no nyalesund-mp.uninett.no kunnskapsv-mp.hioa.no drammen-mp.hibu.no steinkjer-mp.hint.no gjovik-mp.hig.no ; do - echo henter $mp -# ssh -q root@$mp sysctl net.core.rmem_default - ssh -q root@$mp "$cmd" -done diff --git a/tools/mp-hent.sh b/tools/mp-hent.sh deleted file mode 100644 index 947c4a3ca4a6e10813496f6521c0a8731e464690..0000000000000000000000000000000000000000 --- a/tools/mp-hent.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -mp-list=$1 -today=`date +%Y-d-d` -for mp in `cat $mp-list`; do - echo $mp - echo rsync -rv --bwlimit=20MB --exclude "*$today*" root@$mp:/tmp/mp-rude/ /dragonlab/mp-rude/data/$mp -done diff --git a/tools/mp-ut.sh b/tools/mp-ut.sh deleted file mode 100755 index 0a78f016ac1730a6ef7b99b26f88c49ab6eea3bf..0000000000000000000000000000000000000000 --- a/tools/mp-ut.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -hlist=$1 -cmd="$2" - -for mp in `cat mp-list.txt`; do - echo $mp - eval $cmd -# start-stop-daemon --start --background --pidfile /var/run/mp-crude.pid -m --exec /usr/local/bin/crude -- -P 50 -k -l - | gzip >/tmp/mp-rude/$HOST-$DATE.crude.gz -# rsync -prv etc/ root@$mp:/etc/ -# rsync -prv tmp/$mp/ root@$mp:/etc/mp-rude/ -# rsync -prv etc/init.d/mp-rude root@$mp:/etc/init.d/ -# rsync -prv etc/cron.d/mp-rude root@$mp:/etc/cron.d/ -# rsync -prv ~/sw/rude/crude/crude root@$mp:/usr/local/bin -# rsync -prv ~/sw/rude/rude/rude root@$mp:/usr/local/bin -# scp ~/sw/rude/bin/* root@$mp:/usr/local/bin/ -done