Advanced, centralized PostgreSQL monitoring and schema tracking for zero-downtime operations.
PGWarden is an open-source, robust solution designed to monitor multiple PostgreSQL databases simultaneously from a single pane of glass. It not only tracks performance metrics, locks, and active sessions in real-time, but also keeps a complete and versioned history of your schema (tables, columns, and indexes) changes over time.
- Multi-Server Monitoring: Connect and monitor several PostgreSQL servers and their databases dynamically.
- Metric Collection: Continuous polling of deep metrics like index usage, sequential scans, live/dead tuples, and vacuum stats.
- Schema Versioning: Keeps a historical audit trail of changes applied to your tables, columns, and indexes.
- Session & Lock Tracking: See exactly what is hanging or taking too long with real-time session and lock capture.
- FastAPI Backend: A sleek, fully typed, asynchronous API to query metrics and register new targets.
- Modern Web UI: A beautiful frontend visualizing the raw time-series data and mapping out your database schema evolution.
- Built on TimescaleDB: Leverages TimescaleDB hypertables for highly efficient time-series metric storage and fast analytics queries.
PGWarden uses Docker and Docker Compose to make deployment seamless.
- Docker
- Docker Compose
-
Clone the repository
git clone https://github.com/pedrohgoncalvess/pgwarden.git cd pgwarden -
Set up the Environment Variables Create a
.envfile referencing the provided.env.example:cp .env.example .env
Make sure you define a strong
ENCRYPTION_KEY. This key will be used by the API and the Collector to securely encrypt and decrypt the credentials of your monitored remote servers! -
Start the Application Run the full stack (TimescaleDB, Backend API, Collector, Migrations, and WebUI) using Docker Compose:
docker compose up -d --build
-
Access the Dashboards
- Web UI: Open your browser and navigate to
http://localhost:3000(or the port defined in your setup) to access the main PGWarden observation dashboard. - API Documentation: You can explore the REST API via the built-in Swagger UI at
http://localhost:8080/docs.
- Web UI: Open your browser and navigate to
PGWarden is composed of several independent but heavily integrated services:
- Database (TimescaleDB/PostgreSQL): Stores both the application state (registered servers, auth, configuration) and the collected time-series metrics.
- Collector: A continuous, asynchronous python worker that spans out to all registered target databases, polls their states based on a configurable interval, and pushes the data back to the central database.
- Migrations Service: Automatically manages the central schema structure upon startup.
- REST API: A FastAPI service handling authentication, target registration, config loading, and data serving for the frontend.
- Web UI: The main dashboard enabling interaction with the collected metrics and schema history.
We welcome contributions! Please feel free to submit a Pull Request, report Bugs, or suggest new Features.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open-source and available under the standard MIT License.