/[cricket]/parse_iptraf.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /parse_iptraf.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by dpavlin, Mon May 20 17:25:52 2002 UTC revision 1.6 by dpavlin, Fri Jul 26 10:10:02 2002 UTC
# Line 2  Line 2 
2    
3  # based on work of Eric Wong <eric@taedium.net>  # based on work of Eric Wong <eric@taedium.net>
4  # available at http://www.taedium.net/rrd-iptraf/ [iptraf.txt]  # available at http://www.taedium.net/rrd-iptraf/ [iptraf.txt]
5    #
6    # Dobrica Pavlinusic <dpavlin@rot13.org>
7    # http://www.rot13.org/~dpavlin/sysadm.html
8    #
9    # Usage: parse_iptraf.pl [name of iptraf logfile]
10    
11  use strict;  use strict;
12  use warnings;  use warnings;
# Line 57  close(D); Line 62  close(D);
62  close(LOG);  close(LOG);
63    
64  foreach my $port (@PORTS) {  foreach my $port (@PORTS) {
65          print @{$hash{$port}}[0] || 0,"\n",@{$hash{$port}}[1] || 0,"\n";          print @{$hash{$port}}[0] || "U","\n",@{$hash{$port}}[1] || "U","\n";
66          delete $hash{$port};          delete $hash{$port};
67  }  }
68    
# Line 67  foreach my $port (keys %hash) { Line 72  foreach my $port (keys %hash) {
72          $sum_in+=@{$hash{$port}}[0];          $sum_in+=@{$hash{$port}}[0];
73          $sum_out+=@{$hash{$port}}[1];          $sum_out+=@{$hash{$port}}[1];
74  }  }
75    
76    $sum_in = "U" if ($sum_in == 0);
77    $sum_out = "U" if ($sum_out == 0);
78  print "$sum_in\n$sum_out\n";  print "$sum_in\n$sum_out\n";

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.26