You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by fa...@apache.org on 2013/10/30 20:58:34 UTC

svn commit: r1537261 - /vcl/trunk/managementnode/lib/VCL/healthcheck.pm

Author: fapeeler
Date: Wed Oct 30 19:58:34 2013
New Revision: 1537261

URL: http://svn.apache.org/r1537261
Log:
VCL-683

removing _sshd_status from healthcheck

Modified:
    vcl/trunk/managementnode/lib/VCL/healthcheck.pm

Modified: vcl/trunk/managementnode/lib/VCL/healthcheck.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/healthcheck.pm?rev=1537261&r1=1537260&r2=1537261&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/healthcheck.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/healthcheck.pm Wed Oct 30 19:58:34 2013
@@ -247,13 +247,43 @@ sub process {
 		$node_status{"rpower"} = "off";
 		my $datestring; 
 		my $node_status_string = "reload";
-		
-		
 
 		notify($ERRORS{'OK'}, 0, "pinging node $computer_short_name ");
 		if(_pingnode($computer_short_name) ){
-			$node_status{ping} = 1;	
-			my $sshd_status = _sshd_status($computer_short_name);
+			$node_status{ping} = 1;	 
+			# Try nmap to see if any of the ssh ports are open before attempting to run a test command
+			my $port_22_status = nmap_port($computer_short_name, 22) ? "open" : "closed";
+			my $port_24_status = nmap_port($computer_short_name, 24) ? "open" : "closed";
+
+			my $port = 22; 
+			if ($port_24_status eq "open") {
+				$port = 24;
+			}
+
+			my $ssh_user= "root";
+			$ssh_user = "vclstaff" if ($computer_type eq "lab");
+
+			my ($exit_status, $output) = run_ssh_command({
+		       node => $computer_short_name,
+		       command => "echo \"testing ssh on $computer_short_name\"",
+		       max_attempts => 2,
+		       output_level => 0,
+				 port => $port,
+				 user => $ssh_user,
+		       timeout_seconds => 30,
+		   });
+
+			my $sshd_status = "off";
+		 
+		   # The exit status will be 0 if the command succeeded
+		   if (defined($output) && grep(/testing/, @$output)) {
+				notify($ERRORS{'OK'}, 0, "ssh test: Successful");
+			 	$sshd_status = "on";
+			}
+			else {
+				notify($ERRORS{'OK'}, 0, "ssh test: failed. port 22: $port_22_status, port 24: $port_24_status");
+			}
+
 			if($sshd_status eq "on") { 
 				$node_status{"ssh"} = 1;
 				if($computer_type eq "lab") {