A comprehensive monitoring system for Redis and PostgreSQL with Grafana dashboards, Prometheus metrics, and alerting.
- Health Monitoring: Real-time health checks for Redis and PostgreSQL
- Metrics Collection: Prometheus metrics for service availability and response times
- Alerting: Automated alerts via Alertmanager with email and webhook support
- Dashboards: Pre-configured Grafana dashboards for visualization
- TypeScript: Fully typed Node.js application
- Docker Support: Complete Docker Compose setup
-
Clone and setup:
git clone <repository> cd monitoring-system make setup
-
Access services:
- Grafana: http://localhost:3000 (admin/admin)
- Prometheus: http://localhost:9090
- Alertmanager: http://localhost:9093
- Monitoring API: http://localhost:3001
REDIS_URL: Redis connection stringPOSTGRES_URL: PostgreSQL connection stringMETRICS_PORT: Port for metrics serverHEALTH_CHECK_INTERVAL: Health check interval in msALERT_WEBHOOK_URL: Alertmanager webhook URL
Configure alerts in alertmanager.yml:
- Email notifications
- Webhook integrations
- Slack/Teams notifications
GET /health- Overall system healthGET /metrics- Prometheus metricsGET /status- Service status details
service_up: Service availability (1=up, 0=down)service_response_time_seconds: Response time histogramhealth_checks_total: Health check counter
- ServiceDown: Service unavailable for >1 minute
- ServiceHighResponseTime: Response time >5 seconds
- RedisDown: Redis specific alert
- PostgresDown: PostgreSQL specific alert
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build TypeScript
npm run build
# Start production
npm start# Start all services
make up
# Stop all services
make down
# View logs
make logs
# Clean up
make clean
# Check health
make healthThe system includes a pre-configured dashboard showing:
- Service status indicators
- Response time graphs
- Health check rates
- Service details table
- Services not starting: Check Docker logs with
make logs - Metrics not appearing: Verify Prometheus is scraping the
/metricsendpoint - Alerts not firing: Check Alertmanager configuration and webhook URLs
- Dashboard not loading: Ensure Grafana can reach Prometheus
MIT