Trajanje: ~2 minuti
Vloga: Gateway-operater
Pogostost: Dnevno / Avtomatizirano
Preverjanje razpoložljivosti in funkcionalnosti Gateway.
# Preprost Health Check curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/health # Pričakovan odgovor: 200
# Z vsebino odgovora curl -s http://localhost:5000/health # Pričakovan odgovor: "Healthy"
# Je Swagger dosegljiv? curl -s -o /dev/null -w "%{http_code}" http://localhost:5000/swagger # Preveri API-verzijo curl -s http://localhost:5000/api/v1/info | jq
# Preveri vse DSN for dsn in demo produkcija porocanje; do echo "Testiram $dsn..." curl -s -o /dev/null -w "$dsn: %{http_code}\n" \ "http://localhost:5000/api/v1/dsn/$dsn/tables" done
PowerShell-verzija:
$dsns = @("demo", "produkcija", "porocanje") foreach ($dsn in $dsns) { $result = Invoke-WebRequest -Uri "http://localhost:5000/api/v1/dsn/$dsn/tables" -UseBasicParsing Write-Host "$dsn : $($result.StatusCode)" }
# Posamezna poizvedba curl -s -o /dev/null -w "Čas: %{time_total}s\n" \ "http://localhost:5000/api/v1/dsn/demo/tables/Products?\$top=10" # Več ponovitev for i in {1..5}; do curl -s -o /dev/null -w "%{time_total}\n" \ "http://localhost:5000/api/v1/dsn/demo/tables/Products?\$top=10" done | awk '{sum+=$1} END {print "Povprečje: " sum/NR "s"}'
| # | Točka preverjanja | Pričakovano | V |
| — | ———– | ———– | — |
| 1 | /health | 200 + „Healthy“ | |
| 2 | /swagger | 200 | |
| 3 | DSN „demo“ dosegljiv | 200 | |
| 4 | Odzivni čas | < 1s | |
| 5 | Brez napak v dnevnikih | Ni ERROR |
Cron (Linux):
# /etc/cron.d/gateway-health */5 * * * * root curl -sf http://localhost:5000/health || systemctl restart data-gateway
Scheduled Task (Windows):
# health-check.ps1 $response = Invoke-WebRequest -Uri "http://localhost:5000/health" -UseBasicParsing -TimeoutSec 5 if ($response.StatusCode -ne 200) { Restart-Service -Name "DataGateway" -Force Send-MailMessage -To "admin@example.com" -Subject "Gateway Restart" -Body "Gateway je bil samodejno ponovno zagnan" }
| Težava | Vzrok | Rešitev |
| ——— | ——— | ——– |
Connection refused | Gateway ni zagnan | Zaženi strežnik |
503 Service Unavailable | Zagon še ni končan | Počakaj 30s, poskusi znova |
500 Internal Server Error | Napaka v konfiguraciji | Preveri dnevnike |
| Časovna omejitev | Gateway preobremenjen | Zmanjšaj obremenitev, povečaj vire |
| Metrika | Zelena | Rumena | Rdeča |
| ——– | —— | —— | —– |
| Odzivni čas | < 500ms | 500ms-2s | > 2s |
| Stopnja napak | < 1% | 1-5% | > 5% |
| Procesor | < 50% | 50-80% | > 80% |
| Pomnilnik | < 70% | 70-90% | > 90% |
« <- Upravljanje DSN | -> Pregled dnevnikov »
Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional