🌐 AI搜索 & 代理 主页
Skip to content

Commit 866d6a7

Browse files
committed
Add checkTitle field to all report JSONs
1 parent 02b7511 commit 866d6a7

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,52 @@ Get a complete monitoring setup with demo data in under 2 minutes.
202202
./postgres_ai health
203203
```
204204

205+
## 📋 Checkup reports
206+
207+
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:
208+
209+
### A. General / Infrastructural
210+
| Check ID | Title |
211+
|----------|-------|
212+
| A001 | System information |
213+
| A002 | Version information |
214+
| A003 | Postgres settings |
215+
| A004 | Cluster information |
216+
| A005 | Extensions |
217+
| A006 | Postgres setting deviations |
218+
| A007 | Altered settings |
219+
| A008 | Disk usage and file system type |
220+
221+
### D. Monitoring / Troubleshooting
222+
| Check ID | Title |
223+
|----------|-------|
224+
| D004 | pg_stat_statements and pg_stat_kcache settings |
225+
226+
### F. Autovacuum, Bloat
227+
| Check ID | Title |
228+
|----------|-------|
229+
| F001 | Autovacuum: current settings |
230+
| F004 | Autovacuum: heap bloat (estimated) |
231+
| F005 | Autovacuum: index bloat (estimated) |
232+
233+
### G. Performance / Connections / Memory-related settings
234+
| Check ID | Title |
235+
|----------|-------|
236+
| G001 | Memory-related settings |
237+
238+
### H. Index analysis
239+
| Check ID | Title |
240+
|----------|-------|
241+
| H001 | Invalid indexes |
242+
| H002 | Unused indexes |
243+
| H004 | Redundant indexes |
244+
245+
### K. SQL query analysis
246+
| Check ID | Title |
247+
|----------|-------|
248+
| K001 | Globally aggregated query metrics |
249+
| K003 | Top-50 queries by total_time |
250+
205251
## 🌐 Access points
206252

207253
After running quickstart:

reporter/postgres_reports.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,13 +1594,89 @@ def format_report_data(self, check_id: str, data: Dict[str, Any], host: str = "t
15941594

15951595
template_data = {
15961596
"checkId": check_id,
1597+
"checkTitle": self.get_check_title(check_id),
15971598
"timestamptz": now.isoformat(),
15981599
"nodes": hosts,
15991600
"results": results
16001601
}
16011602

16021603
return template_data
16031604

1605+
def get_check_title(self, check_id: str) -> str:
1606+
"""
1607+
Get the human-readable title for a check ID.
1608+
1609+
Args:
1610+
check_id: The check identifier (e.g., "H004")
1611+
1612+
Returns:
1613+
Human-readable title for the check
1614+
"""
1615+
# Mapping based on postgres-checkup README
1616+
# https://gitlab.com/postgres-ai/postgres-checkup
1617+
check_titles = {
1618+
"A001": "System information",
1619+
"A002": "Postgres major version",
1620+
"A003": "Postgres settings",
1621+
"A004": "Cluster information",
1622+
"A005": "Extensions",
1623+
"A006": "Postgres setting deviations",
1624+
"A007": "Altered settings",
1625+
"A008": "Disk usage and file system type",
1626+
"A010": "Data checksums, wal_log_hints",
1627+
"A011": "Connection pooling. pgbouncer",
1628+
"A012": "Anti-crash checks",
1629+
"A013": "Postgres minor version",
1630+
"B001": "SLO/SLA, RPO, RTO",
1631+
"B002": "File system, mount flags",
1632+
"B003": "Full backups / incremental",
1633+
"B004": "WAL archiving",
1634+
"B005": "Restore checks, monitoring, alerting",
1635+
"C001": "SLO/SLA",
1636+
"C002": "Sync/async, Streaming / wal transfer; logical decoding",
1637+
"C003": "SPOFs; standby with traffic",
1638+
"C004": "Failover",
1639+
"C005": "Switchover",
1640+
"C006": "Delayed replica",
1641+
"C007": "Replication slots. Lags. Standby feedbacks",
1642+
"D001": "Logging settings",
1643+
"D002": "Useful Linux tools",
1644+
"D003": "List of monitoring metrics",
1645+
"D004": "pg_stat_statements and pg_stat_kcache settings",
1646+
"D005": "track_io_timing, auto_explain",
1647+
"D006": "Recommended DBA toolsets",
1648+
"D007": "Postgres-specific tools for troubleshooting",
1649+
"E001": "WAL/checkpoint settings, IO",
1650+
"E002": "Checkpoints, bgwriter, IO",
1651+
"F001": "Autovacuum: current settings",
1652+
"F002": "Autovacuum: transaction ID wraparound check",
1653+
"F003": "Autovacuum: dead tuples",
1654+
"F004": "Autovacuum: heap bloat (estimated)",
1655+
"F005": "Autovacuum: index bloat (estimated)",
1656+
"F006": "Precise heap bloat analysis",
1657+
"F007": "Precise index bloat analysis",
1658+
"F008": "Autovacuum: resource usage",
1659+
"G001": "Memory-related settings",
1660+
"G002": "Connections and current activity",
1661+
"G003": "Timeouts, locks, deadlocks",
1662+
"G004": "Query planner",
1663+
"G005": "I/O settings",
1664+
"G006": "Default_statistics_target",
1665+
"H001": "Invalid indexes",
1666+
"H002": "Unused indexes",
1667+
"H003": "Non-indexed foreign keys",
1668+
"H004": "Redundant indexes",
1669+
"J001": "Capacity planning",
1670+
"K001": "Globally aggregated query metrics",
1671+
"K002": "Workload type",
1672+
"K003": "Top-50 queries by total_time",
1673+
"L001": "Table sizes",
1674+
"L002": "Data types being used",
1675+
"L003": "Integer out-of-range risks in PKs",
1676+
"L004": "Tables without PK/UK",
1677+
}
1678+
return check_titles.get(check_id, f"Check {check_id}")
1679+
16041680
def get_setting_unit(self, setting_name: str) -> str:
16051681
"""Get the unit for a PostgreSQL setting."""
16061682
units = {

0 commit comments

Comments
 (0)