Fleet Health Monitoring: One Dashboard for Every Database
Published November 20, 2024 · 9 min read · by DBKnox
As engineering teams scale, so does their database estate. A startup that started with a single PostgreSQL instance ends up with a primary and replica for the product, a separate analytics database, a MySQL instance hosting a legacy CRM, and an Oracle database inherited from an acquisition. Each runs on different infrastructure, owned by different teams, with different access patterns and failure modes.
Monitoring them all individually means five dashboards, five alert configurations, and five mental models for what "healthy" means on each engine. When something goes wrong, there's no single place to get the picture — just a Slack message that one of the databases is slow, followed by twenty minutes of context-switching to figure out which one and why.
DBKnox Fleet Health Monitoring is the answer to that fragmentation: a single dashboard that shows every database's health score, check history, and status — updated after every scheduled check cycle.
What DBKnox health checks measure
Fleet health monitoring doesn't just ping a database to see if it's up. DBKnox runs structured diagnostic checks that measure the operational state of the database across multiple dimensions. The core check categories are:
- CPU and memory utilisation — high CPU or memory pressure often surfaces before query performance visibly degrades, making these early-warning indicators
- Active connections — approaching the max_connections limit on PostgreSQL or max_allowed_connections on MySQL causes new connections to fail; DBKnox tracks the ratio and warns before saturation
- Query latency — mean and P95 execution time across recent queries; a rising latency trend often indicates index degradation, lock contention, or a new slow query introduced by a recent deploy
- Cache hit ratio — the percentage of query blocks served from the buffer cache rather than disk; a falling cache hit ratio indicates the working set has grown beyond available memory
- Lock waits and deadlocks — elevated lock wait counts indicate transactions contending for the same rows; deadlocks are almost always application bugs worth surfacing immediately
- Replication lag — for PostgreSQL primaries with replicas, lag is tracked in bytes and seconds; applications that read from replicas need this under a threshold to stay consistent
- Index bloat — PostgreSQL indexes grow over time due to dead tuple accumulation from MVCC; DBKnox measures the ratio of bloat to total index size and flags indexes above a threshold
Each check is engine-aware. PostgreSQL replication lag checks don't run against MySQL databases. MSSQL wait stats checks don't run against Oracle. The check set adapts to the engine type, so the fleet health score you see reflects diagnostics that actually make sense for each database.
How the check scheduler works
DBKnox uses BullMQ — a Redis-backed job queue library for Node.js — to schedule and execute health check jobs. When a tenant configures a check schedule (a standard cron expression), DBKnox creates a repeatable BullMQ job that fires on that schedule. Each job execution connects to the target database, runs the check set, records each check result (pass/warn/fail + latency), updates the fleet health score, and fires the health_check.completed webhook event if one is registered.
The BullMQ architecture has several practical advantages over simple cron jobs: retries on failure, dead letter queues for persistent failures, job execution history, and horizontal scaling (multiple worker processes can consume from the same queue). Health check jobs are isolated per database — a timeout on one check doesn't block checks for other databases.
Reading the health history
Each health check run produces a time-stamped record with three fields: status (pass/warn/fail), latency (how long the check took to execute), and the check value (the raw metric reading). DBKnox stores this history per check per database and surfaces it as a timeline in the fleet dashboard.
The timeline view makes patterns visible that point queries miss. A database that scores 72 today might have scored 95 two weeks ago — the declining trend over time is more actionable than the current snapshot. A check that alternates warn/pass on every other run often indicates a periodic background job (a nightly vacuum, a batch job) that temporarily spikes resource usage.
The fleet-wide health score (0–100) is a weighted aggregate across all check results. A single critical failure (like a deadlock storm) pulls the score down sharply. Multiple warnings have a cumulative drag. A clean check cycle across all checks produces a score above 90.
Beautiful PDF reports: what they contain and how to act on them
Fleet health monitoring gives you real-time visibility. PDF health reports give you the deeper diagnostic layer: statistical analysis, trend detection, and prioritised recommendations with ready-to-execute SQL.
A DBKnox PDF health report runs 10–20 pages and includes:
- Executive summary — health score, top issues, and trend direction since the last report
- Metric analysis — time-series charts for all monitored metrics over the report period
- Statistical analysis — P5/P50/P95 percentiles for latency metrics; linear regression to detect degradation trends before they're visibly obvious
- Table and index analysis — index bloat percentages, unused indexes with estimated size savings, missing index suggestions based on sequential scan patterns
- Slow query analysis — top queries by total execution time and mean latency, with EXPLAIN plan annotation and optimisation notes
- Prioritised recommendations — ranked action items with severity (critical/warning/info), estimated impact, and ready-to-execute SQL for each recommendation
The recommendations section is where the report earns its value. Rather than presenting raw metrics and leaving interpretation to the reader, DBKnox surfaces specific actions: "REINDEX CONCURRENTLY on orders_customer_id_idx will reclaim 2.3GB and reduce index scan latency by an estimated 40%." The SQL is ready to copy and execute, with an appropriate transaction wrapper and rollback instructions where relevant.
Custom health checks
Built-in checks cover generic database health. Custom health checks let you monitor application-specific metrics that DBKnox has no way to know about out of the box.
A custom health check is a user-defined SQL query that returns a numeric value, paired with a threshold that defines pass/warn/fail boundaries. For example, a team running a job queue in a database table might define a check that queries the pending job count and fails if it exceeds 10,000. That check runs on the same schedule as the built-in checks, its results appear in the fleet health score, and it's included in PDF reports.
Custom checks make fleet monitoring extensible to any metric your application exposes through the database, without requiring custom monitoring infrastructure.
Getting started with fleet monitoring
Fleet health monitoring is available on the Pro plan and above. After connecting your databases, navigate to Fleet → Configure Schedule to set your check frequency. The default schedule runs every 30 minutes. Enable check notifications in your webhook settings to route health_check.completed events to Slack, PagerDuty, or any HTTP endpoint.