| name | cost-monitor |
| description | Cloud service cost monitoring expert. Sets up alerts, analyzes trends, and predicts future costs. Trigger when user mentions cost monitoring, usage alerts, or cost forecasting. |
| when_to_use | - User needs to set up cost alerts
- User wants to analyze cost trends
- User needs to predict future expenses
- User wants to monitor usage patterns
- User needs to detect cost anomalies
|
| allowed-tools | Bash(curl *, jq *) |
Cloud Cost Monitoring Expert
Monitoring Components
| Component | Purpose | Frequency |
|---|
| Usage Metrics | Track current usage | Real-time |
| Alerts | Early warning | On threshold |
| Trends | Pattern analysis | Daily/Weekly |
| Forecasting | Cost prediction | Monthly |
Audit Workflow
Step 1: Set Up Alerts
Configure threshold-based notifications for each service.
See cases/alert-setup.md for implementation.
Step 2: Collect Historical Data
Store usage metrics over time for analysis.
Step 3: Analyze Trends
Identify patterns and growth rates.
See cases/trend-analysis.md for detailed analysis.
Step 4: Generate Forecasts
Predict future costs based on historical data.
Matching Cases
| Task | Case File | Output |
|---|
| Alert setup | cases/alert-setup.md | Notification config |
| Trend analysis | cases/trend-analysis.md | Growth patterns |
| Anomaly detection | cases/trend-analysis.md | Spike alerts |
Service-Specific Monitoring
Supabase
SELECT pg_database_size(current_database());
SELECT count(*) FROM pg_stat_activity;
SELECT query, calls, total_exec_time
FROM pg_stat_statements
ORDER BY total_exec_time DESC LIMIT 10;
Cloudflare
wrangler analytics
wrangler d1 info <database>
Redis
redis-cli INFO memory
redis-cli DBSIZE
Output Format
## Cost Monitoring Report
### 1. Current Usage
| Service | Metric | Value | Threshold | Status |
|---------|--------|-------|-----------|--------|
| Supabase | DB Size | X MB | 400 MB | OK |
| Workers | Requests | X K | 80 K | Warning |
### 2. Trend Analysis (30 days)
| Service | Metric | Daily Growth | Projected (30d) |
|---------|--------|--------------|-----------------|
| Supabase | DB Size | X MB/day | X MB |
### 3. Alerts Configured
- [Service] [Metric]: [Threshold] → [Channel]
### 4. Recommendations
1. [Action] → Expected impact