Inhaltsverzeichnis
Runbook: Health Check
Trajanje: ~2 minuti
Vloga: Gateway-operater
Pogostost: Dnevno / Avtomatizirano
Preverjanje razpoložljivosti in funkcionalnosti Gateway.
Potek dela
flowchart TD
A[Začni Health Check] --> B[/health končna točka]
B --> C{Zdrav?}
C -->|Da| D[API-test]
C -->|Ne| E[Preveri dnevnike]
D --> F{Podatki vrnjeni?}
F -->|Da| G[V redu - Končano]
F -->|Ne| H[Preveri DSN]
E --> I[Ponovno zaženi strežnik]
H --> I
style G fill:#e8f5e9
style E fill:#ffebee
style H fill:#fff3e0
1. Osnovni Health Check
# 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"
2. Razširjen Health Check
# 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
3. DSN-povezljivost
# 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)" }
4. Merjenje odzivnega časa
# 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"}'
5. Kontrolni seznam
| # | 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 |
Avtomatiziran Health Check
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" }
Odpravljanje težav
| 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 |
Mejne vrednosti
| 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% |
Povezani Runbooks
- Zagon strežnika - Ob izpadu
- Pregled dnevnikov - Analiza napak
- Prometheus - Samodejni nadzor
« <- Upravljanje DSN | -> Pregled dnevnikov »
Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional
Zuletzt geändert: dne 29.01.2026 ob 23:41