-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCHECK_SYSTEM_STATUS.ps1
More file actions
99 lines (91 loc) · 4.09 KB
/
Copy pathCHECK_SYSTEM_STATUS.ps1
File metadata and controls
99 lines (91 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Quick system status check
Write-Host "=== SYSTEM STATUS CHECK ===" -ForegroundColor Cyan
Write-Host ""
# Check if Keycloak is running
Write-Host "Checking Keycloak (9090)..." -ForegroundColor Yellow
try {
$response = Invoke-WebRequest -Uri "http://localhost:9090" -TimeoutSec 3 -ErrorAction Stop
Write-Host "✓ Keycloak is UP" -ForegroundColor Green
} catch {
Write-Host "✗ Keycloak is DOWN or not responding" -ForegroundColor Red
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Gray
}
Write-Host ""
# Check if UserService is running
Write-Host "Checking UserService (8085)..." -ForegroundColor Yellow
try {
$response = Invoke-WebRequest -Uri "http://localhost:8085/actuator/health" -TimeoutSec 3 -ErrorAction Stop
Write-Host "✓ UserService is UP" -ForegroundColor Green
} catch {
try {
$response = Invoke-WebRequest -Uri "http://localhost:8085" -TimeoutSec 3 -ErrorAction Stop
Write-Host "✓ UserService is UP (no actuator)" -ForegroundColor Green
} catch {
Write-Host "✗ UserService is DOWN or not responding" -ForegroundColor Red
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Gray
}
}
Write-Host ""
# Check if API Gateway is running
Write-Host "Checking API Gateway (8888)..." -ForegroundColor Yellow
try {
$response = Invoke-WebRequest -Uri "http://localhost:8888" -TimeoutSec 3 -ErrorAction Stop
Write-Host "✓ API Gateway is UP" -ForegroundColor Green
} catch {
if ($_.Exception.Response.StatusCode.value__ -eq 404) {
Write-Host "✓ API Gateway is UP (404 is normal)" -ForegroundColor Green
} else {
Write-Host "✗ API Gateway is DOWN or not responding" -ForegroundColor Red
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Gray
}
}
Write-Host ""
# Check if Eureka is running
Write-Host "Checking Eureka (8761)..." -ForegroundColor Yellow
try {
$response = Invoke-WebRequest -Uri "http://localhost:8761" -TimeoutSec 3 -ErrorAction Stop
Write-Host "✓ Eureka is UP" -ForegroundColor Green
} catch {
Write-Host "✗ Eureka is DOWN or not responding" -ForegroundColor Red
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Gray
}
Write-Host ""
# Test Keycloak connection from UserService perspective
Write-Host "Testing Keycloak connection..." -ForegroundColor Yellow
try {
$response = Invoke-RestMethod -Uri "http://localhost:8085/api/auth/test-keycloak" -TimeoutSec 5 -ErrorAction Stop
Write-Host "✓ UserService can connect to Keycloak" -ForegroundColor Green
Write-Host " Realms found: $($response.realms_count)" -ForegroundColor Gray
} catch {
Write-Host "✗ UserService cannot connect to Keycloak" -ForegroundColor Red
Write-Host " Error: $($_.Exception.Message)" -ForegroundColor Gray
if ($_.ErrorDetails.Message) {
$errorObj = $_.ErrorDetails.Message | ConvertFrom-Json
Write-Host " Details: $($errorObj.error)" -ForegroundColor Gray
}
}
Write-Host ""
# Check Java processes
Write-Host "Checking Java processes..." -ForegroundColor Yellow
$javaProcesses = Get-Process java -ErrorAction SilentlyContinue
if ($javaProcesses) {
Write-Host "✓ Found $($javaProcesses.Count) Java process(es)" -ForegroundColor Green
foreach ($proc in $javaProcesses) {
Write-Host " PID: $($proc.Id) - Memory: $([math]::Round($proc.WorkingSet64/1MB, 2)) MB" -ForegroundColor Gray
}
} else {
Write-Host "✗ No Java processes found" -ForegroundColor Red
}
Write-Host ""
Write-Host "=== SUMMARY ===" -ForegroundColor Cyan
Write-Host ""
Write-Host "If any service is DOWN:" -ForegroundColor Yellow
Write-Host "1. Check IntelliJ console for errors" -ForegroundColor Gray
Write-Host "2. Check Keycloak console window" -ForegroundColor Gray
Write-Host "3. Try restarting the service" -ForegroundColor Gray
Write-Host ""
Write-Host "If Keycloak connection fails:" -ForegroundColor Yellow
Write-Host "1. Run: .\FORCE_CLEAN_KEYCLOAK_H2.ps1" -ForegroundColor Gray
Write-Host "2. Recreate admin in Keycloak (admin/admin)" -ForegroundColor Gray
Write-Host "3. Run: .\AUTO_CONFIGURE_KEYCLOAK.ps1" -ForegroundColor Gray
Write-Host ""