This is one way I did it.   The letters represent different things.  
X,Y,Z,T,U,Q,W-- All Host Names. 

Hope this Helps

my @hosts= qw(XXXXX YYYYY ZZZZZZ TTTTTT UUUUUU QQQQQ WWWWWW;
my $username = "XXXXXXX";
my $passwd = "XXXXXXXX";
my $t;
my $check;
my @lines;
my $logPath   = "/home/XXXX/log";
my $hostname;

while(1){
foreach $hostname (@hosts) {
$t = new Net::Telnet (Timeout => 10,
                      Prompt => '/[>]$/',
                      Errmode => "return" );
$t->open("$hostname.db");
if ($t->login($username, $passwd) ) {
@lines = $t->cmd("ps -fu wuts_adm");
####Greps for results from command above#######
if ( grep /ae/, @lines) {    
}else {
    &Notifyanddie("The Damaen on $hostname is not running.");
}

$t->close();
}else {
    Notifyanddie("on connecting to $hostname.");
}
}

sleep (900);
}

Reply via email to