<# Service Status Check for Aliyun Dev Environment #> $ErrorActionPreference = "SilentlyContinue" Write-Host "==========================================" Write-Host " Aliyun Dev Environment Status Check" Write-Host "==========================================" Write-Host "" $services = @( @{ Name = "Nacos"; Host = "8.140.221.49"; Port = 8848 }, @{ Name = "MariaDB"; Host = "8.140.221.49"; Port = 3306 }, @{ Name = "Redis"; Host = "8.140.221.49"; Port = 6379 }, @{ Name = "Image Registry"; Host = "8.140.221.49"; Port = 5000 }, @{ Name = "Nginx"; Host = "8.140.221.49"; Port = 80 }, @{ Name = "API Gateway"; Host = "8.140.221.49"; Port = 8080 }, @{ Name = "Jenkins"; Host = "localhost"; Port = 8080 }, @{ Name = "SonarQube"; Host = "localhost"; Port = 9000 }, @{ Name = "Nexus"; Host = "localhost"; Port = 8091 } ) $successCount = 0 $failedCount = 0 foreach ($service in $services) { Write-Host "Checking $($service.Name)..." try { $tcpClient = New-Object System.Net.Sockets.TCPClient $asyncResult = $tcpClient.BeginConnect($service.Host, $service.Port, $null, $null) $waitResult = $asyncResult.AsyncWaitHandle.WaitOne(5000, $false) if ($waitResult) { $tcpClient.EndConnect($asyncResult) | Out-Null $tcpClient.Close() Write-Host "OK - $($service.Name) is running`n" -ForegroundColor Green $successCount++ } else { Write-Host "FAIL - $($service.Name) is not responding`n" -ForegroundColor Red $failedCount++ } } catch { Write-Host "FAIL - $($service.Name) error: $_`n" -ForegroundColor Red $failedCount++ } } Write-Host "==========================================" Write-Host " Summary" Write-Host "==========================================" Write-Host "Total: $($services.Count) | Success: $successCount | Failed: $failedCount" if ($failedCount -eq 0) { Write-Host "All services are running!" -ForegroundColor Green } else { Write-Host "$failedCount services need attention!" -ForegroundColor Yellow }