Skip to content
gcp-alerts logo

GCP Alerting Policies

gcp-alerts

GCP 알림 정책 설정 (비용/에러/성능)

SKILL.md

Full skill instructions

GCP Alerting Policies

Cloud Monitoring 알림 정책을 설정하고 관리합니다.

사용법

/​gcp-alerts                        # 알림 정책 목록
/​gcp-alerts create budget          # 예산 알림 생성
/​gcp-alerts create vm-cpu          # VM CPU 알림 생성
/​gcp-alerts create error-rate      # 에러율 알림 생성

Workflow

0. API 활성화 (최초 1회)

gcloud services enable monitoring.googleapis.com --project=$PROJECT_ID

1. 알림 정책 목록

PROJECT_ID=$(gcloud config get-value project)
gcloud alpha monitoring policies list --project=$PROJECT_ID \
  --format="table(displayName,enabled,conditions[0].displayName)"

2. 알림 채널 설정 (이메일)

# 이메일 채널 생성
cat > /​tmp/​email-channel.json << 'EOF'
{
  "type": "email",
  "displayName": "Admin Email",
  "labels": {
    "email_address": "[email protected]"
  }
}
EOF

gcloud alpha monitoring channels create \
  --channel-content-from-file=/​tmp/​email-channel.json \
  --project=$PROJECT_ID

3. VM CPU 알림 정책 생성

cat > /​tmp/​cpu-alert.json << 'EOF'
{
  "displayName": "High CPU Usage",
  "conditions": [{
    "displayName": "CPU > 80%",
    "conditionThreshold": {
      "filter": "resource.type = \"gce_instance\" AND metric.type = \"compute.googleapis.com/​instance/​cpu/​utilization\"",
      "comparison": "COMPARISON_GT",
      "thresholdValue": 0.8,
      "duration": "300s",
      "aggregations": [{
        "alignmentPeriod": "60s",
        "perSeriesAligner": "ALIGN_MEAN"
      }]
    }
  }],
  "combiner": "OR",
  "enabled": true,
  "notificationChannels": ["CHANNEL_ID"]
}
EOF

gcloud alpha monitoring policies create \
  --policy-from-file=/​tmp/​cpu-alert.json \
  --project=$PROJECT_ID

4. 예산 알림 설정

# 예산 API 활성화
gcloud services enable billingbudgets.googleapis.com

# 예산 생성 (월 $100, 80% 도달 시 알림)
gcloud billing budgets create \
  --billing-account=BILLING_ACCOUNT_ID \
  --display-name="Monthly Budget" \
  --budget-amount=100USD \
  --threshold-rules=threshold-percent=0.8,spend-basis=current-spend \
  --threshold-rules=threshold-percent=1.0,spend-basis=current-spend \
  --all-updates-rule-pubsub-topic=projects/​$PROJECT_ID/​topics/​budget-alerts

5. Cloud Run 에러율 알림

cat > /​tmp/​error-alert.json << 'EOF'
{
  "displayName": "Cloud Run Error Rate > 5%",
  "conditions": [{
    "displayName": "Error rate",
    "conditionThreshold": {
      "filter": "resource.type = \"cloud_run_revision\" AND metric.type = \"run.googleapis.com/​request_count\" AND metric.labels.response_code_class = \"5xx\"",
      "comparison": "COMPARISON_GT",
      "thresholdValue": 0.05,
      "duration": "60s",
      "aggregations": [{
        "alignmentPeriod": "60s",
        "perSeriesAligner": "ALIGN_RATE"
      }]
    }
  }],
  "combiner": "OR",
  "enabled": true
}
EOF

gcloud alpha monitoring policies create \
  --policy-from-file=/​tmp/​error-alert.json \
  --project=$PROJECT_ID

6. 정책 활성화/비활성화

# 비활성화
gcloud alpha monitoring policies update POLICY_ID \
  --no-enabled \
  --project=$PROJECT_ID

# 활성화
gcloud alpha monitoring policies update POLICY_ID \
  --enabled \
  --project=$PROJECT_ID

7. 정책 삭제

gcloud alpha monitoring policies delete POLICY_ID --project=$PROJECT_ID

자주 쓰는 알림 템플릿

VM 모니터링

알림메트릭임계값
높은 CPUcompute.googleapis.com/​instance/​cpu/​utilization> 80%
높은 메모리agent.googleapis.com/​memory/​percent_used> 90%
디스크 부족agent.googleapis.com/​disk/​percent_used> 85%
VM 다운Uptime Check 실패2회 연속

Cloud Run / Functions

알림메트릭임계값
에러율5xx / total> 5%
지연 시간request_latenciesp99 > 2s
인스턴스 급증instance_count> 50

비용

알림설정
일일 예산threshold 80%, 100%
이상 비용전일 대비 200% 초과

출력 형식

## 알림 정책 목록

| 정책 이름 | 상태 | 조건 |
|-----------|------|------|
| High CPU Usage | 활성 | CPU > 80% for 5분 |
| Error Rate Alert | 활성 | 5xx > 5% for 1분 |
| Monthly Budget | 활성 | $100의 80%, 100% |

---

### 알림 채널

| 채널 | 유형 | 대상 |
|------|------|------|
| Admin Email | email | [email protected] |
| Slack Webhook | webhook | #alerts |

알림 채널 유형

유형설정
Emailemail_address
SlackWebhook URL
PagerDutyIntegration Key
SMS전화번호
Pub/​SubTopic 이름

비용

  • 알림 정책: 무료
  • 알림 채널: 무료
  • Uptime Check: 무료 (1백만 회/월)

주의사항

  • 너무 민감한 임계값 설정 시 알림 폭주
  • 적절한 duration 설정으로 일시적 스파이크 필터링
  • 중요 알림은 여러 채널로 발송 권장

More Finance & Trading skills

ponytail-debt logo
Finance & Trading

ponytail-debt

Harvest every `ponytail:` comment in the codebase into a debt ledger, so the deliberate shortcuts and deferrals ponytail leaves behind get tracked instead of rotting into "later means never". One-shot report, changes nothing.

155.5K 27.9K
View
stripe-integration logo
Finance & Trading

stripe-integration

Stripe payment processing with checkout sessions, subscriptions, webhooks, and customer management.

40.2K 12.9K
View

Build comprehensive 3-5 year financial models with revenue projections, cost structures, cash flow analysis, and scenario planning for early-stage startups. Use this skill when creating financial projections, calculating burn rate or runway, modeling fundraising scenarios, or preparing investor-r...

40.2K 12K
View
stock-analysis logo
Finance & Trading

stock-analysis

Stock and cryptocurrency analysis with portfolio management and multi-dimensional scoring.

46 11.9K
View
coinglass logo
Finance & Trading

coinglass

Real-time crypto derivatives positioning, whale tracking, liquidations, and institutional ETF flows across 37 specialized tools.

27 11.5K
View

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.

40.2K 10.5K
View

Finance AI tools

C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Finalle.ai logo
Finance

Finalle.ai

Stay Ahead with Finalle.ai: The Ultimate Financial News and Tools Platform

Free
View

AI-powered Pine Script code generator for TradingView

Paid
View
TradeUI logo
Finance

TradeUI

Empower your investment strategies with AI signals, option flow data, and advanced chart patterns.

Paid
View
D
Finance

Danelfin

Danelfin review covering its AI stock and ETF scores, rankings, portfolio tools, current pricing, strengths, risks, and alternatives for investors.

Freemium
View
E
Finance

Ellisense

A software for comprehensive market sentiment analysis.

Paid
View

'Stock Correlations' App by Freshly.ai: Reveal Stock Patterns and Trends

Free
View