Wednesday, October 7, 2009

Perl And Capturing remote stdout and strerr streams

The script opens the systemout.log of the nodeagent and finds the references to the incident streams and shows them on the screen. Helpfull for troubleshooting WebSphere startup problems.

#!/usr/bin/perl

open (CMD, "( /usr/bin/ssh foouser\@host1 'cd pf/logs/nodeagent/;cat systemout.log | grep resetIncidentStream | cut -b152-') |")
or die "ERROR: $!";
while () {
print $_, "\n";
open (CMD2, "( /usr/bin/ssh foouser\@host2 'grep -i exception $_') |");
while () {
print "$_";
}
}
close (CMD);

No comments:

Post a Comment