Complete gids voor health monitoring in PMA v2.
PMA v2 biedt uitgebreide health check functionaliteit voor alle services.
| Command | Beschrijving |
|---|---|
just health |
Basis health check alle services |
just health SERVICE |
Health check specifieke service |
just health --diagnose |
Uitgebreide diagnostiek |
just health --resources |
Resource usage (CPU, RAM, Disk) |
just health --json |
JSON output voor scripting |
Controleert of een service bereikbaar is via HTTP.
# Interne helper
_check-http url expected_code
# Voorbeeld
_check-http "http://localhost:9114" 200
| Service | URL | Expected |
|---|---|---|
| Redmine | http://localhost:9114 |
200 |
| n8n | http://localhost:5678/healthz |
200 |
| Grafana | http://localhost:3000/api/health |
200 |
| Mattermost | http://localhost:8065/api/v4/system/ping |
200 |
Controleert PostgreSQL database connectivity.
# Interne helper
_check-postgres container user database
# Voorbeeld
_check-postgres asd-redmine-db redmine redmine_production
Controleert MySQL/MariaDB database connectivity.
# Interne helper
_check-mysql container user password
# Voorbeeld
_check-mysql asd-erpnext-db root secretpassword
$ just health
+===============================================================+
| PMA Health Status |
+===============================================================+
| Service | Container | HTTP | Database | Status |
+===============================================================+
| authentik | running | 200 | OK | OK |
| redmine | running | 200 | OK | OK |
| n8n | running | 200 | OK | OK |
| mattermost | running | 200 | OK | OK |
| grafana | stopped | N/A | N/A | DOWN |
+===============================================================+
Overall: 4/5 services healthy
$ just health --diagnose
Service: redmine
Container: asd-redmine (running 3d 4h)
HTTP: http://localhost:9114 -> 200 OK (45ms)
Database: PostgreSQL -> connected (12ms)
Memory: 512MB / 1GB (51%)
CPU: 2.3%
Status: HEALTHY
Service: grafana
Container: asd-grafana (stopped)
Last exit: 2024-01-15 08:30:00
Exit code: 137 (OOM killed)
Status: UNHEALTHY
Recommendation: Increase memory limit
Health check data kan worden weergegeven in Grafana.
| Metric | Beschrijving |
|---|---|
pma_service_status |
Service status (0=down, 1=up) |
pma_http_response_time |
HTTP response tijd in ms |
pma_database_connections |
Actieve database connecties |
pma_container_memory_usage |
Container memory gebruik |
pma_container_cpu_usage |
Container CPU gebruik |
Het PMA Health Dashboard toont:
| Alert | Conditie | Actie |
|---|---|---|
| Service Down | Status = unhealthy > 2 min | Mattermost notificatie |
| High Memory | Memory > 90% | Warning log |
| Slow Response | Response > 5s | Warning log |
| Database Error | DB connection failed | Critical alert |
# n8n workflow trigger
alerts:
channel: "#ops-alerts"
mention: "@ops-team"
conditions:
- service_down
- critical_error
# Diagnose
just health SERVICE --diagnose
# Oplossing
just start SERVICE
just logs SERVICE # Check for errors
# Check of service luistert
curl -v http://localhost:PORT
# Check container logs
just logs SERVICE
# Restart service
just restart SERVICE
# Check database container
docker ps | grep db
# Check database logs
docker logs asd-SERVICE-db
# Test connectie handmatig
docker exec -it asd-SERVICE-db psql -U user -d database -c "SELECT 1"
# Check resources
just health --resources
# Bekijk container stats
docker stats
# Restart om memory te clearen
just restart SERVICE
| Code | Betekenis |
|---|---|
| 0 | Alle checks passed |
| 1 | Een of meer checks failed |
| 2 | Configuration error |
# JSON output voor scripts
just health --json
# Output:
{
"timestamp": "2024-01-15T10:30:00Z",
"services": {
"redmine": {"status": "healthy", "http": 200, "db": "ok"},
"grafana": {"status": "unhealthy", "http": null, "db": null}
},
"overall": "degraded"
}
# Crontab entry voor regelmatige health checks
*/5 * * * * cd /path/to/pma && just health --json >> /var/log/pma-health.json