[mrtg] Getlog.pl
Eric VDB
ericvdb500 at hotmail.com
Thu Aug 22 23:52:21 MEST 2002
Hi all,
i used the following getlog.pl file to read a .csv file created by w2k performance counter.
When i use it it returns : ERROR: Skipping webupdates because rateup did not return anything sensible
Any idea...
# getlog.pl
#
# Author: Paul Simmonson
#
# Edited to work with dot (instead of period) as an decimal symbol: Matti "maz" Kullberg
#
# Input: filename of Windows 2000 Performance monitor log file (must be CSV format)
# Name of log item to extract
# eg. perl getlog-fixed.pl c:\perflogs\K6.csv "\\K6\LogicalDisk(C:)\% Disk Time"
# Output: mrtg data format
#
$STUFF=@ARGV[0];
open STUFF or die "Cannot open $STUFF for read :$!";
@entries = <STUFF>;
@details=split /,/, @entries[0]; #get the first line of the log file
@lastline=@entries[$#entries]; #get last line of log file
#find the entry that matches $ARGV[1]
$index=-1;
for $entry (@details) {
@lastline[$entry]=~ s/(\"\d+)\,(\d+\")/$1\.$2/g;
$index++;
$entry=~ tr/"//d;
chomp ($entry);
$last=$entry;
last if $entry eq $ARGV[1];
}
@lastline=split/,/, @lastline[$entry];
if ($last eq $ARGV[1]) {
$data=@lastline[$index];
$data=~ tr/"//d;
$data = int($data+0.5);
} else {
$data = 0;
}
print "0\n";
print "$data\n";
print "0\n";
print "0\n";
Greetings Eric
--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive http://www.ee.ethz.ch/~slist/mrtg
FAQ http://faq.mrtg.org Homepage http://www.mrtg.org
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the mrtg
mailing list