Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
foreach my $node (@nodes) { #sleep(1); my $pid = $pm->start and next; my $nodeip = $Configuration::node_list_nmnet{$node}; $datestamp = strftime("%Y%m%d%H%M", localtime); my $ssh = Net::SSH::Expect->new ( host => $nodeip, password=> "*****", user => "******", timeout => 5, raw_pty => 1, log_stdout => 0, exp_debug => 0, log_file => "/home/logs/$node/diam.$node.$datestamp.log" ); my $login_output = $ssh->login(); $ssh->waitfor("#", 30); $ssh->send("show diameter peers full debug"); $ssh->waitfor("#", 240); my $output; $output = $ssh->before; if ($output =~ /Peers in CLOSED state\S*\s*(\d*)/ ){ $peersvalue = $1; if ($peersvalue > 0){ print "$node\n"; push @emaillog, "$node\n\n"; $sendemail = 1; } } $datestamp = strftime("%Y%m%d%H%M", localtime); $pm->finish(0); } print "Waiting for Children...\n"; $pm->wait_all_children;
|
|---|