sierpinski has asked for the wisdom of the Perl Monks concerning the following question:
$ssh->send("$svmmaint_cmd"); my $line; my $svm_error=0; while ( defined ($line = $ssh->read_line()) ) { if($line =~ /err|maint|repl|sync/i) { $svm_error = 1; } } if($svm_error) { open(SVM,">>$SVMMAINTFILE"); print SVM "$serverlist[$host] has a bad mirror/disk\n" +; close(SVM); $svm_error=0; $ssh->read_all(2); # Tried to flush the input buffer +here, no dice } # Flush the input buffer $ssh->read_all(1); # sometimes this works on other checks, bu +t doesn't help here either $line = ""; # this was no help either # This is a new check, same ssh connection/expect object # Execute metadb check $ssh->send("$metadb_cmd"); my $line; while ( defined ( $line = $ssh->read_line()) ) { print("$serverlist[$host] - $line\n"); if($line < 6) { open(MDB,">>$METADBFILE"); print MDB "$serverlist[$host] has less than 6 +metadbs\n"; close(MDB); } }
So I have a print statement in the 2nd check that should print '6' if it's set up correctly. This tells us that we have 3 metadbs on 1 disk, and 3 on another, so if we lose 1 disk we still have a good set of useful information. Any less than that and we're at risk for having a server not be bootable.
The problem is that the first check (checking to see if there are errors on the disk) has output that looks like this:
So the first check listed above checks for the "needs maintenance" state of the 'metastat' command. The second check just counts the lines in a 'metadb' output.server1 - 6 server2 - 6 server3 - 9 server4 - 9 server5 - State: Needs maintenance server5 - State: Needs maintenance server5 - Invoke: metareplace d105 c4t1d0s4 <new device> server5 - c4t1d0s4 0 No Maintenance Yes server5 - 6 server6 - 6 server7 - 6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SSH::Expect timeout/delay issue
by salva (Canon) on Nov 14, 2009 at 12:04 UTC | |
by sierpinski (Chaplain) on Nov 18, 2009 at 14:19 UTC | |
by salva (Canon) on Nov 18, 2009 at 15:21 UTC | |
by sierpinski (Chaplain) on Nov 18, 2009 at 18:32 UTC |