monitoring-database-health
Installation
SKILL.md
Database Health Monitor
Overview
Monitor database server health across PostgreSQL, MySQL, and MongoDB by tracking key performance indicators including connection utilization, query throughput, replication lag, disk usage, cache hit ratios, vacuum activity, and lock contention.
Prerequisites
- Database credentials with access to system statistics views (
pg_stat_*,performance_schema,serverStatus) psql,mysql, ormongoshCLI tools for running health check queries- Permissions:
pg_monitorrole (PostgreSQL),PROCESSprivilege (MySQL) - Baseline metrics from a period of normal operation for threshold calibration
- Alerting channel configured (email, Slack webhook, PagerDuty)
Instructions
- Check connection utilization:
- PostgreSQL:
SELECT count(*) AS active_connections, (SELECT setting::int FROM pg_settings WHERE name = 'max_connections') AS max_connections, round(count(*)::numeric / (SELECT setting::int FROM pg_settings WHERE name = 'max_connections') * 100, 1) AS utilization_pct FROM pg_stat_activity - MySQL:
SELECT VARIABLE_VALUE AS connections FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Threads_connected' - Alert threshold: utilization above 80%
- PostgreSQL:
Related skills