[mrtg] GetLog Modification

Brander, Eric Eric.Brander at ACS-INC.com
Tue Feb 4 21:43:15 MET 2003

I'm using Paul Simmonson's GetLog.pl Perl script to parse information from a
Winblows Performance Monitor CSV file.  I'd like to modify that perl, or a
copy of that perl file actually, to be able to parse two items from a csv
instead of just one. Unfortunately, I just don't have the time to do learn
Perl right now. Has anyone made this modification already and are willing to
share? Here is the original for reference:

#start script
# getlog.pl
# Author: Paul Simmonson
# Input: filename of Windows 2000 Performance monitor log file (must be CSV
# Name of log item to extract
# eg. perl getlog-fixed.pl c:\perflogs\K6.csv "\\K6\LogicalDisk(C:)\% Disk
# Output: mrtg data format
open STUFF or die "Cannot open $STUFF for read :$!";
@entries = <STUFF>;
@details=split /,/, @entries[0]; #get the first line of the log file
@lastline=split /,/, @entries[$#entries]; #get last line of log file

#find the entry that matches $ARGV[1]
for $entry (@details) {
    $entry=~ tr/"//d;
    chomp ($entry);
    last if $entry eq $ARGV[1];

if ($last eq $ARGV[1]) {
    $data=~ tr/"//d;
    $data = int($data+0.5);
} else {
    $data = 0;
print "0\n";
print "$data\n";
print "0\n";
print "0\n";

#end script


Eric Brander
Texas CHIP Account
Sr. Communications Engineer - Information Systems Department
Eric dot Brander at acs-inc dot com

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