[prev in list] [next in list] [prev in thread] [next in thread]
List: perl-win32-admin
Subject: RE: win32::eventlog
From: Dutrieux Yves <YDU () cph ! be>
Date: 2003-08-18 14:21:55
[Download RAW message or body]
I think you don't include \\ inyour hostname.
Try with only "Web1","data1",....
let me know if it's ok.
Yves
-----Original Message-----
From: pineau [mailto:j_c_pineau@hotmail.com]
Sent: Monday, August 18, 2003 2:33 PM
To: perl-win32-admin@listserv.ActiveState.com
Subject: win32::eventlog
Hi all.
Here is a script that should get eventlog records on remote machine, but the
getNumber() and getOldest() functions don't work so that I can't read remote
eventlog records... I'm connected as network administrator with all rights
that can exist in the world.
Does anyone have any idea of what happens ?? Thanks a lot...
$time = time;
#$host = "Seiya";
@hosts = ("\\\\web1", "\\\\data1", "\\\\smtp", "\\\\dns2", "\\\\dns1",
"\\\\rentabiliweb", "\\\\data0", "\\\\debussac", "\\\\web2", "\\\\ged");
open(FILE, ">c:/resultats_msg_err.txt");
$date = ctime(stat("c:/resultats_msg_err.txt")->mtime);
print FILE "résultats du contrôle des messages d'erreur du $date\n\n\n";
foreach $host (@hosts) {
print FILE "Message d'erreur de $host\n\n\n";
foreach $eventLog ("Application", "System", "Security") {
$handle=Win32::EventLog->new($eventLog, $host)
or die "Can't open $eventLog EventLog on $host\n";
if ($eventLog eq "Application") {
print FILE "Message d'erreur des applications:\n";
} elsif ($eventLog eq "System") {
print FILE "Message d'erreur du système:\n";
} else {print FILE "Message d'erreur de sécurité:\n";}
$handle->GetNumber($recs)
or die "Can't get number of EventLog records on $host\n";
$handle->GetOldest($base)
or die "Can't get number of oldest EventLog record on $host\n";
$x = $recs + $base;
$count = 0;
while ($x - 1 > $base) {
$handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
$x - 1,
$hashRef)
or die "Can't read EventLog entry #$x\n";
if (($hashRef->{TimeGenerated} >= $time - 86400) &&
($hashRef->{EventType} eq EVENTLOG_ERROR_TYPE || $hashRef->{EventType} eq
EVENTLOG_WARNING_TYPE)) {
Win32::EventLog::GetMessageText($hashRef);
print FILE "Entry $x: $hashRef->{Message}\n";
$count++;
}
$x++;
}
}
}
close FILE;
----------------------------------
Jean-Christophe PINEAU
Ingénieur réseaux
jc.pineau@cs3i.fr
_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic