diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index 039a9c8e7..9cfe1c319 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -286,10 +286,20 @@ sub is_firewall_open { sub is_http_ready { my $mnip = shift; $mnip = shift if (($mnip) && ($mnip =~ /probe_utils/)); + my $httpport = shift; my $installdir = shift; my $errormsg_ref = shift; - my $http = "http://$mnip/$installdir/postscripts/syslog"; + my $http_status = `netstat -tunlp | grep -e "httpd" -e "apache" | grep "LISTEN" 2>&1`; + if (!$http_status) { + $$errormsg_ref = "No HTTP listening status get by command 'netstat'"; + return 0; + } elsif ($http_status !~ /\S*\s+\S*\s+\S*\s+\S*$httpport\s+.+/) { + $$errormsg_ref = "The port defined in 'site' table HTTP is not listening"; + return 0; + } + + my $http = "http://$mnip:$httpport/$installdir/postscripts/syslog"; my %httperror = ( "400" => "The request $http could not be understood by the server due to malformed syntax", "401" => "The request requires user authentication.", diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 9264a5174..612e95620 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -715,10 +715,18 @@ sub check_http_service { push @$error_ref, "HTTP check need 'wget' tool, please install 'wget' tool and try again"; } else { { - my $installdir = `lsdef -t site -i installdir -c 2>&1 | awk -F'=' '{print \$2}'`; - chomp($installdir); + my $httpinfo = `lsdef -t site -i installdir,httpport -c 2>&1`; + my $installdir = ""; + my $httpport = 80; + if ($httpinfo =~ /clustersite: installdir=(\S*)/) { + $installdir = $1; + } + if ($httpinfo =~ /clustersite: httpport=(\S*)/) { + $httpport = $1; + } + unless($installdir){ - push @$error_ref, "HTTP work path(installdir) isn't configured in 'sit' table"; + push @$error_ref, "HTTP work path(installdir) isn't configured in 'site' table"; last; } @@ -728,7 +736,7 @@ sub check_http_service { } my $errormsg; - unless(probe_utils->is_http_ready("$serverip", $installdir, \$errormsg)) { + unless(probe_utils->is_http_ready("$serverip", $httpport, $installdir, \$errormsg)) { push @$error_ref, "$errormsg"; last; }