Skip to main content

gcp-probe

Last updated on

GCP Cloud Monitoring probe allows you to query Google Cloud Platform monitoring metrics using PromQL and compare the results against specified criteria.

When to use

  • Validate GCP infrastructure metrics (e.g., instance CPU utilization, network throughput) during chaos targeting GCP resources
  • Use GCP Cloud Monitoring SLOs or custom metrics as experiment pass/fail criteria
  • Monitor GKE cluster or Compute Engine instance health via PromQL while running chaos experiments

Prerequisites

  • An active GCP account with Cloud Monitoring enabled
  • Access to the GCP Cloud Monitoring API from the Kubernetes execution plane
  • GCP service account credentials with appropriate permissions (either using Chaos Infra IAM or GCP Service Account Key)

Steps to configure

  1. Navigate to Project Settings > Chaos Probes and click + New Probe

  2. Select APM Probe, provide a name, and select GCP Cloud Monitoring under APM Type

  3. Under Variables, define any reusable values you want to reference in probe properties or run properties. For each variable, specify the type (String or Number), name, value (fixed or runtime input), and whether it's required at runtime.

  4. Choose your authentication method:

    MethodDescription
    Use Chaos Infra IAMUses the service account and workload identity already configured for your chaos infrastructure
    Use GCP Service Account KeyAuthenticates using a specific GCP service account key stored in Harness Secret Manager. The service account must have the monitoring.timeSeries.list permission. See GCP Service Account Keys documentation
  5. Under Probe Properties, configure:

    FieldDescription
    Project IDYour GCP project ID (e.g., my-gcp-project-123456)
    QueryPromQL query to retrieve metrics from GCP Cloud Monitoring.
    Example: avg_over_time(compute.googleapis.com/instance/cpu/utilization{instance_name="my-instance"}[5m]). See GCP Cloud Monitoring PromQL docs

    Under GCP Cloud Monitoring Data Comparison, provide:

    FieldDescription
    TypeData type for comparison: Float or Int
    Comparison CriteriaComparison operator: >=, <=, ==, !=, >, <, oneOf, between
    ValueThe expected value to compare against the metric result
  6. Provide the Run Properties:

    FieldDescription
    TimeoutMaximum time for probe execution (e.g., 10s)
    IntervalTime between successive executions (e.g., 2s)
    AttemptNumber of retry attempts (e.g., 1)
    Polling IntervalTime between retries (e.g., 30s)
    Initial DelayDelay before first execution (e.g., 5s)
    VerbosityLog detail level
    Stop On Failure (optional)Stop the experiment if the probe fails
  7. Click Create Probe