GET /health¶
Health check endpoint for monitoring and uptime checking.
Overview¶
The /health endpoint provides a simple health check for monitoring server status and uptime.
Request¶
Method¶
GET
URL¶
Headers¶
None required
Parameters¶
None
Response¶
Success Response¶
Status: 200 OK
Content-Type: application/json
Body:
Fields:
status(string): Server health status (always"healthy"if responding)model(string): Name of the loaded model
Examples¶
cURL¶
Response:
Python¶
import requests
response = requests.get("http://localhost:8080/health")
data = response.json()
if data["status"] == "healthy":
print(f"Server is healthy, model: {data['model']}")
else:
print("Server unhealthy")
JavaScript¶
const response = await fetch('http://localhost:8080/health');
const data = await response.json();
if (data.status === 'healthy') {
console.log(`Server healthy, model: ${data.model}`);
}
Use Cases¶
1. Uptime Monitoring¶
Monitor server availability:
#!/bin/bash
while true; do
if curl -sf http://localhost:8080/health > /dev/null; then
echo "Server is healthy"
else
echo "Server is down!"
# Send alert
fi
sleep 60
done
2. Load Balancer Health Check¶
Configure load balancer health checks:
Nginx:
upstream gpux_backend {
server localhost:8080;
# Health check
health_check uri=/health interval=10s;
}
AWS ALB:
3. Kubernetes Liveness Probe¶
4. Cron Job Monitoring¶
*/5 * * * * curl -f http://localhost:8080/health || echo "GPUX server down" | mail -s "Alert" admin@example.com
Best Practices¶
Use for Monitoring
Integrate /health endpoint with monitoring tools:
- Prometheus
- Grafana
- Datadog
- New Relic
Set Appropriate Timeouts
Configure reasonable timeout values:
Check Regularly
Poll health endpoint at regular intervals (30-60 seconds)