You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To upgrade postgres_ai monitoring to a newer version:
263
+
264
+
### Step 1: Update the CLI
265
+
266
+
```bash
267
+
npm install -g postgresai@latest
268
+
```
269
+
270
+
Or if you're using npx:
271
+
```bash
272
+
npx postgresai@latest --version # verify the new version
273
+
```
274
+
275
+
### Step 2: Stop running services
276
+
277
+
```bash
278
+
postgresai mon stop
279
+
```
280
+
281
+
### Step 3: Pull new Docker images and restart
282
+
283
+
The simplest approach is to re-run local-install, which updates the image tag and pulls new images:
284
+
285
+
```bash
286
+
postgresai mon local-install -y
287
+
```
288
+
289
+
This will:
290
+
- Update the `PGAI_TAG` in `.env` (located in your monitoring directory, typically `~/.postgres_ai/` or your current working directory) to match the new CLI version
291
+
- Pull the latest Docker images
292
+
- Start the services with the new images
293
+
294
+
> **Note:** The `.env` file contains configuration for the monitoring stack, including `PGAI_TAG` (the Docker image version tag) and optionally `GF_SECURITY_ADMIN_PASSWORD` (Grafana admin password) and `PGAI_REGISTRY` (custom Docker registry).
295
+
296
+
**Alternative: Manual upgrade**
297
+
298
+
If you prefer more control:
299
+
300
+
```bash
301
+
# Update the PGAI_TAG in .env to match your CLI version
302
+
postgresai --version # check your CLI version
303
+
# Edit .env and set PGAI_TAG to the version number
304
+
305
+
# Pull new images
306
+
docker compose pull
307
+
308
+
# Start services
309
+
postgresai mon start
310
+
```
311
+
312
+
### Verify the upgrade
313
+
314
+
After upgrading, verify services are running correctly:
315
+
316
+
```bash
317
+
postgresai mon status
318
+
postgresai mon health
319
+
```
320
+
321
+
Check Grafana dashboards at http://localhost:3000 to confirm metrics are being collected.
322
+
323
+
## 📋 Checkup reports
324
+
325
+
postgres_ai monitoring generates automated health check reports based on [postgres-checkup](https://gitlab.com/postgres-ai/postgres-checkup). Each report has a unique check ID and title:
326
+
327
+
### A. General / Infrastructural
328
+
| Check ID | Title |
329
+
|----------|-------|
330
+
| A001 | System information |
331
+
| A002 | Version information |
332
+
| A003 | Postgres settings |
333
+
| A004 | Cluster information |
334
+
| A005 | Extensions |
335
+
| A006 | Postgres setting deviations |
336
+
| A007 | Altered settings |
337
+
| A008 | Disk usage and file system type |
338
+
339
+
### D. Monitoring / Troubleshooting
340
+
| Check ID | Title |
341
+
|----------|-------|
342
+
| D004 | pg_stat_statements and pg_stat_kcache settings |
343
+
344
+
### F. Autovacuum, Bloat
345
+
| Check ID | Title |
346
+
|----------|-------|
347
+
| F001 | Autovacuum: current settings |
348
+
| F004 | Autovacuum: heap bloat (estimated) |
349
+
| F005 | Autovacuum: index bloat (estimated) |
350
+
351
+
### G. Performance / Connections / Memory-related settings
352
+
| Check ID | Title |
353
+
|----------|-------|
354
+
| G001 | Memory-related settings |
355
+
356
+
### H. Index analysis
357
+
| Check ID | Title |
358
+
|----------|-------|
359
+
| H001 | Invalid indexes |
360
+
| H002 | Unused indexes |
361
+
| H004 | Redundant indexes |
362
+
363
+
### K. SQL query analysis
364
+
| Check ID | Title |
365
+
|----------|-------|
366
+
| K001 | Globally aggregated query metrics |
367
+
| K003 | Top queries by total time (total_exec_time + total_plan_time) |
368
+
| K004 | Top queries by temp bytes written |
369
+
| K005 | Top queries by WAL generation |
370
+
| K006 | Top queries by shared blocks read |
371
+
| K007 | Top queries by shared blocks hit |
372
+
373
+
### M. SQL query analysis (top queries)
374
+
| Check ID | Title |
375
+
|----------|-------|
376
+
| M001 | Top queries by mean execution time |
377
+
| M002 | Top queries by rows (I/O intensity) |
378
+
| M003 | Top queries by I/O time |
379
+
380
+
### N. Wait events analysis
381
+
| Check ID | Title |
382
+
|----------|-------|
383
+
| N001 | Wait events grouped by type and query |
384
+
385
+
## 🌐 Access points
386
+
387
+
After running local-install:
388
+
389
+
-**🚀 MAIN: Grafana Dashboard**: http://localhost:3000 (login: `monitoring`; password is shown at the end of local-install)
#### Unit Tests Only (Fast, No External Services Required)
428
+
429
+
Run only unit tests with mocked Prometheus interactions:
430
+
```bash
431
+
pytest tests/reporter
432
+
```
433
+
434
+
This automatically skips integration tests. Or run specific test files:
435
+
```bash
436
+
pytest tests/reporter/test_generators_unit.py -v
437
+
pytest tests/reporter/test_formatters.py -v
438
+
```
439
+
440
+
#### All Tests: Unit + Integration (Requires PostgreSQL)
441
+
442
+
Run the complete test suite (both unit and integration tests):
443
+
```bash
444
+
pytest tests/reporter --run-integration
445
+
```
446
+
447
+
Integration tests create a temporary PostgreSQL instance automatically and require PostgreSQL binaries (`initdb`, `postgres`) on your PATH. No manual database setup or environment variables are required - the tests create and destroy their own temporary PostgreSQL instances.
-`pytest tests/reporter --run-integration` → **Both unit and integration tests**
452
+
453
+
### Test Coverage
454
+
455
+
Generate coverage report:
456
+
```bash
457
+
pytest tests/reporter -m unit --cov=reporter --cov-report=html
458
+
```
459
+
460
+
View the coverage report by opening `htmlcov/index.html` in your browser.
461
+
462
+
## 🤝 Contributing
463
+
464
+
We welcome contributions from Postgres experts! Please check our [GitLab repository](https://gitlab.com/postgres-ai/postgres_ai) for:
465
+
- Code standards and review process
466
+
- Dashboard design principles
467
+
- Testing requirements for monitoring components
468
+
469
+
## 📄 License
470
+
471
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
472
+
473
+
## 🏢 About PostgresAI
474
+
475
+
postgres_ai monitoring is developed by [PostgresAI](https://postgres.ai), bringing years of Postgres expertise into automated monitoring and analysis tools. We provide enterprise consulting and advanced Postgres solutions for fast-growing companies.
0 commit comments