[mrtg] Re: Whither the 95th percentile parser?

Pete Templin templin at urdirect.net
Thu Dec 16 15:58:40 MET 1999


Addendum: Looks like I sent an unmodified version of mrtg_archive.  Here's
the proper one:

#!/usr/bin/perl

$mrtg_dir = "/usr/local/mrtg";
$archive_dir = "/usr/local/mrtg/archives";
$conf = "/usr/local/scripts/mrtg_archive.conf";

if (-e $conf) {
    open(CONF,"$conf");
    while(<CONF>) {
	chomp;
	push(@elements,$_);
    }
}

@elements = @ARGV if (@ARGV);

die "Need a list of parameters to monitor!\n" unless (@elements);

@time_data = localtime(time);
$time_data[4]++;
$time_data[5] = $time_data[5] + 1900;

for ($a=0; $a<=$#elements; $a++) {
    ($path,$comment) = split(/:/,$elements[$a]);
    (@path) = split(/\//,$path);
    unless (-d "$archive_dir/$path[0]") {
	system("mkdir $archive_dir/$path[0]");
    }

    unless (-f "$archive_dir/$path") {
	system("touch $archive_dir/$path");
    }

    open(LOG,"$mrtg_dir/$path");
    open(COPY,">>$archive_dir/$path");
    while (<LOG>) {
	if ($count >= 3) {
	    print COPY;
	}
	if ($count >= 598) {
	    last;
	}
	$count++;
    }
}
 

Pete

--
Peter J. Templin, Jr., CCNA
Systems and Networks Administrator

On-Line Internet Services - URDirect.net
A division of Global On-Line Computers
2414 Babcock Rd. Suite 106		templin at urdirect.net
San Antonio, TX 78229			(210)692-9911

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:mrtg-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/mrtg



More information about the mrtg mailing list