| Category: | Net |
| Author/Contact Info | ackme |
| Description: | Uses Activeperl to check logs on a unix box from an NT machine. It tails the log, grabs the last line, and posts it into a logfile I create on the NT box. The log on the Unix box is in the form eod.log.mmddyy. Also logs a warning if the last line of the log is not the expected one. |
use Net::Telnet ();
$username = "ackme";
$password = "XXXXXXXXX";
$t = new Net::Telnet (Timeout => 60);
$t->open("some.otherbox.com");
$t->login($username, $password);
@d = $t->cmd("date +%m%d%y");
chop(@d);
@lines = $t->cmd("tail -1 /home/ackme/eod.log.$d[0]");
$->logout;
open (LOG, ">>I:/perl/testlog") || "cannot create testlog! $!";
print LOG "the date: $d[0]\n";
chop @lines[0];
$correct = "eod complete exit status = 0";
if (${lines}[0] ne $correct) {
print LOG "WARNING LOG NOT CORRECT!!";
} else {
print LOG "the last line of the EOD log is: \"$lines[0]\"\n";
}
close (LOG) || "can't close testlog: $!"
|
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: remote logchecker
by crenz (Priest) on Aug 02, 2002 at 08:14 UTC | |
|
Re: remote logchecker
by Tomte (Priest) on Aug 02, 2002 at 08:25 UTC | |
|
Re: remote logchecker
by ackme (Scribe) on Aug 02, 2002 at 08:54 UTC | |
by Anonymous Monk on Aug 02, 2002 at 12:01 UTC | |
by ackme (Scribe) on Aug 02, 2002 at 14:55 UTC |