cloud-monitoring-promql-query
Was er macht
Dieser Skill schreibt PromQL-Abfragen, die Google-Cloud-Metriken lesen. Gedacht ist das für Menschen, die PromQL dem üblichen Cloud-Monitoring-Filterformat vorziehen.
Wann du ihn nutzt
- ✓Wenn du eine PromQL-Abfrage willst, um eine Cloud-Monitoring-Metrik darzustellen oder zu alarmieren.
- ✓Wenn du eine Aggregation in PromQL für eine Google-Cloud-Ressource brauchst.
- ✓Wenn du eine Metrik in die richtige PromQL-Struktur übersetzen willst.
Link zum Skill
https://github.com/google/skills/blob/main/skills/cloud/cloud-monitoring-promql-query/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Schreib eine PromQL-Abfrage, die die Fehlerrate pro Minute für meinen Cloud-Run-Dienst zeigt.”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Er prüft zuerst deine Projekt-ID und ordnet dann die Metrik- und Ressourcendetails der PromQL-Struktur zu, die Google Cloud erwartet. Er gibt eine sofort nutzbare Abfrage zurück.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
Cloud Monitoring PromQL Generator
Use this skill to generate a valid PromQL query from any Cloud Monitoring metric type. This guide applies to all Cloud Monitoring metric types by mapping Cloud Monitoring metric and resource descriptors to PromQL structures.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:cloud-monitoring-promql-query)"
and append agent-skills/1.0 (skill:cloud-monitoring-promql-query) to User-Agent headers.
Workflow
Resolve Project ID (CRITICAL & BLOCKING)
Before performing any other actions (such as searching code, reading references, or running validation), you MUST verify whether the Google Cloud Project ID is available:
- Check Prompt/Payload: Look for the Project ID in the user's prompt or input.
- Check Environment: If the Project ID is not present in the prompt, you
MUST run
gcloud config get-value projectto attempt to resolve it from the environment. - Ask for Clarification (BLOCKING): If the Project ID is not in the prompt
AND the
gcloudcommand fails, returns an empty string, or is unavailable, you MUST immediately stop. Do NOT generate a PromQL query, do not run the validation script, and do not use placeholders (likeYOUR_PROJECT_ID). You must refuse to proceed and ask the user to provide the Project ID.
Inspect Metric and Resource Descriptors
- Use Provided Descriptors First: If the user's prompt already includes
metric descriptor details (such as
metric.type,metricKind,valueType, ormonitoredResourceTypes) or specific resource filter values, use those values directly instead of calling the Cloud Monitoring API. - Discover Missing Descriptors: If exact metric descriptors
(
metric.type,metricKind,valueType) are missing or underspecified, resolve the target metric type's descriptor using one of these paths:- Vague Query: If the prompt is vague (for example,
"VM CPU usage"), use thecloud-monitoring-metric-selectionskill first to identify the specific metric type. - Known Metric Type: If you already have the specific metric type name
(for example,
compute.googleapis.com/instance/cpu/utilization) but need its descriptor, call thegoogle-cloud-monitoring:list_metric_descriptorsMCP tool. If the tool is missing, refer to thecloud-monitoring-metric-selectionskill to configure the Cloud Monitoring MCP server. - Fallback: If the MCP tool cannot be configured, fall back to making a direct Cloud Monitoring API call.
- Vague Query: If the prompt is vague (for example,
- Identify Key Fields: From the retrieved descriptor, identify four key
schema attributes:
type: The Cloud Monitoring metric type string.metricKind:GAUGE,DELTA, orCUMULATIVE.valueType:INT64,DOUBLE,DISTRIBUTION, orBOOL.monitoredResourceTypes: Compatibleresource.typestrings required for resource scoping and grouping.
Resolve Resource Filters & Discovery Protocol
To filter data by a specific resource instance, apply these resource rules and discovery protocols:
- Monitored Resource Filter: Always include the
monitored_resource="<type>"filter in your query to prevent collisions across services that share metric names.- Example:
monitored_resource="gae_app"
- Example:
- Preserve User Literals (CRITICAL): ALWAYS use the literal resource names, namespaces, and IDs provided in the user's prompt. Do NOT override or replace these values with active resource names found during Cloud Monitoring discovery unless the user explicitly asked you to find active resources. Telemetry discovery must only be used to identify metric type names and label keys, not to override user input.
- Resource Identifier Mapping:
- Direct & Specific Keys: Use the most specific resource identifier
available. Example:
version_id,cluster_name. - Name-to-ID Resolution: If the user filters by a resource name
(such as
"instance-1"), but the resource schema uses numeric IDs (likeinstance_id), us
- Direct & Specific Keys: Use the most specific resource identifier
available. Example:
Häufige Fragen
Braucht er meine Projekt-ID?
Ja. Er fragt nach der Projekt-ID und prüft die Umgebung, falls die ID nicht in deiner Anfrage steht.
Findet er Metriken?
Nein. Die Suche nach Metriken übernimmt ein eigener Auswahl-Skill.
Funktioniert er für jeden Metriktyp?
Er ist so gebaut, dass er jeden Cloud-Monitoring-Metrik- und Ressourcentyp auf PromQL abbildet.
Details
Originalbeschreibung des Autors
Generates valid PromQL queries from Cloud Monitoring metric descriptors and resource parameters. Use when asked to create, generate, write, or format PromQL queries, PromQL strings, or PromQL aggregations for Cloud Monitoring metrics and resources. Don't use for raw metric discovery or metric selection.
repo: google/skills
Beliebtheit
- GitHub-Sterne
- 22k
- Platz im Ranking
- #10244
- Lizenz
- Apache-2.0
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
finding-google-skills
22kHilft deinem Agenten, die richtigen Google-Anleitungen für eine Einrichtungsaufgabe zu finden, etwa für Hosting, Datenbanken, Speicher, Anmeldung oder das Bereitstellen von KI-Modellen.
gcloud
22kHilft deinem Agenten, gcloud-Befehle für Google Cloud zu schreiben und zu prüfen, und schlägt die genaue Syntax nach, bevor etwas ausgeführt wird, damit keine Flags geraten werden.
google-cloud-recipe-auth
22kFührt deinen Agenten durch Identität und Zugriff in Google Cloud, einschließlich Anmeldung von Personen und Diensten und der Berechtigungen, die sie erhalten.
google-cloud-recipe-onboarding
22kFührt einen neuen Entwickler durch die ersten Schritte in Google Cloud, darunter Projektauswahl, Verknüpfung der Abrechnung und die Bereitstellung einer ersten Ressource.
Ähnliche Skills
openclaw-update
394kHilft deinem Agenten, ein bestehendes OpenClaw-Gateway zu aktualisieren, mit der Methode, die zu deiner Installation passt, während deine Sitzung weiterläuft.
diagnose-gateway
394kHilft deinem Agenten herauszufinden, warum dein OpenClaw-Gateway fehlschlägt, indem er Einstellungen, Kanäle und Ports prüft, ohne etwas zu ändern.
crabbox-apps
394kHilft deinem Agenten, eine App auf einer temporären Cloud-Maschine zu öffnen und auszuführen und ihre Ansicht in deinem Chat-Seitenpanel zu zeigen.