Monitoring & Health Checks

Monitor BlueSentinel server health, agent connectivity, and system performance.


Health Check Endpoint

bash
curl https://your-server:5100/health

Response:

json
{
  "status": "healthy",
  "database": "connected",
  "version": "1.0.0"
}

Use this endpoint with your monitoring system (Nagios, Zabbix, UptimeRobot, etc.).

Key Metrics

Server Health

  • HTTP response time on /health
  • Gunicorn worker count — ensure all workers are alive
  • PostgreSQL connections — active vs max
  • Disk usage — especially the alerts table

Agent Health

  • Devices online — count of devices with heartbeat in last 5 minutes
  • Stale devices — devices with no heartbeat in 10+ minutes
  • Alert queue depth — pending alerts waiting for push

Business Metrics

  • Threats blocked per day — indicator of policy effectiveness
  • Compliance score — percentage of devices with all guards active
  • Enrollment rate — new devices per week

Alerting on Server Down

Set up external monitoring to check the /health endpoint every 60 seconds. Alert if:

  • Response is not 200
  • database is not connected
  • Response time exceeds 5 seconds

Log Monitoring

Server logs are output to stdout by Gunicorn. Configure log rotation:

bash
# /etc/logrotate.d/bluesentinel
/var/log/bluesentinel/*.log {
    daily
    rotate 14
    compress
    delaycompress
    missingok
    notifempty
}