Hello,
I have used getlog to monitor performance on each of my servers, traffic on
both NICs (frontnet, backnet), server errors, and HTTP errors (404 etc).
To do this I have used different versions of getlog.pl
I hope this helps!
Frank Ervin
3Delta Systems
This is the original getlog.pl:
# getlog.pl
#
# Author: Paul Simmonson
#
# 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
#
[EMAIL PROTECTED];
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]
$index=-1;
for $entry (@details) {
$index++;
$entry=~ tr/"//d;
chomp ($entry);
$last=$entry;
last if $entry eq $ARGV[1];
}
if ($last eq $ARGV[1]) {
[EMAIL PROTECTED];
$data=~ tr/"//d;
$data = int($data+0.5);
} else {
$data = 0;
}
print "0\n";
print "$data\n";
print "0\n";
print "0\n";
Found this one for putting interface in/out on same graph:
#Start
# getlog_two.pl
#
# Author: Paul Simmonson
#
# Modified by Eric Brander to get 2 targets from one CSV.
#
# Input: filename of Windows 2000 Performance monitor log file (must be CSV
format)
# Name of log item to extract
# eg. perl getlog_two.pl c:\perflogs\K6.csv "\\K6\LogicalDisk(C:)\% Disk
Time" "\\K6\LogicalDisk(D:)\% Disk Time"
# Output: mrtg data format
#
[EMAIL PROTECTED];
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]
$index=-1;
for $entry (@details) {
$index++;
$entry=~ tr/"//d;
chomp ($entry);
$last=$entry;
last if $entry eq $ARGV[1];
}
if ($last eq $ARGV[1]) {
[EMAIL PROTECTED];
$dataI=~ tr/"//d;
$dataI = int($dataI+0.5);
} else {
$dataI = "Not Found";
}
#find the entry that matches $ARGV[2]
$index=-1;
for $entry (@details) {
$index++;
$entry=~ tr/"//d;
chomp ($entry);
$last=$entry;
last if $entry eq $ARGV[2];
}
if ($last eq $ARGV[2]) {
[EMAIL PROTECTED];
$dataO=~ tr/"//d;
$dataO = int($dataO+0.5);
} else {
$dataO = "Not Found";
}
print "$dataI\n";
print "$dataO\n";
print "0\n";
print "0\n";
#End
This is the script I use to monitor 'Total Not Found' etc web service
errors:
# getlog.pl
#
# Author: Paul Simmonson
# Modified by Frank Ervin to subtract last value from the current value in
.CSV
# (I set log duration to least 7 days. Periodic information security scans
# generate around a thousand HTTP 404 errors per five minute interval. This
# causes the graph's scale to be thrown way off. To compensate for this and
make
# slight increases in 404 visible, this script will return 75 if value > 75)
#
# 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
#
[EMAIL PROTECTED];
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
@secondlline=split /,/, @entries[-2]; #get second last line of log file
#find the entry that matches $ARGV[1]
$index=-1;
for $entry (@details) {
$index++;
$entry=~ tr/"//d;
chomp ($entry);
$last=$entry;
last if $entry eq $ARGV[1];
}
if ($#entries > 1) {
if ($last eq $ARGV[1]) {
[EMAIL PROTECTED];
[EMAIL PROTECTED];
$data=~ tr/"//d;
$datatwo=~ tr/"//d;
$data=$data-$datatwo;
$data = int($data+0.5);
} else {
$data = 0;
}
}
else {
$data = 0;
}
if ($data > 75) {
$data = 75;
}
print "0\n";
print "$data\n";
print "0\n";
print "0\n";
-----Original Message-----
From: Marcel Sangers [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 11:27 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [mrtg] getlog.pl
I've just read an article about monitoring windows nt/2000 with MRTG,
Perfmon and getlog.pl
I am no trying to get it to work, but don't have and cannot find the
getlog.pl to use with it.
I'm specially interested in monitoring the number of active terminal server
sessions.
regards,
marcel
--
Unsubscribe mailto:[EMAIL PROTECTED]
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
--
Unsubscribe mailto:[EMAIL PROTECTED]
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