Skip to content

Commit cd2f21b

Browse files
committed
Added a general monitoring playbook
1 parent 6c83571 commit cd2f21b

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

apps/dbagent/src/lib/tools/playbooks.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,53 @@ the reason for which is slow, and the DDL to create the index if you found one.
3030
from the index.
3131
`;
3232

33+
const GENERAL_MONITORING_PLAYBOOK = `
34+
Objective:
35+
To assess and ensure the optimal performance of the PostgreSQL database by reviewing key metrics, logs, and slow queries.
36+
37+
Step 1:
38+
Check CPU Utilization:
39+
40+
Retrieve and analyze the CPU utilization metrics.
41+
Ensure CPU usage is within acceptable limits (e.g., below 60%).
42+
43+
Step 2:
44+
Review Other Key Metrics:
45+
46+
Freeable Memory: Ensure sufficient memory is available (e.g., above 20 GB).
47+
Database Connections: Monitor for spikes; ensure connections are within expected limits.
48+
Read/Write IOPS: Check for any unusual spikes or bottlenecks.
49+
Disk Queue Depth: Ensure it remains at 0 to avoid I/O bottlenecks.
50+
51+
Step 3:
52+
Analyze Logs:
53+
54+
Retrieve recent logs and look for warnings or errors.
55+
56+
Step 4:
57+
Evaluate Slow Queries:
58+
59+
Retrieve and review slow queries.
60+
Identify known queries and ensure they are optimized or deemed acceptable.
61+
62+
Step 5:
63+
Document Findings:
64+
65+
Record any issues found and actions taken.
66+
Note any recurring patterns or areas for improvement.
67+
`;
68+
3369
export function getPlaybook(name: string): string {
3470
switch (name) {
3571
case 'investigateSlowQueries':
3672
return SLOW_QUERIES_PLAYBOOK;
73+
case 'generalMonitoring':
74+
return GENERAL_MONITORING_PLAYBOOK;
3775
default:
3876
return `Error:Playbook ${name} not found`;
3977
}
4078
}
4179

4280
export function listPlaybooks(): string[] {
43-
return ['investigateSlowQueries'];
81+
return ['investigateSlowQueries', 'generalMonitoring'];
4482
}

0 commit comments

Comments
 (0)