关于 cloud-monitoring-alert-configuration
用于通过 Terraform 和 PromQL 配置 Cloud Monitoring 告警的技能,面向管理 Google Cloud 工作负载可观测性的团队。它按资源类型路由到专门参考资料,并涵盖告警标签、验证要求及 SLO 转交规则。
主要功能
- 01按资源类型选择告警参考
- 02使用 PromQL 配置指标条件
- 03覆盖延迟、流量、错误和饱和度
- 04生成带归属标签的 Terraform 配置
- 05按规则委托 SLO 与通知渠道
适用场景
- 01为 Cloud Run 服务配置告警
- 02为 GKE 工作负载监控黄金信号
- 03为 AI Agent 配置可靠性与安全告警
- 04为计算资源生成参数化 Terraform 策略
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ google/ skills --skill cloud-monitoring-alert-configuration安装后在 Claude Code 中输入/cloud-monitoring-alert-configuration确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/agent_platform_cost_alert_policies.mdagent_platform_has_historical_traffic_data.mdagent_platform_no_historical_traffic_data.mdagent_platform_quality_alert_policies.mdagent_platform_reliability_alert_policies.mdagent_platform_safety_alert_policies.mdagent_platform_security_alert_policies.mdagent_platform_telemetry_enablement.mdattribution.mdcloud_run_jobs.mdcloud_run_services.mdcloud_run_worker_pools.mdcompute_engine_alerts.mdgeneric_alert_policies.mdkubernetes_gke_configuration_prerequisites.mdkubernetes_metrics_and_alerts_catalog.mdkubernetes_promql_queries.mdscripts/agent_platform/analyze_traffic_test.pyanalyze_traffic.pycheck_telemetry_test.pycheck_telemetry.pyconfig_utils_test.pyconfig_utils.pycreate_online_monitor_test.pycreate_online_monitor.pygather_agent_info_test.pygather_agent_info.pylint_syntax.pylist_log_scope_table_names_test.pylist_log_scope_table_names.pyREADME 原文English
来自项目 READMEREADME 暂无中文译文,以下为英文原文;中文介绍见上方。
Configure Cloud Monitoring Alerts
Configure high-signal alerting policies in Cloud Monitoring using
Terraform (google_monitoring_alert_policy) and PromQL
(condition_prometheus_query_language).
Usage Attribution
For all gcloud CLI, REST API, and MCP attribution requirements when executing
commands with this skill, follow the instructions in
Usage Attribution.
Enforce Core Alerting Rules
- Apply the Four Golden Signals: Cover latency, traffic, errors, and saturation for the target workload.
- Use Dynamic Grouping: Aggregate metrics by resource labels and parameterize thresholds with Terraform variables. Never hardcode ephemeral pod or instance identifiers.
- Default to PromQL: Use Prometheus Query Language (PromQL) for metric
conditions, and use log-based alerts
(
condition_matched_logorgoogle_logging_metric) for lifecycle and audit events. - Attach Skill Attribution Labels: Always include
user_labelswithcreated-with-google-skill = "cloud-monitoring-alert-configuration"on every generatedgoogle_monitoring_alert_policyresource. - Require User Confirmation Before Mutating Resources: Never execute commands that modify infrastructure, enable telemetry, create online monitors, or apply Terraform without waiting for explicit user confirmation.
- Prompt for Notification Channels: Alerting policies without notification channels incur charges without notifying anyone during an incident. Whenever notification channels are not specified in the user prompt across any workflow, explicitly inform the user that no notification channels are attached to the alerting policies, advise them to configure and attach notification channels before deploying, and ask at the end of your response if they want to configure notification channels.
Route by Target Resource Type
Identify the target resource type and read only the matching reference file
directly. Never run directory listings or workspace file searches to look for
queries or .tf files unless the prompt
explicitly provides a file path. If a user asks to fix or validate a PromQL
query without providing the query text or a file path, construct a
representative broken-and-corrected query example directly.
Configure Cloud Run Alerts
- HTTP Services: cloud_run_services.md
- Batch Jobs: cloud_run_jobs.md
- Worker Pools: cloud_run_worker_pools.md
Configure Google Kubernetes Engine Alerts
- PromQL Queries and Golden Signals: GKE PromQL Queries
- Metrics Catalog and Open-Source Alerts: GKE Metrics
- Prerequisites and Setup: GKE Setup
Configure AI Agent Alerts
- Reliability: Reliability
- Quality: Quality
- Cost: Cost
- Safety: Safety
- Security: Security
- Telemetry Enablement: Telemetry
- Traffic Profiles: Historical and No History
Configure Compute Engine and AI Hypercomputer Alerts
- Compute Engine VMs, MIGs, GPU XID Insights, Host or Reservation
Maintenance (
type=scheduled,unscheduled, ormultiple), and Machine or Domain Health: compute_engine_alerts.md
Configure Generic Resource Alerts
- Generic Workloads, Custom Metrics, MQL Migration, and HCL Deduplication: generic_alert_policies.md
Delegate Service Level Objective Alerts
Delegate to the google-cloud-slo-alert-configuration skill. That skill
owns the SLO setup wizard, the burn-rate PromQL templates
(references/promql_templates.md), the SLI metric mapping
(references/service_metrics.md), and the App Hub scoping labels
(references/app_hub_labels.md). Do NOT duplicate those templates here or
claim that this skill owns its own SLO PromQL template library.
Delegate whenever the user asks for an availability or latency SLO, an error budget or burn-rate alert, or a Service Level Objective on any resource. When SLOs are only one part of a broader request (for example, a full production alerting suite for a Cloud Run service), delegate the SLO policies and continue generating the remaining golden-signal policies from the resource-specific reference in the same response.
Every resource reference carries a Context to hand off list naming the SLI
metric, its good or bad filter, and the grouping labels — under a ## Delegate Service Level Objective Alerts heading for Cloud Run and generic resources, and
inside the SLO section itself for GKE and Agent Platform. Read it and pass that
context on, so the SLO skill does not repeat discovery you have already done.
When delegating, you MUST also:
- State the SLO target and window explicitly if the user gave them, or let the SLO skill apply its SRE defaults (99.9% over a rolling 28 days) if they did not.
- Require the returned policies to carry
user_labelswithcreated-with-google-skill = "cloud-monitoring-alert-configuration"so attribution stays consistent with the rest of the generated suite. This literal value does NOT change when you delegate: the label records the entry-point skill, not whichever skill supplied the template. Do NOT setcreated-with-google-skill = "google-cloud-slo-alert-configuration"on policies generated through this delegation. - Preserve the burn-rate duration contract, which
google-cloud-slo-alert-configurationdoes not specify: Fast Burn (1hand5mwindows, factor14.4) carriesduration = "300s", and Slow Burn ([3d]and[6h]lookback, factor1.0) omits thedurationfield entirely — do not emitduration = "0s"in its place. Cloud Monitoring rejects a non-zero retest buffer when the lookback window exceeds 25 hours. - When no notification channels are provided, inform the user that no notification channels are attached to the alerting policies, advise them to configure and attach notification channels, and ask if they want to configure notification channels.
重要
Always tell the user about the referral, even on the fallback path. Some reference files in this skill include standalone burn-rate templates to use when the
google-cloud-slo-alert-configurationskill is not installed. If you emit policies from those fallback templates, your response MUST still tell the user thatgoogle-cloud-slo-alert-configurationowns SLO configuration, state that the emitted policies use the local fallback templates, and list the handoff context. Never silently present SLO policies as if this skill owned them.
说明
Exception: Agent Platform (OpenTelemetry-instrumented AI agents on any runtime, including Vertex AI Agent Engine and Cloud Run) is the one resource whose Fast and Slow burn policies live in this skill and remain authoritative. Delegate only for SLO customization — see Reliability.
Delegate Related Observability Tasks
- Notification Channels: Delegate to
cloud-monitoring-notification-channels-configurationto configure email, PagerDuty, Pub/Sub, or Slack channels. When an alerting policy has no notification channels attached, inform the user that no notification channels are attached and that they should configure notification channels and attach them to the alerting policy. - PromQL Authoring: Delegate to
cloud-monitoring-promql-queryfor standalone PromQL query authoring or metric exploration.
Follow the Alert Configuration Workflow
- Discover: Identify target resources, metric schemas, and scoping projects using the lookup commands in the matching reference file (such as discover_metric_schema.py for Compute Engine metrics and other Google Cloud resource metrics, or gather_agent_info.py, check_telemetry.py, analyze_traffic.py, create_online_monitor.py, list_trace_scope_table_names.py, and list_log_scope_table_names.py for AI agents).
- Route: Load the reference file for the target resource type or delegate
SLOs to
google-cloud-slo-alert-configuration. - Generate: Produce parameterized Terraform HCL configurations with
required
user_labels. - Validate: When the loaded reference file requires a validation script
(such as lint_promql.py,
validate_config.py,
lint_syntax.py, or
scan_duplicates.py), run or
print that exact script command. Do not list or search the
scripts/directory. - Explain and Prompt: Explain each alert policy in plain English. When no notification channels are provided, tell the user that no notification channels are attached to the alerting policy, advise them to configure and attach notification channels, and ask if they want to configure notification channels.