Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Also funny things happen when the pinged host returns duplicated ping responses. This needs to be documented.

Wiki MarkupOccasionally the data is mangled so it is a good idea to validate each line.    A typical piece of perl to do this is:     my
    my (@field)=split /\s+/, $line;   #line contains a line of ping data.     #We choose to look at the validity of something that should be in the line as far down the line as possible.     #A typical line appears as:        #line contains a line of ping data.
    #We choose to look at the validity of something that should be in the line as far down the line as possible.
    #A typical line appears as:
    #monitor.niit.edu.pk 203.99.50.204 www.carnet.hr 161.53.160.25 100 1171756802 10 10 223.323 224.978 226.805 1 2 3 4 5 6 7 8 9 10 226 223 226 223 223 226 223 224 226 225     next 225
    next unless(defined($field\[6\]) && $field\[6\]=~/\d/); #$field\[6\]=packets sent, skip line if not right     #Also validate the rough correctness of the IP address     if(\right
    #Also validate the rough correctness of the IP address
    if(!defined($field\[1\]) \ |\| $field\[1\]\!~/\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}/ ) \ {next;\}     }
    if(\!($field\[4\]=~/^\d+$/) \ {next\}#Verify number of bytes is a number, else skip line &nbsp;&nbsp;&nbsp; #Kludge to allow default 56Byte pings to be treated as 100Byte pings &nbsp;&nbsp;&nbsp; if($field\[4\] < 100) {$field\[4\line
    #Kludge to allow default 56Byte pings to be treated as 100Byte pings
    if($field[4] < 100) {$field[4]=100;}\\