Database Health Monitoring
Pulsimo monitors its own PostgreSQL database health with automated maintenance schedulers and cron jobs to prevent heavy data accumulation and ensure optimal performance.
Overview
Pulsimo provides native support for monitoring its internal database health, including connection verification, query performance tracking, and automated maintenance scheduling to keep the database optimized and prevent storage bloat.
PostgreSQL
- • Connection health monitoring
- • Query performance tracking
- • Table statistics analysis
Automated Tasks
- • Hourly data aggregation
- • Daily cleanup operations
- • Statistics generation
Automated Maintenance Scheduler
Pulsimo runs automated cron jobs to maintain database health and prevent excessive data storage:
Hourly Aggregation
Aggregates health check data every hour to reduce database size. Raw health check records are summarized into hourly metrics, keeping detailed data for the last 24 hours while storing aggregated data for historical analysis.
Daily Cleanup
Archives old health check records daily to prevent table bloat. By default, raw health check data older than 30 days is moved to archive tables or deleted based on retention policies. This prevents the database from growing indefinitely.
Statistics Generation
Generates performance reports and trend analysis data. Creates daily, weekly, and monthly statistics for uptime percentages, average response times, and incident frequency without storing every individual data point.
Why Automated Maintenance Matters
Without automated cleanup, Pulsimo's database could grow to hundreds of gigabytes within months when monitoring 500+ endpoints with 10-second check intervals. The maintenance scheduler ensures:
- ✓ Database size remains manageable (typically under 10GB)
- ✓ Query performance stays fast even with long-running deployments
- ✓ Disk space doesn't fill up unexpectedly
- ✓ Historical trends are preserved without storing raw data
Scheduler Configuration
The maintenance schedulers run automatically via cron jobs configured during installation:
# Hourly Aggregation (runs at :00) 0 * * * * /app/scripts/aggregate-health-data.sh # Daily Cleanup (runs at 2:00 AM) 0 2 * * * /app/scripts/cleanup-old-data.sh # Statistics Generation (runs at 3:00 AM) 0 3 * * * /app/scripts/generate-statistics.sh
Data Retention Policies
| Data Type | Retention Period | Storage Format |
|---|---|---|
| Raw Health Checks | 24 hours | Full detail |
| Hourly Aggregates | 30 days | Summarized metrics |
| Daily Summaries | 1 year | Aggregated stats |
| Incidents | Indefinite | Full detail preserved |
Monitoring Database Health
Track Pulsimo's own database health through the system:
- Connection Pool: Monitor active connections and pool saturation
- Query Performance: Track slow queries and optimize indexes
- Table Sizes: Monitor table growth and vacuum operations
- Disk Usage: Alert when database size approaches limits
Best Practices
💾 Monitor Disk Space: Ensure your server has adequate disk space. Even with cleanup, plan for at least 20GB for the database in production.
📊 Review Logs: Check maintenance logs regularly to ensure cleanup jobs complete successfully and don't encounter errors.