cloud-monitoring-alert-configuration
Configures Cloud Monitoring alerting policies using Terraform and PromQL across Cloud Run, Google Kubernetes Engine (GKE), Compute Engine, AI Hypercomputer reservations, Vertex AI Agent Engine, and generic Google Cloud resources. Use when creating, reviewing, migrating, or deduplicating Terraform alerting policies for latency, traffic, error rates, saturation, host or reservation maintenance, GPU XID insights, or AI agent telemetry. Don't use for standalone PromQL query authoring without alerting, log querying, or billing cost audits.
- License 许可
- Apache-2.0
- 所属仓库
- google/skills
- 最近更新
- 2026-11-11
- Stars
- ★ 2.4w
- Forks
- 2.0k
01 前言 Front Matter
- name
- cloud-monitoring-alert-configuration
- metadata
- { "tags": [ "cloud-monitoring", "alerting", "terraform", "promql", "observability" ], "comment": "Consolidated from Cloud Monitoring alerting policy best practices across Cloud Run, Google Kubernetes Engine, Compute Engine, and Vertex AI Agent Engine.", "version": "1.0.2", "category": "CloudObservabilityAndMonitoring", "support_tier": "team", "canonical_source": "https://docs.cloud.google.com/monitoring/alerts.md.txt" }
- description
- Configures Cloud Monitoring alerting policies using Terraform and PromQL across Cloud Run, Google Kubernetes Engine (GKE), Compute Engine, AI Hypercomputer reservations, Vertex AI Agent Engine, and generic Google Cloud resources. Use when creating, reviewing, migrating, or deduplicating Terraform alerting policies for latency, traffic, error rates, saturation, host or reservation maintenance, GPU XID insights, or AI agent telemetry. Don't use for standalone PromQL query authoring without alerting, log querying, or billing cost audits.
02 资源文件 40
- 参考文档references/agent_platform_cost_alert_policies.md9.7 KB
- 参考文档references/agent_platform_has_historical_traffic_data.md5.8 KB
- 参考文档references/agent_platform_no_historical_traffic_data.md4.1 KB
- 参考文档references/agent_platform_quality_alert_policies.md12.8 KB
- 参考文档references/agent_platform_reliability_alert_policies.md28.5 KB
- 参考文档references/agent_platform_safety_alert_policies.md7.0 KB
- 参考文档references/agent_platform_security_alert_policies.md6.8 KB
- 参考文档references/agent_platform_telemetry_enablement.md2.6 KB
- 参考文档references/attribution.md1.8 KB
- 参考文档references/cloud_run_jobs.md5.3 KB
- 参考文档references/cloud_run_services.md37.8 KB
- 参考文档references/cloud_run_worker_pools.md13.7 KB
- 参考文档references/compute_engine_alerts.md40.5 KB
- 参考文档references/generic_alert_policies.md18.9 KB
- 参考文档references/kubernetes_gke_configuration_prerequisites.md13.3 KB
- 参考文档references/kubernetes_metrics_and_alerts_catalog.md22.0 KB
- 参考文档references/kubernetes_promql_queries.md18.2 KB
- 脚本scripts/agent_platform/analyze_traffic_test.py7.8 KB
- 脚本scripts/agent_platform/analyze_traffic.py12.8 KB
- 脚本scripts/agent_platform/check_telemetry_test.py5.4 KB
- 脚本scripts/agent_platform/check_telemetry.py5.8 KB
- 脚本scripts/agent_platform/config_utils_test.py10.2 KB
- 脚本scripts/agent_platform/config_utils.py9.4 KB
- 脚本scripts/agent_platform/create_online_monitor_test.py5.7 KB
- 脚本scripts/agent_platform/create_online_monitor.py5.8 KB
- 脚本scripts/agent_platform/gather_agent_info_test.py11.0 KB
- 脚本scripts/agent_platform/gather_agent_info.py14.8 KB
- 脚本scripts/agent_platform/lint_syntax.py1.9 KB
- 脚本scripts/agent_platform/list_log_scope_table_names_test.py8.6 KB
- 脚本scripts/agent_platform/list_log_scope_table_names.py4.7 KB
- 脚本scripts/agent_platform/list_trace_scope_table_names_test.py6.4 KB
- 脚本scripts/agent_platform/list_trace_scope_table_names.py4.3 KB
- 脚本scripts/agent_platform/mock_traffic_data.py100.4 KB
- 脚本scripts/agent_platform/requirements.txt102 B
- 脚本scripts/agent_platform/scan_duplicates_test.py3.9 KB
- 脚本scripts/agent_platform/scan_duplicates.py3.7 KB
- 脚本scripts/discover_metric_schema_test.py10.4 KB
- 脚本scripts/discover_metric_schema.py13.1 KB
- 脚本scripts/kubernetes/validate_config.py9.2 KB
- 脚本scripts/lint_promql.py2.5 KB
03 SKILL.md 正文
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.
[!IMPORTANT] 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.
[!NOTE] 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.
04 同仓库更多 Skills
sign-in-with-google-web
Implement, configure, and secure Sign In With Google (SiwG) using Google Identity Services (GIS / `https://accounts.google.com/gsi/client`) across web architectures. Use when creating Google sign-in buttons, implementing Google One Tap with FedCM, integrating GIS in React/Next.js/Angular/HTML, verifying ID tokens on backend runtimes (Python/Node.js/Go/Java), enforcing Google Workspace domain restrictions (`hd`), securing client-side ID tokens via WebCrypto nonces or encrypted IndexedDB, embedding in cross-origin iframes via the Intermediate Iframe API (`https://accounts.google.com/gsi/intermediate`), configuring Content Security Policy (CSP), COOP, and Permissions Policy (`identity-credentials-get`) headers, or handling sign-out and revocation. Don't use for legacy Google Sign-In (`gapi.auth2`), Google Cloud IAM service accounts, or Android/iOS native Credential Manager.
dpop-adoption
Implement and debug OAuth 2.0 DPoP (RFC 9449) refresh token sender-constraining for WebCrypto, Node.js ES6, and browser runtimes integrating with Google's OAuth platform. Use when configuring non-extractable asymmetric key pairs (P-256), generating DPoP Proof JWTs for authorization code exchange and token refresh, or handling 400 use_dpop_nonce challenge retry loops at oauth2.googleapis.com/token. Don't use for unconstrained OAuth 2.0 flows (where refresh tokens are not bound to a client key pair), or for Google Cloud IAM / service account authentication.
retrieving-developer-knowledge
Searches, retrieves, and synthesizes official Google developer documentation across Google Cloud, AI/Gemini, Android, Chrome, Web, Flutter, Go, Firebase, and other Google developer platforms. Integrates with the Developer Knowledge MCP server (search_documents, get_documents, answer_query) or the Developer Knowledge REST API fallback. Use when searching for gcloud CLI commands, API syntax, IAM permissions, official documentation, architectural comparisons, or product choice overviews. Don't use for local filesystem lookups or non-Google documentation.
migrate-to-rust
Clones, analyzes, plans, and migrates legacy codebases (C++, Fortran, Java, Python, C, Shell) from a GitHub URL or local directory to a modern, high-performance, deterministic, 100% Safe Rust architecture, tracking live telemetry across every task bucket, test failure/fix cycle, and Profile-Guided Optimization (PGO) stage, and producing a first-person AI storytelling report and interactive HTML infographic. Use when migrating a GitHub repository or local codebase to Rust, porting legacy C++, Fortran, Python, or Java workloads to memory-safe Rust, designing Struct-of-Arrays (SoA) or SIMD Rust architectures, or optimizing Rust ports with LLVM PGO. Don't use for unrelated non-Rust refactoring or single-line syntax questions.
finding-google-skills
Google platform decision and setup guidance, loaded on demand from Google's skill catalog. Use when a developer is choosing or setting up part of their stack, such as where to run a service, a database, storage, messaging, authentication, analytics, ads, or AI model serving, and a Google product is a reasonable candidate - whether or not a vendor is named - or when a request names a Google product or API. Brings in the matching Google skill so the answer can weigh Google options, their trade-offs, and when they are not the right fit. Skip when the stack is already settled on another provider and no Google product is named, or the task involves no platform choice.
workload-manager-basics
Use this skill to manage Google Cloud Workload Manager evaluations, rules, scanned resources, and validation results by using public client libraries and the REST API. Use when you need to inspect workload best-practice rules, create and run evaluations for Google Cloud general best practices, SAP, SQL Server, or custom organizational rules, review violations, export results to BigQuery, or automate Workload Manager through client libraries because no service-specific public CLI or MCP server is available. Don't use for general Google Compute Engine instance management, VPC configuration, or standard IAM auditing.