Tool question

Carter Bullard carter at qosient.com
Fri Nov 8 18:43:10 EST 2002


Hey Peter and Andrew,
  This works pretty well using the new argus-clients
ra().  Just a simple perl script.  Save the script
below to say, ratimerange, and then run as:

   ratimerange -r file

add any kind of filter you like at the end.

Carter


#! /usr/bin/perl 
# 
#   Argus Client Software.  Tools to read, analyze and manage Argus
data.
#   Copyright (c) 2000-2002 QoSient, LLC
#   All Rights Reserved
use POSIX;
use strict;
 
my @args = ("ra -L0 -us proto startime lasttime", @ARGV);
open(SESAME, "@args |");
 
my $startime = 10000000000.0;
my $lasttime = 0.0;
 
my $data = <SESAME>;
my @thistime;
while ($data = <SESAME>) {
   chomp $data;
   $data =~ s/^ //;
   @thistime = split(/ /, $data);
   if (!($thistime[0] eq "man")) {
      if ($thistime[1] < $startime) {
         $startime = $thistime[1];
      }
      if ($thistime[2] > $lasttime) {
         $lasttime = $thistime[2];
      }
   }
}
 
@thistime = split(/\./, $startime);
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime($thistime[0]);
printf "startime: %4d/%02d/%02d.%02d:%02d:%02d.%06d\n", $year + 1900,
$mon, $mday, $hour, $min, $sec, $thistime[1];
 
@thistime = split(/\./, $lasttime);
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime($thistime[0]);
printf "endtime:  %4d/%02d/%02d.%02d:%02d:%02d.%06d\n", $year + 1900,
$mon, $mday, $hour, $min, $sec, $thistime[1];


> -----Original Message-----
> From: owner-argus-info at lists.andrew.cmu.edu 
> [mailto:owner-argus-info at lists.andrew.cmu.edu] On Behalf Of 
> Peter Van Epp
> Sent: Friday, November 08, 2002 4:23 PM
> To: argus
> Subject: Re: Tool question
> 
> 
> 	While its inefficient in the extreme, the perl scripts 
> posted some 
> days ago can do this. The start time is grabbed off the first 
> non man record that the script sees (because the man records 
> have argus start time not file start time) and the date of 
> the last record in the file gets written after all the 
> records have been read. A print statement at the end of the 
> read loop that prints start and end time to stdout will do 
> what you want. A better way would be to do something like a 
> head and tail of the argus file and print the time stamps, 
> but I'm not sure that is all that easy to do.
> 
> Peter Van Epp / Operations and Technical Support 
> Simon Fraser University, Burnaby, B.C. Canada
> 
> > 
> > Hi,
> > 
> > Is there a tool, or a method using a tool, that can take an 
> unsorted 
> > Argus logfile or ra* output written to a file, and report 
> the earliest 
> > and latest record times in it? (i.e. tell you the time range in a 
> > particular
> > file?)
> > 
> > Andrew
> > 
> 
> 



More information about the argus mailing list