[mrtg] Re: Perfmon/MRTG/Threshold Check.-
Brander, Eric
Eric.Brander at ACS-INC.com
Mon May 12 15:58:24 MEST 2003
I modified getlog.pl so that it will get 2 targets from a csv.
#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
#
$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=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]) {
$dataI=@lastline[$index];
$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]) {
$dataO=@lastline[$index];
$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
Eric Brander
ACS
Texas CHIP Account
Sr. Communications Engineer - Information Systems Department
512.336.3331
Eric dot Brander at acs-inc dot com
-----Original Message-----
From: "Lotierzo, Leandro (Administración del Centro de Cómputos)"
[mailto:LLotierzo at lanacion.com.ar]
Sent: Thursday, May 08, 2003 6:24 PM
To: 'mrtg at list.ee.ethz.ch'
Subject: [mrtg] Perfmon/MRTG/Threshold Check.-
Importance: High
I'm trying to use Perfmon data & MRTG to check a threshold, but my *.log
file looks bad:
1052435775 0 586
1052435775 0 586 0 586
1052435474 0 586 0 586
1052435400 0 586 0 588
1052435100 0 588 0 592
1052434800 0 594 0 604
1052434500 0 604 0 604
1052434200 0 604 0 604
1052433900 0 604 0 604
1052433600 0 604 0 604
1052433300 0 604 0 604
1052433000 0 604 0 605
1052432700 0 605 0 605
1052432400 0 605 0 605
I don't know how to use two getlogs at the same target, 'cause the "&"
doesn't seem to work fine...
Does anybody have something like this working?
Title[lnacluster-3]:\\lnacluster\LogicalDisk(6/H:)\Free Megabytes
Pagetop[lnacluster-3]: <H1>\\lnacluster\LogicalDisk(6/H:)\Free
Megabytes</H1>
MaxBytes[lnacluster-3]: 100000000000000
Options[lnacluster-3]: gauge, nopercent, growright, nobanner
Target[lnacluster-3]: `perl c:\mrtg-2.9.25\bin\getlog.pl
C:\Inetpub\wwwroot\MRTG-ACC\PerfLogs\lnacluster.csv
"\\lnacluster\LogicalDisk(6/H:)\Free Megabytes"`&`perl
c:\mrtg-2.9.25\bin\getlog.pl
C:\Inetpub\wwwroot\MRTG-ACC\PerfLogs\lnacluster.csv
"\\lnacluster\LogicalDisk(6/H:)\Free Megabytes"`
ThreshMinI[lnacluster-3]: 99
ThreshProgI[lnacluster-3]: C:\mrtg-2.9.25\Batch\TreshSrvfilesH.bat
ThreshProgOKI[lnacluster-3]: C:\mrtg-2.9.25\Batch\TreshSrvfilesHOK.bat
YLegend[lnacluster-3]: Legend
ShortLegend[lnacluster-3]:
LegendO[lnacluster-3]:
LegendI[lnacluster-3]:
Legend2[lnacluster-3]:
Legend1[lnacluster-3]:
Este mensaje y sus adjuntos son confidenciales y de uso exclusivo para el
usuario a quien esta dirigido. Puede contener informacion amparada por el
secreto profesional.
Si Ud. no es el destinatario especificado no debe copiar, enviar o utilizar
ninguna parte del mismo y/o de sus adjuntos.
Las opiniones vertidas son responsabilidad del autor y no son emitidas ni
avaladas por S.A. LA NACION a menos que se indique claramente lo contrario y
que la identidad y autoridad del autor, para comprometer a nuestra empresa,
puedan ser verificados.
No se garantiza la integridad de los mensajes enviados por e-mail ni que los
mismos sean enviados en termino, o que no contengan errores o virus. El
emisor no aceptara responsabilidad por los errores, modificaciones u
omisiones que resulten en el mensaje, bajo la hipotesis de que pudo ser
modificado.
_______________________________________________________________
Ultimas noticias en LA NACION LINE <http://www.lanacion.com.ar>
--
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
--
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