Commit 182e5ea7 authored by Olav Kvittem's avatar Olav Kvittem
Browse files

added max_port paramter so traceroute can be more than 30

parent 0d801743
Pipeline #45407 passed with stages
in 1 minute and 13 seconds
......@@ -7,10 +7,13 @@ my $list='mp-list.txt';
my $default_port=10001;
my $index; # the index for event records
my $rude_port=3100; # start local port number udp
my $max_hops=30;
use Getopt::Long;
@opts=( 'target=s' => \$target, 'list=s' => \$list, 'index=s' => \$index, 'rude_start=i' => \$rude_port);
my $usage="usage: $0 [ -target <target host> ] [-list <mp-list.txt>] -index <index> config-file -rude_start <3001>\n";
@opts=( 'target=s' => \$target, 'list=s' => \$list, 'index=s' => \$index, 'rude_start=i' => \$rude_port,
'max_hops=i' => \$max_hops);
my $usage="usage: $0 [ -target <target host> ] [-list <mp-list.txt>] -index <index> config-file
-rude_start <3001> --max_hops <n> (30)\n";
GetOptions(@opts) || die $usage;
die $usage if !$index;
......@@ -109,6 +112,7 @@ foreach $name ( keys %port){
printf $start "index=%s\n", $index ;
my $crude_port= $crude_port{$name} || $port{$name} || $default_port;
printf $start "crude_port=%s\n", $crude_port;
printf $start "max_hops=%s\n", $max_hops;
# printf $start "%s", $startcfg;
close $start;
}
......
......@@ -7,11 +7,17 @@ log=$logpath/$date/traceroute_$1
( flock -n 9 || ( echo "=== could not start traceroute - locked $log.lock ===" ; exit 1 )
> $log.log
if test "$max_hops" != ""; then
$hop_parm="--max-hpos=$max_hops"
else
$hop_parm=""
fi
phour=-1
hour=$(date +%H)
while test $hour -ge $phour; do # do until midnight
date "+%s starttime %T" | gzip -c >> $log.gz
traceroute -q 6 -n $1 2> /dev/null | gzip -c >> $log.gz
traceroute -q 6 -n $1 $hop_parm 2> /dev/null | gzip -c >> $log.gz
sleep $traceroute_interval
sleep $(($RANDOM/3276)) # sleep 0-10 sec to distribute load
......
......@@ -16,7 +16,7 @@ dir=/var/lib/microdep/mp-$index
cd $dir/mp
# make the config for each mp
$bin/rude-config-maker --index dragonlab --list ../etc/mp-names.txt --rude_start 3100 ../etc/rude-list.cfg ../etc/rude-extra.cfg
$bin/rude-config-maker --index dragonlab --list ../etc/mp-names.txt --rude_start 3100 --max_hops 40 ../etc/rude-list.cfg ../etc/rude-extra.cfg
# update the database
$path/microdep-config-peers --start-time $(date --date 'tomorrow 0' +%s) -db ../etc/microdep.db ../etc/rude-list.cfg ../etc/rude-extra.cfg
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment