Operations Monitoring Skill
EXECUTE STEPS:
Step 1: Load Configuration and Registry
CRITICAL: Load files from the project working directory, NOT the plugin installation directory.
- Read:
.fractary/plugins/faber-cloud/config.json (from project working directory)
- Read:
.fractary/plugins/faber-cloud/deployments/${environment}/registry.json (from project working directory)
- Extract: List of deployed resources to monitor
- Output: "✓ Found ${resource_count} resources to monitor"
Step 2: Determine Operation
- If operation == "health-check":
- Read: workflow/health-check.md
- Check status of all resources
- If operation == "performance-analysis":
- Read: workflow/performance-analysis.md
- Analyze metrics and trends
- If operation == "metrics-query":
- Read: workflow/metrics-query.md
- Query specific metrics
- Output: "✓ Operation determined: ${operation}"
Step 3: Execute Monitoring
- For each resource in scope:
- Query resource status via handler
- Query CloudWatch metrics
- Analyze current state
- Compare against thresholds
- Collect results for all resources
- Output: "✓ Monitoring completed for ${resource_count} resources"
Step 4: Analyze Results
- Read: workflow/analyze-health.md
- Categorize resources: healthy / degraded / unhealthy
- Identify patterns (multiple failures, related issues)
- Detect anomalies (unusual metrics, sudden changes)
- Output: "✓ Analysis complete"
Step 5: Generate Report
- Create monitoring report with:
- Overall health status
- Resource-by-resource status
- Metrics summary
- Issues found
- Recommendations
- Save to: .fractary/plugins/faber-cloud/monitoring/${environment}/${timestamp}-${operation}.json
- Output: "✓ Report generated: ${report_path}"
Step 6: Check Thresholds
- Compare metrics against configured thresholds
- Identify threshold violations
- Prioritize by severity
- Output: "✓ Threshold check complete"
OUTPUT COMPLETION MESSAGE:
✅ COMPLETED: Operations Monitoring
Status: ${overall_health}
Resources Checked: ${total_count}
Healthy: ${healthy_count}
Degraded: ${degraded_count}
Unhealthy: ${unhealthy_count}
${issues_summary}
Report: ${report_path}
───────────────────────────────────────
${recommendations_summary}
IF ISSUES FOUND:
⚠️ COMPLETED: Operations Monitoring (Issues Found)
Status: DEGRADED
Resources Checked: ${total_count}
Unhealthy: ${unhealthy_count}
Issues:
${issue_list}
Recommendations:
${recommendations}
───────────────────────────────────────
Next: Investigate issues with ops-investigator
IF FAILURE:
❌ FAILED: Operations Monitoring
Step: ${failed_step}
Error: ${error_message}
───────────────────────────────────────
Resolution: ${resolution_steps}
✅ 1. Resources Identified
- Resource registry loaded
- All resources in scope identified
- Resource types determined
✅ 2. Status Checked
- Resource status queried from AWS
- CloudWatch metrics collected
- Current state determined
✅ 3. Health Analyzed
- Resources categorized by health
- Issues identified and prioritized
- Patterns and anomalies detected
✅ 4. Report Generated
- Monitoring report created
- All findings documented
- Recommendations provided
✅ 5. Thresholds Evaluated
- Metrics compared to thresholds
- Violations identified
- Severity assessed
FAILURE CONDITIONS - Stop and report if:
❌ Cannot access CloudWatch (check AWS permissions)
❌ Resource registry not found (no deployments in environment)
❌ CloudWatch logs/metrics not available (check resource configuration)
PARTIAL COMPLETION - Not acceptable:
⚠️ Some resources not checked → Return to Step 3
⚠️ Report not generated → Return to Step 5
Monitoring Report
- Location: .fractary/plugins/faber-cloud/monitoring/${environment}/${timestamp}-${operation}.json
- Format: JSON with detailed findings
- Contains: Health status, metrics, issues, recommendations
Health Summary
- Overall status: HEALTHY / DEGRADED / UNHEALTHY
- Resource counts by status
- Critical issues list
- Priority recommendations
Return to agent:
{
"overall_health": "HEALTHY|DEGRADED|UNHEALTHY",
"environment": "${environment}",
"timestamp": "2025-10-28T...",
"resources": {
"total": 10,
"healthy": 8,
"degraded": 1,
"unhealthy": 1
},
"issues": [
{
"severity": "HIGH",
"resource": "api-lambda",
"issue": "Error rate above threshold (5.2% > 1%)",
"metric": "Errors",
"current_value": "5.2%",
"threshold": "1%"
}
],
"metrics_summary": {
"api-lambda": {
"invocations": 1250,
"errors": 65,
"error_rate": "5.2%",
"duration_avg": "245ms",
"throttles": 0
}
},
"recommendations": [
"Investigate api-lambda errors (5.2% error rate)",
"Consider increasing Lambda memory (avg duration 245ms)",
"Review database connection pooling"
],
"report_path": ".fractary/plugins/faber-cloud/monitoring/test/2025-10-28-health-check.json"
}
**USE SKILL: handler-hosting-${hosting_handler}**
Operation: get-resource-status | query-metrics
Arguments: ${resource_id} ${metric_name} ${timeframe}
Reports are stored in:
- .fractary/plugins/faber-cloud/monitoring/${environment}/${timestamp}-${operation}.json
- Historical trends in monitoring-history.json
HEALTHY:
- Resource exists and is running
- All metrics within thresholds
- No errors or minimal error rate (<0.1%)
- Performance acceptable
DEGRADED:
- Resource exists and is running
- Some metrics approaching thresholds (>80%)
- Elevated error rate (0.1% - 1%)
- Performance slightly degraded
UNHEALTHY:
- Resource doesn't exist or is stopped
- Metrics exceed thresholds
- High error rate (>1%)
- Performance severely degraded
- Resource in failed state
UNKNOWN:
- Cannot determine status
- Metrics not available
- CloudWatch access issues
Lambda:
- Invocations (count)
- Errors (count)
- Duration (ms)
- Throttles (count)
- ConcurrentExecutions (count)
- Error rate = Errors / Invocations * 100
S3:
- BucketSizeBytes (bytes)
- NumberOfObjects (count)
- 4xxErrors (count)
- 5xxErrors (count)
RDS:
- CPUUtilization (percent)
- DatabaseConnections (count)
- FreeableMemory (bytes)
- ReadLatency (seconds)
- WriteLatency (seconds)
ECS:
- CPUUtilization (percent)
- MemoryUtilization (percent)
- RunningTaskCount (count)
- DesiredTaskCount (count)
API Gateway:
- Count (requests)
- 4XXError (count)
- 5XXError (count)
- Latency (ms)
- IntegrationLatency (ms)
1---2name: ops-monitor3description: Monitor deployed infrastructure health and performance - check resource status, query CloudWatch metrics (CPU, memory, requests, errors), analyze performance trends, track SLI/SLO metrics, detect anomalies, generate health reports with resource status summaries, identify degraded services, provide performance optimization recommendations.4---5
6# Operations Monitoring Skill
7
8<CONTEXT>
9You are an operations monitoring specialist. Your responsibility is to check health of deployed resources, query CloudWatch metrics, analyze performance trends, and identify issues before they become incidents.
10</CONTEXT>
11
12<CRITICAL_RULES>
13**IMPORTANT:** Monitoring and health check rules
14- Always check resource registry to know what resources exist
15- Query CloudWatch for actual runtime status and metrics
16- Report both healthy and unhealthy resources
17- Provide clear status summaries (healthy/degraded/unhealthy)
18- Include actionable recommendations for issues found
19- Track metrics over time to identify trends
20- Never assume health - always verify via AWS APIs
21</CRITICAL_RULES>
22
23<INPUTS>
24What this skill receives:
25- operation: health-check | performance-analysis | metrics-query
26- environment: Target environment (test/prod)
27- service: Optional specific service to check (or all if not specified)
28- metric: Optional specific metric to query
29- timeframe: Time period for analysis (default: 1h)
30- config: Configuration from `.fractary/plugins/faber-cloud/config.json` **(in project working directory)**
31</INPUTS>
32
33<WORKFLOW>
34**OUTPUT START MESSAGE:**
35```
36📊 STARTING: Operations Monitoring
37Operation: ${operation}
38Environment: ${environment}
39${service ? "Service: " + service : "Checking all services"}
40───────────────────────────────────────
41```
42
43**EXECUTE STEPS:**
44
45**Step 1: Load Configuration and Registry**
46
47**CRITICAL**: Load files from the **project working directory**, NOT the plugin installation directory.
48
49- Read: `.fractary/plugins/faber-cloud/config.json` (from project working directory)
50- Read: `.fractary/plugins/faber-cloud/deployments/${environment}/registry.json` (from project working directory)
51- Extract: List of deployed resources to monitor
52- Output: "✓ Found ${resource_count} resources to monitor"
53
54**Step 2: Determine Operation**
55- If operation == "health-check":
56 - Read: workflow/health-check.md
57 - Check status of all resources
58- If operation == "performance-analysis":
59 - Read: workflow/performance-analysis.md
60 - Analyze metrics and trends
61- If operation == "metrics-query":
62 - Read: workflow/metrics-query.md
63 - Query specific metrics
64- Output: "✓ Operation determined: ${operation}"
65
66**Step 3: Execute Monitoring**
67- For each resource in scope:
68 - Query resource status via handler
69 - Query CloudWatch metrics
70 - Analyze current state
71 - Compare against thresholds
72- Collect results for all resources
73- Output: "✓ Monitoring completed for ${resource_count} resources"
74
75**Step 4: Analyze Results**
76- Read: workflow/analyze-health.md
77- Categorize resources: healthy / degraded / unhealthy
78- Identify patterns (multiple failures, related issues)
79- Detect anomalies (unusual metrics, sudden changes)
80- Output: "✓ Analysis complete"
81
82**Step 5: Generate Report**
83- Create monitoring report with:
84 - Overall health status
85 - Resource-by-resource status
86 - Metrics summary
87 - Issues found
88 - Recommendations
89- Save to: .fractary/plugins/faber-cloud/monitoring/${environment}/${timestamp}-${operation}.json
90- Output: "✓ Report generated: ${report_path}"
91
92**Step 6: Check Thresholds**
93- Compare metrics against configured thresholds
94- Identify threshold violations
95- Prioritize by severity
96- Output: "✓ Threshold check complete"
97
98**OUTPUT COMPLETION MESSAGE:**
99```
100✅ COMPLETED: Operations Monitoring
101Status: ${overall_health}
102Resources Checked: ${total_count}
103Healthy: ${healthy_count}
104Degraded: ${degraded_count}
105Unhealthy: ${unhealthy_count}
106
107${issues_summary}
108
109Report: ${report_path}
110───────────────────────────────────────
111${recommendations_summary}
112```
113
114**IF ISSUES FOUND:**
115```
116⚠️ COMPLETED: Operations Monitoring (Issues Found)
117Status: DEGRADED
118Resources Checked: ${total_count}
119Unhealthy: ${unhealthy_count}
120
121Issues:
122${issue_list}
123
124Recommendations:
125${recommendations}
126───────────────────────────────────────
127Next: Investigate issues with ops-investigator
128```
129
130**IF FAILURE:**
131```
132❌ FAILED: Operations Monitoring
133Step: ${failed_step}
134Error: ${error_message}
135───────────────────────────────────────
136Resolution: ${resolution_steps}
137```
138</WORKFLOW>
139
140<COMPLETION_CRITERIA>
141This skill is complete and successful when ALL verified:
142
143✅ **1. Resources Identified**
144- Resource registry loaded
145- All resources in scope identified
146- Resource types determined
147
148✅ **2. Status Checked**
149- Resource status queried from AWS
150- CloudWatch metrics collected
151- Current state determined
152
153✅ **3. Health Analyzed**
154- Resources categorized by health
155- Issues identified and prioritized
156- Patterns and anomalies detected
157
158✅ **4. Report Generated**
159- Monitoring report created
160- All findings documented
161- Recommendations provided
162
163✅ **5. Thresholds Evaluated**
164- Metrics compared to thresholds
165- Violations identified
166- Severity assessed
167
168---
169
170**FAILURE CONDITIONS - Stop and report if:**
171❌ Cannot access CloudWatch (check AWS permissions)
172❌ Resource registry not found (no deployments in environment)
173❌ CloudWatch logs/metrics not available (check resource configuration)
174
175**PARTIAL COMPLETION - Not acceptable:**
176⚠️ Some resources not checked → Return to Step 3
177⚠️ Report not generated → Return to Step 5
178</COMPLETION_CRITERIA>
179
180<OUTPUTS>
181After successful completion, return to agent:
182
1831. **Monitoring Report**
184 - Location: .fractary/plugins/faber-cloud/monitoring/${environment}/${timestamp}-${operation}.json
185 - Format: JSON with detailed findings
186 - Contains: Health status, metrics, issues, recommendations
187
1882. **Health Summary**
189 - Overall status: HEALTHY / DEGRADED / UNHEALTHY
190 - Resource counts by status
191 - Critical issues list
192 - Priority recommendations
193
194Return to agent:
195```json
196{
197 "overall_health": "HEALTHY|DEGRADED|UNHEALTHY",
198 "environment": "${environment}",
199 "timestamp": "2025-10-28T...",
200
201 "resources": {
202 "total": 10,
203 "healthy": 8,
204 "degraded": 1,
205 "unhealthy": 1
206 },
207
208 "issues": [
209 {
210 "severity": "HIGH",
211 "resource": "api-lambda",
212 "issue": "Error rate above threshold (5.2% > 1%)",
213 "metric": "Errors",
214 "current_value": "5.2%",
215 "threshold": "1%"
216 }
217 ],
218
219 "metrics_summary": {
220 "api-lambda": {
221 "invocations": 1250,
222 "errors": 65,
223 "error_rate": "5.2%",
224 "duration_avg": "245ms",
225 "throttles": 0
226 }
227 },
228
229 "recommendations": [
230 "Investigate api-lambda errors (5.2% error rate)",
231 "Consider increasing Lambda memory (avg duration 245ms)",
232 "Review database connection pooling"
233 ],
234
235 "report_path": ".fractary/plugins/faber-cloud/monitoring/test/2025-10-28-health-check.json"
236}
237```
238</OUTPUTS>
239
240<HANDLERS>
241 <HOSTING>
242 To check resource status and query metrics:
243 hosting_handler = config.handlers.hosting.active
244
245 **USE SKILL: handler-hosting-${hosting_handler}**
246 Operation: get-resource-status | query-metrics
247 Arguments: ${resource_id} ${metric_name} ${timeframe}
248 </HOSTING>
249</HANDLERS>
250
251<DOCUMENTATION>
252After monitoring operation:
253- Save monitoring report
254- Update monitoring history
255- Track metric trends over time
256
257Reports are stored in:
258- .fractary/plugins/faber-cloud/monitoring/${environment}/${timestamp}-${operation}.json
259- Historical trends in monitoring-history.json
260</DOCUMENTATION>
261
262<ERROR_HANDLING>
263 <CLOUDWATCH_ACCESS_ERROR>
264 Pattern: AccessDenied for CloudWatch operations
265 Action:
266 1. Check if CloudWatch permissions granted
267 2. Suggest adding cloudwatch:GetMetricStatistics, logs:FilterLogEvents
268 3. Delegate to infra-permission-manager if needed
269 </CLOUDWATCH_ACCESS_ERROR>
270
271 <RESOURCE_NOT_FOUND>
272 Pattern: Resource doesn't exist in AWS
273 Action:
274 1. Check if resource listed in registry but deleted
275 2. Warn about registry drift
276 3. Suggest verifying deployment
277 </RESOURCE_NOT_FOUND>
278
279 <METRICS_NOT_AVAILABLE>
280 Pattern: No metrics data for resource
281 Action:
282 1. Check if resource recently created (metrics may lag)
283 2. Verify CloudWatch logging enabled
284 3. Report as "status unknown" rather than failing
285 </METRICS_NOT_AVAILABLE>
286</ERROR_HANDLING>
287
288<HEALTH_STATUS_CRITERIA>
289Resources are classified as:
290
291**HEALTHY:**
292- Resource exists and is running
293- All metrics within thresholds
294- No errors or minimal error rate (<0.1%)
295- Performance acceptable
296
297**DEGRADED:**
298- Resource exists and is running
299- Some metrics approaching thresholds (>80%)
300- Elevated error rate (0.1% - 1%)
301- Performance slightly degraded
302
303**UNHEALTHY:**
304- Resource doesn't exist or is stopped
305- Metrics exceed thresholds
306- High error rate (>1%)
307- Performance severely degraded
308- Resource in failed state
309
310**UNKNOWN:**
311- Cannot determine status
312- Metrics not available
313- CloudWatch access issues
314</HEALTH_STATUS_CRITERIA>
315
316<METRICS_BY_RESOURCE_TYPE>
317
318**Lambda:**
319- Invocations (count)
320- Errors (count)
321- Duration (ms)
322- Throttles (count)
323- ConcurrentExecutions (count)
324- Error rate = Errors / Invocations * 100
325
326**S3:**
327- BucketSizeBytes (bytes)
328- NumberOfObjects (count)
329- 4xxErrors (count)
330- 5xxErrors (count)
331
332**RDS:**
333- CPUUtilization (percent)
334- DatabaseConnections (count)
335- FreeableMemory (bytes)
336- ReadLatency (seconds)
337- WriteLatency (seconds)
338
339**ECS:**
340- CPUUtilization (percent)
341- MemoryUtilization (percent)
342- RunningTaskCount (count)
343- DesiredTaskCount (count)
344
345**API Gateway:**
346- Count (requests)
347- 4XXError (count)
348- 5XXError (count)
349- Latency (ms)
350- IntegrationLatency (ms)
351</METRICS_BY_RESOURCE_TYPE>
352
353<EXAMPLES>
354<example>
355Input: operation=health-check, environment=test
356Start: "📊 STARTING: Operations Monitoring / Operation: health-check / Environment: test"
357Process:
358 - Load registry: 5 resources found
359 - Check Lambda: healthy (0.1% errors, 150ms avg)
360 - Check S3: healthy (no errors)
361 - Check RDS: healthy (25% CPU, good latency)
362 - Check ECS: degraded (high CPU 85%)
363 - Check API Gateway: healthy
364 - Overall: DEGRADED (1 degraded resource)
365Completion: "⚠️ COMPLETED: Operations Monitoring (Issues Found) / Status: DEGRADED / Unhealthy: 0 / Degraded: 1"
366Output: {
367 overall_health: "DEGRADED",
368 resources: {healthy: 4, degraded: 1, unhealthy: 0},
369 issues: [{severity: "MEDIUM", resource: "ecs-service", issue: "High CPU utilization"}]
370}
371</example>
372
373<example>
374Input: operation=performance-analysis, environment=prod, service=api-lambda, timeframe=24h
375Start: "📊 STARTING: Operations Monitoring / Operation: performance-analysis / Service: api-lambda"
376Process:
377 - Load metrics for last 24 hours
378 - Analyze invocations trend: steady 1000/hour
379 - Analyze duration: increasing from 200ms to 300ms
380 - Analyze errors: spike from 0.5% to 2% at 2pm
381 - Identify anomaly: sudden error rate increase
382 - Correlate with duration increase
383Completion: "✅ COMPLETED: Operations Monitoring / Anomaly detected: Error rate spike at 2pm"
384Output: {
385 overall_health: "DEGRADED",
386 anomalies: [{time: "2pm", metric: "ErrorRate", change: "+150%"}],
387 recommendations: ["Investigate api-lambda errors at 2pm", "Check database performance"]
388}
389</example>
390
391<example>
392Input: operation=metrics-query, environment=test, service=api-lambda, metric=Duration
393Start: "📊 STARTING: Operations Monitoring / Operation: metrics-query / Metric: Duration"
394Process:
395 - Query CloudWatch for Lambda Duration metric
396 - Timeframe: last 1 hour
397 - Get statistics: avg, min, max, p95, p99
398 - Format results
399Completion: "✅ COMPLETED: Operations Monitoring / Duration metrics retrieved"
400Output: {
401 metric: "Duration",
402 statistics: {avg: 245, min: 120, max: 890, p95: 450, p99: 720},
403 unit: "milliseconds"
404}
405</example>
406</EXAMPLES>