Server Connection Issues

Troubleshooting connectivity between agents and the central server.


Agent Cannot Reach Server

Check Network Connectivity

bash
# From the endpoint
curl -v https://your-server:5100/health

If this fails:

  • Verify the server is running (systemctl status bluesentinel)
  • Check if port 5100 is open in the firewall
  • Check if TLS certificate is valid (agents use verify=True)

Check Server Health

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

Expected response:

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

If database is not connected, check PostgreSQL:

bash
sudo systemctl status postgresql
sudo -u postgres psql -c "SELECT 1;"

TLS Certificate Issues

If using a self-signed certificate:

  1. Copy the CA certificate to the agent's certs/ directory
  2. The agent will use it for verification

If using Let's Encrypt, ensure the certificate is not expired:

bash
sudo certbot certificates

Request Timeout

The agent uses a 15-second request timeout. If the server is slow:

  • Check Gunicorn worker count (increase if needed)
  • Check PostgreSQL connection pool (increase if exhausted)
  • Check server CPU/RAM usage

Database Connection Issues

PostgreSQL Not Running

bash
sudo systemctl start postgresql

Connection Pool Exhausted

Symptoms: server returns 500 errors, logs show "QueuePool limit reached"

Fix: increase pool size in the application configuration or increase PostgreSQL max_connections.

Slow Queries

The alerts table can grow very large. Check for:

  • Missing indexes (run VACUUM ANALYZE alerts;)
  • Large unacknowledged alert backlog
  • Consider partitioning the alerts table by month