Get the FREE Ultimate OpenClaw Setup Guide →

Monitoring List

npx machina-cli add skill yu-iskw/google-cloud-observability-plugin/monitoring-list --openclaw
Files (1)
SKILL.md
1.0 KB

Metrics List

List available metric descriptors in Cloud Monitoring.

Purpose

Discover available metrics to query for performance and health analysis.

Inputs

  • project (optional): The Google Cloud project ID to list metrics from.
  • metric_filter (optional): Filter for specific metric types (e.g., metric.type=starts_with("compute.googleapis.com/")).
  • resource_filter (optional): Filter for specific resource types (e.g., resource.type="gce_instance").

Behavior

  1. Construct the filter string. If both filters are provided, combine them with AND.
  2. Execute gcloud monitoring metric-descriptors list --project=[PROJECT] --filter="[FILTER]" --format=json.
  3. If project is not provided, use the active project from gcp-context.

Output

Returns a JSON list of metric descriptors.

References

Source

git clone https://github.com/yu-iskw/google-cloud-observability-plugin/blob/main/skills/monitoring-list/SKILL.mdView on GitHub

Overview

This skill discovers and lists available metric descriptors in Cloud Monitoring to help you understand what metrics you can query for performance and health analysis. It supports optional project, metric_filter, and resource_filter inputs and returns a JSON array of descriptors for use in dashboards or automation.

How This Skill Works

It constructs a filter from metric_filter and resource_filter, joining them with AND if both are provided. It then runs gcloud monitoring metric-descriptors list --project=[PROJECT] --filter="[FILTER]" --format=json, returning a JSON list of metric descriptors. If no project is specified, the active project from gcp-context is used.

When to Use It

  • You need to inventory all metrics available in a project before building dashboards or alerts.
  • You want to identify relevant metrics for performance or health analysis.
  • You need to filter metrics by a specific metric type prefix (e.g., compute metrics).
  • You want to focus on a specific resource type (e.g., gce_instance) when querying metrics.
  • You are integrating metric descriptors into automation and require JSON output for parsing.

Quick Start

  1. Step 1: Decide the target project or rely on your current gcp-context.
  2. Step 2: If needed, create metric_filter and/or resource_filter expressions to narrow results.
  3. Step 3: Run the command gcloud monitoring metric-descriptors list --project=[PROJECT] --filter="[FILTER]" --format=json and parse the JSON output.

Best Practices

  • Use precise metric_filter expressions that match exactly the metrics you plan to query.
  • Combine metric_filter and resource_filter with AND when both are provided to avoid broad results.
  • Prefer --format=json to obtain structured data suitable for parsing.
  • Verify the active project via gcp-context before running to avoid unexpected results.
  • If listing many descriptors, consider storing the JSON output to a file for reuse.

Example Use Cases

  • List all metrics in the active project: gcloud monitoring metric-descriptors list --format=json
  • Filter by metric type prefix compute.googleapis.com: gcloud monitoring metric-descriptors list --filter="metric.type=starts_with(\"compute.googleapis.com/\")" --format=json
  • Filter by a specific resource type gce_instance: gcloud monitoring metric-descriptors list --filter="resource.type=\"gce_instance\"" --format=json
  • Combine both filters to narrow results: gcloud monitoring metric-descriptors list --filter="metric.type=starts_with(\"compute.googleapis.com/\") AND resource.type=\"gce_instance\"" --format=json
  • Limit the scope to a single project: gcloud monitoring metric-descriptors list --project=my-prod --format=json

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers