Cloud Monitoring Alert Configuration
GoogleOfficialPublished by Google
- Skill
- Workflow
- Cloud and DevOps
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured workflow for defining, reviewing, and managing Cloud Monitoring alerting policies. It leverages Terraform for infrastructure-as-code and PromQL for metric conditions, ensuring consistent observability across Google Cloud resources including Cloud Run, GKE, Compute Engine, and AI Agent platforms. The skill enforces best practices like the Four Golden Signals, dynamic grouping, and proper labeling, while providing clear paths for delegating SLO-specific configurations and notification channel management.
What it does
- Generates parameterized Terraform configurations for Cloud Monitoring alert policies.
- Implements PromQL-based conditions for high-signal monitoring.
- Provides resource-specific guidance for GKE, Cloud Run, Compute Engine, and AI agents.
- Enforces standardized labeling for all generated alerting resources.
- Integrates with specialized scripts to analyze traffic patterns for AI agent telemetry.
- Delegates SLO and notification channel configuration to dedicated skills.
When to use it
- When creating or migrating Terraform-based alerting policies for Google Cloud infrastructure.
- When setting up monitoring for AI agent reliability, quality, and cost telemetry.
- When deduplicating existing alert policies to improve signal-to-noise ratios.
- When configuring alerts for latency, traffic, error rates, or saturation across cloud services.
Advantages
- Ensures consistent observability standards across diverse cloud environments.
- Reduces manual configuration errors through structured Terraform templates.
- Promotes best practices like dynamic grouping and the Four Golden Signals.
- Maintains clear separation of concerns by delegating SLO and notification tasks.
- Provides data-driven traffic analysis for accurate AI agent alert thresholds.
Usage examples
- “Create a Terraform alerting policy for high latency on my GKE service.”
- The agent will guide you through selecting the appropriate GKE PromQL queries, generate the google_monitoring_alert_policy Terraform resource, and prompt you to attach notification channels.
- “Configure a cost alert for my Vertex AI Agent based on token usage.”
- The agent will run the traffic analysis script to determine your workload pattern and generate a PromQL-based alert policy tailored to your agent's historical token consumption.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/cloud-monitoring-alert-configuration/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip cloud-monitoring-alert-configuration.zip -d .agents/skills
Documentation by Google
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.
Files
- ATTRIBUTION.mdAdded by AutoGineer890 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md11.1 KiB
- references/agent_platform_cost_alert_policies.md9.7 KiB
- references/agent_platform_has_historical_traffic_data.md5.8 KiB
- references/agent_platform_no_historical_traffic_data.md4.1 KiB
- references/agent_platform_quality_alert_policies.md12.8 KiB
- references/agent_platform_reliability_alert_policies.md28.5 KiB
- references/agent_platform_safety_alert_policies.md7.0 KiB
- references/agent_platform_security_alert_policies.md6.8 KiB
- references/agent_platform_telemetry_enablement.md2.6 KiB
- references/attribution.md1.8 KiB
- references/cloud_run_jobs.md5.3 KiB
- references/cloud_run_services.md37.8 KiB
- references/cloud_run_worker_pools.md13.7 KiB
- references/compute_engine_alerts.md40.5 KiB
- references/generic_alert_policies.md18.9 KiB
- references/kubernetes_gke_configuration_prerequisites.md13.3 KiB
- references/kubernetes_metrics_and_alerts_catalog.md22.0 KiB
- references/kubernetes_promql_queries.md18.2 KiB
- scripts/agent_platform/analyze_traffic.pyScript12.8 KiB
- scripts/agent_platform/analyze_traffic_test.pyScript7.8 KiB
- scripts/agent_platform/check_telemetry.pyScript5.8 KiB
- scripts/agent_platform/check_telemetry_test.pyScript5.4 KiB
- scripts/agent_platform/config_utils.pyScript9.4 KiB
- scripts/agent_platform/config_utils_test.pyScript10.2 KiB
- scripts/agent_platform/create_online_monitor.pyScript5.8 KiB
- scripts/agent_platform/create_online_monitor_test.pyScript5.7 KiB
- scripts/agent_platform/gather_agent_info.pyScript14.8 KiB
- scripts/agent_platform/gather_agent_info_test.pyScript11.0 KiB
- scripts/agent_platform/lint_syntax.pyScript1.9 KiB
- scripts/agent_platform/list_log_scope_table_names.pyScript4.7 KiB
- scripts/agent_platform/list_log_scope_table_names_test.pyScript8.6 KiB
- scripts/agent_platform/list_trace_scope_table_names.pyScript4.3 KiB
- scripts/agent_platform/list_trace_scope_table_names_test.pyScript6.4 KiB
- scripts/agent_platform/mock_traffic_data.pyScript100.4 KiB
- scripts/agent_platform/requirements.txt102 B
- scripts/agent_platform/scan_duplicates.pyScript3.7 KiB
- scripts/agent_platform/scan_duplicates_test.pyScript3.9 KiB
- scripts/discover_metric_schema.pyScript13.1 KiB
- scripts/discover_metric_schema_test.pyScript10.4 KiB
- scripts/kubernetes/validate_config.pyScript9.2 KiB
- scripts/lint_promql.pyScript2.5 KiB
references/generic_alert_policies.md
Configure Generic Alert Policies for Other Resources
This reference provides best-practice alerting patterns for arbitrary Google Cloud resources, custom workloads, or service types that do not have dedicated resource-specific alert references in this skill (such as Cloud Run or GKE).
To maintain consistency across all alerting policies in this skill, we
prioritize PromQL (condition_prometheus_query_language) where supported by
Cloud Monitoring (through managed Prometheus or Cloud Monitoring PromQL
evaluation). Note that Monitoring Query Language (MQL) is deprecated in favor
of PromQL — whenever a user requests an MQL alert policy, explicitly inform
them that MQL is deprecated in favor of PromQL and provide the equivalent PromQL
configuration.
Follow Mandatory Requirements for Generic Resource Alerts
When configuring alerts for any generic, custom, or fallback Google Cloud resource (such
as Cloud SQL, Spanner, Memorystore Redis, Pub/Sub, custom processing pipelines,
MQL migration, or adding alerts to monitoring/alerts.tf / HCL review and
deduplication), follow the patterns in this reference directly. Do not search the workspace for additional reference files, scripts, or unrelated .tf files. Only inspect an existing .tf file (such as monitoring/alerts.tf) when the user asks to add to, review, or deduplicate that file. Run python3 scripts/discover_metric_schema.py --project <project_id> --resource-type <resource_type> to verify exact PromQL metric names (including _bucket),
units (for example, us versus ms), resource grouping labels, and documented label enum
values before writing HCL. When responding to these requests, you MUST:
Run schema & metric discovery commands: Run
python3 scripts/discover_metric_schema.pyandgcloud monitoring metric-descriptors listwhen configuring alerts for custom or unsupported resources, and include the exact commands in your response.Run PromQL validation commands: Run
python3 scripts/lint_promql.pyand/orpython3 scripts/discover_metric_schema.py --promql(andgrep/difffor HCL review) when generating, fixing, validating, or deduplicating HCL/PromQL queries, and include the exact commands in your response.Perform in-place HCL deduplication: For HCL review or deduplication requests, explicitly describe inspecting existing HCL policies for duplicates and performing an in-place update rather than appending duplicate blocks.
Use explicit grouping: Use
sum by (<label>)(for example,sum by (service)) orgroup_by_fieldsfor fleet-wide aggregation (never ungrouped scalarsum(...)).Explicitly note MQL deprecation: State that MQL is deprecated in favor of PromQL if MQL is requested.
Prompt for Notification Channels: Always ask the user at the end of your response if they would like to configure notification channels if none were provided.
Delegate SLOs: Whenever an availability, latency, or throughput SLO (or an error-budget / burn-rate alert) is requested, follow Delegate SLOs and Apply the Fallback Rule below: discover the exact SLI metric with
scripts/discover_metric_schema.py, then delegate the SLO policy generation to thegoogle-cloud-slo-alert-configurationskill — never emit a single static error ratio as an SLO.
Review the Table of Contents
Discover and Select Metrics: Lines 75-113
Apply the Four Golden Signals Framework (PromQL): Lines 114-159
Monitor Error Rate: Lines 116-127
Monitor Latency and Duration: Lines 128-137
Monitor Traffic and Throughput: Lines 138-147
Monitor Saturation and Utilization: Lines 148-159
Apply Terraform Configuration Templates (PromQL): Lines 160-242
Use Template A for PromQL-Based Alert Policies (Recommended): Lines 162-197
Use Template B for Legacy Threshold-Based Alert Policies (Fallback): Lines 198-242
Configure Cloud Logging Log-Based Metric Alerts: Lines 243-313
Delegate SLOs and Apply the Fallback Rule: Lines 314-378
Validate PromQL Syntax and Metric Schemas: Lines 379-403
Review and Deduplicate HCL Configurations: Lines 404-412
Follow Best Practices and Validation Rules: Lines 413-444
Discover and Select Metrics
Before configuring alerts for an unfamiliar or generic Google Cloud resource, discover its available metrics, metric types, units, and label enum values:
Run Universal Schema & Metric Discovery (
discover_metric_schema.py): Run the schema discovery script to automatically inspectmonitoredResourceDescriptorsandmetricDescriptorsthrough the Cloud Monitoring v3 API. This script outputs exact PromQL metric names (including_bucketsuffixes for distributions), unit scaling warnings (for example, microsecondsusversus millisecondsms), grouping keys (sum by (...)), and documented label enum values (for example,response_class="success"):python3 scripts/discover_metric_schema.py \ --project="<project_id>" \ --resource-type="<monitored_resource_type>" \ --metric-prefix="<metric_prefix_or_domain>"List Metric Descriptors with the
gcloudCLI:gcloud monitoring metric-descriptors list \ --filter="resource.type=\"<monitored_resource_type>\""Map to PromQL: Cloud Monitoring automatically translates Google Cloud metric types (
<domain>/<path>) into Prometheus format by replacing dots (.) with underscores (_), replacing the first slash (/) after the domain with a colon (:), and replacing remaining slashes with underscores (_). For example,serviceruntime.googleapis.com/api/request_countmaps toserviceruntime_googleapis_com:api_request_count(append_bucketfor distributions). Always verify.unit(usversusms) and documented label values before writing thresholds or label matchers.
Apply the Four Golden Signals Framework (PromQL)
Monitor Error Rate
Monitor the ratio of failed requests or error status codes over total requests.
PromQL Query:
sum by (service) (rate(serviceruntime_googleapis_com:api_request_count{response_code_class="5xx"}[5m])) / sum by (service) (rate(serviceruntime_googleapis_com:api_request_count[5m])) > 0.01
Monitor Latency and Duration
Monitor 95th or 99th percentile request duration.
PromQL Query:
histogram_quantile(0.95, sum by (service, le) (rate(serviceruntime_googleapis_com:api_request_latencies_bucket[5m]))) > 2000
Monitor Traffic and Throughput
Monitor total request volume or transaction rate.
PromQL Query:
sum by (service) (rate(serviceruntime_googleapis_com:api_request_count[5m]))
Monitor Saturation and Utilization
Monitor CPU, memory, or resource capacity utilization percentage.
PromQL Query:
avg(rate(container_cpu_usage_seconds_total[5m])) by (instance) > 0.85
Apply Terraform Configuration Templates (PromQL)
Use Template A for PromQL-Based Alert Policies (Recommended)
This is the standard alerting pattern used across Cloud Run, GKE, and Agent Platform in this skill.
resource "google_monitoring_alert_policy" "generic_promql_error_rate" {
display_name = "Generic High Error Rate (PromQL)"
project = var.project_id
combiner = "OR"
conditions {
display_name = "Error rate exceeds 1% over 5m"
condition_prometheus_query_language {
query = <<-EOT
sum by (service) (rate(serviceruntime_googleapis_com:api_request_count{response_code_class="5xx"}[5m]))
/
sum by (service) (rate(serviceruntime_googleapis_com:api_request_count[5m])) > 0.01
EOT
duration = "300s"
}
}
alert_strategy {
auto_close = "604800s"
}
user_labels = {
"created-with-google-skill" = "cloud-monitoring-alert-configuration"
"alert-category" = "reliability"
"query-language" = "promql"
}
}Use Template B for Legacy Threshold-Based Alert Policies (Fallback)
Use this only if PromQL is unsupported for the specific metric backend.
resource "google_monitoring_alert_policy" "generic_threshold_error_rate" {
display_name = "Generic High Error Rate (Threshold)"
project = var.project_id
combiner = "OR"
conditions {
display_name = "Error count exceeds threshold"
condition_threshold {
filter = "metric.type=\"serviceruntime.googleapis.com/api/request_count\" resource.type=\"global\" metric.label.response_code_class=\"5xx\""
duration = "300s"
comparison = "COMPARISON_GT"
threshold_value = 10
aggregations {
alignment_period = "60s"
per_series_aligner = "ALIGN_RATE"
cross_series_reducer = "REDUCE_SUM"
group_by_fields = ["resource.labels.project_id"]
}
trigger {
count = 1
}
}
}
alert_strategy {
auto_close = "604800s"
}
user_labels = {
"created-with-google-skill" = "cloud-monitoring-alert-configuration"
"alert-category" = "reliability"
}
}Configure Cloud Logging Log-Based Metric Alerts
For applications or services that output text or structured logs rather than
native metrics, configure Cloud Logging log-based metrics (google_logging_metric)
and alert on them using Cloud Monitoring.
Define a Cloud Logging Log-Based Metric (google_logging_metric)
Extracts a counter or distribution metric from log entries matching a filter (for example, application crashes or unhandled exceptions).
resource "google_logging_metric" "app_error_log_metric" {
name = "app-error-log-count"
project = var.project_id
description = "Count of application error log entries"
filter = "resource.type=\"global\" severity>=ERROR"
metric_descriptor {
metric_kind = "DELTA"
value_type = "INT64"
unit = "1"
display_name = "Application Error Log Count"
}
}Create an Alert Policy on a Cloud Logging Log-Based Metric
Create an alert policy tracking the Cloud Logging log-based metric using threshold conditions:
resource "google_monitoring_alert_policy" "log_metric_alert" {
display_name = "High Application Error Log Rate"
project = var.project_id
combiner = "OR"
conditions {
display_name = "Error log rate exceeds threshold"
condition_threshold {
filter = "metric.type=\"logging.googleapis.com/user/${google_logging_metric.app_error_log_metric.name}\" resource.type=\"global\""
duration = "300s"
comparison = "COMPARISON_GT"
threshold_value = 5
aggregations {
alignment_period = "60s"
per_series_aligner = "ALIGN_RATE"
cross_series_reducer = "REDUCE_SUM"
}
trigger {
count = 1
}
}
}
alert_strategy {
auto_close = "604800s"
}
user_labels = {
"created-with-google-skill" = "cloud-monitoring-alert-configuration"
"alert-category" = "reliability"
}
}Delegate SLOs and Apply the Fallback Rule
Availability, latency, and throughput SLOs are owned by the
google-cloud-slo-alert-configuration skill. Delegate to it whenever the user
asks for an SLO, an error budget, or burn-rate alerting on a generic resource.
That skill owns the SLO wizard, the burn-rate templates
(references/promql_templates.md), the SLI mapping
(references/service_metrics.md), and the App Hub scoping labels
(references/app_hub_labels.md).
Never emit a single static threshold or a bare error ratio as an "SLO". Unlike the Cloud Run and GKE references, generic resources have no documented default SLI, so this reference must resolve the SLI first and hand that context over.
Context to hand off (so the SLO skill does not repeat discovery):
Resource type: the monitored resource type you confirmed with discovery.
Grouping labels: the resource identity labels returned by discovery (the
sum by (...)clause).SLI: the discovered metric name, its good/bad filter, and its unit.
SLO target: the user's target, or
0.999(99.9%) if they did not give one.
Discover the Exact SLI Metric and Hand It to the SLO Skill
Generic resources (Cloud SQL, Spanner, Memorystore, Pub/Sub, custom pipelines) rarely have a documented default SLI. Run the schema discovery script and include the exact command in your response:
python3 scripts/discover_metric_schema.py \
--project="<project_id>" \
--resource-type="<monitored_resource_type>" \
--metric-prefix="<metric_prefix_or_domain>"Use its output to resolve the four things a burn-rate query cannot be written without:
| Discovery Output | Why the SLO Needs It |
|---|---|
| Exact PromQL metric name | {GOOD_METRIC} / {BAD_METRIC} / {TOTAL_METRIC} substitution (for example, serviceruntime_googleapis_com:api_request_count) |
_bucket distribution series | Latency SLIs need the _bucket series for histogram_fraction / histogram_quantile |
Unit (us, ms, or s) | A 500 ms target is 500 for ms metrics but 500000 for us metrics (us versus ms) — the wrong unit silently produces an alert that never fires |
| Documented label enum values | The failure filter must use real values (for example, response_class="success" or response_code_class="5xx"); an invalid enum yields an always-empty series |
| Resource grouping labels | The sum by (...) clause that keeps the burn rate per-service instead of fleet-averaged |
Hand the resolved SLI to google-cloud-slo-alert-configuration as the
ServiceLevelIndicator input, along with the SLO target and window if the user
supplied them.
Fallback — only if google-cloud-slo-alert-configuration is not installed:
this reference intentionally carries no burn-rate templates. Say that SLO
alerting requires that skill, report the SLI you discovered, and continue with
the non-SLO golden-signal policies. Never silently present SLO policies as if
this skill owned them.
[!IMPORTANT] Your response MUST say, in plain text, that you will not invent or guess a metric name and that you will ask the user for the custom metric name and failure filter if schema discovery does not resolve one. Say this even when you believe you have identified the right metric — the SLO is only as correct as the SLI it is built on, and a guessed metric silently produces an alert that never fires.
Validate PromQL Syntax and Metric Schemas
When fixing, validating, or generating PromQL alert queries (such as diagnosing
and fixing unbalanced parentheses or invalid time windows), never search the
workspace or directory tree for a query file if no file path was
provided. If the user describes a syntax error (such as unbalanced
parentheses) without pasting the query, demonstrate the fix using a concrete
before-and-after example (for example, fixing missing closing parenthesis in
sum by (service) (rate(serviceruntime_googleapis_com:api_request_count{response_code_class="5xx"}[5m]) > 0.01
to
sum by (service) (rate(serviceruntime_googleapis_com:api_request_count{response_code_class="5xx"}[5m])) > 0.01).
Always run or print both the static syntax linter (lint_promql.py) and the
schema-aware validator (discover_metric_schema.py), and include the exact
commands in your response:
# 1. Static PromQL syntax & bracket/window validation
python3 scripts/lint_promql.py "<promql_expression>"
# 2. Live Google Cloud schema, metric existence, unit scaling ('us' versus 'ms'), & label enum validation
python3 scripts/discover_metric_schema.py \
--project="<project_id>" \
--promql '<promql_expression>'Review and Deduplicate HCL Configurations
When adding new alerts to monitoring/alerts.tf, inspect existing HCL policies
(for example, using grep or file inspection) to prevent duplicate alert blocks, perform
in-place updates when modifying existing policies, and always prompt the user
regarding notification channel configuration.
Follow Best Practices and Validation Rules
Prioritize PromQL & Note MQL Deprecation: Always use
condition_prometheus_query_languagewhere supported to maintain consistency with Cloud Run, GKE, and Agent Platform alert definitions. If a user requests an MQL policy, explicitly note that MQL is deprecated in favor of PromQL and provide PromQL instead.Cover Golden Signals (Error Rate + Saturation/Latency): When configuring production alerts for any generic or unsupported resource (such as Cloud SQL, Spanner, Memorystore Redis, or custom workloads), always provide alert policies covering at least Error Rate (or failed operations, evictions, or rejected connections) and Saturation/Latency.
Evaluation Window: Ensure PromQL queries specify an evaluation duration of at least
300s(5 minutes) to avoid flapping.SLOs: Delegate dedicated Service Level Objective tracking and error budget burn-rate alerting to the
google-cloud-slo-alert-configurationskill, handing off the SLI metric resolved by schema discovery (see Delegate SLOs and Apply the Fallback Rule).Notification Channels: Attach notification channels using the
cloud-monitoring-notification-channels-configurationskill. Always prompt the user to ask if they would like to configure notification channels if none were provided.Run & Include CLI Commands for Reproducibility: Always run the
python3 scripts/discover_metric_schema.py,gcloud monitoring metric-descriptors list, andpython3 scripts/lint_promql.py "<promql_expression>"commands to discover schemas and validate PromQL expressions, and include the exact commands in your response so users can reproduce your validation.Fleet-Wide Aggregation (
sum by/group_by_fields): For fleet-wide scaling or multi-instance alerts, always include explicit grouping: usesum by (service, instance_id)(orsum by (service)) in PromQL queries, oraggregations { group_by_fields = [...] }in threshold queries — never use ungrouped scalarsum(...).
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/cloud-monitoring-alert-configuration · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cloud-monitoring-alert-configuration.zip