SkillAgentSearch skills...

compute-host-events-troubleshooting

Investigates, diagnoses, and mitigates Google Compute Engine virtual machine (VM) host events, including planned infrastructure maintenance (migrateOnHostMaintenance, terminateOnHostMaintenance), physical host hardware errors (hostError), guest OS terminations (guestTerminate), and Spot or Preemptib…

Install / Use

npx skills add google/skills --skill compute-host-events-troubleshooting

Installs into whichever agent you are using.

About this skill
📄

SKILL.md

Installable skill definition

Quality Score

90/100

Category

Operations

Supported Platforms

Universal

Tags

Our assessment of compute-host-events-troubleshooting

compute-host-events-troubleshooting scores 90/100 on our quality scale, 273rd of 751 Operations skills we index (top 37%).

Its SKILL.md is 25 KB long, well organised into 20 sections with 9 code examples: a thorough specification that gives an agent plenty to work with.

With 20,340 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
30/30
Structure
20/20
Description
15/15
Adoption
18/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated about 2 months ago, so compute-host-events-troubleshooting is actively maintained.
  • It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

compute-host-events-troubleshooting compared with similar skills

All 4 of these similar skills score higher than compute-host-events-troubleshooting; compare them before choosing.

SkillScoreStarsUpdatedFormat
compute-host-events-troubleshooting (this skill)by google9020.3k2mo agoSKILL.md
algorithmic-artby anthropics100177.9k2mo agoSKILL.md
pptxby anthropics100177.9k2mo agoSKILL.md
prospectingby coreyhaines3110062.2k5d agoSKILL.md
ad-creativeby coreyhaines3110062.2k5d agoSKILL.md

Frequently asked questions

How do I install compute-host-events-troubleshooting?
Run npx skills add google/skills --skill compute-host-events-troubleshooting. The install tabs above show the steps for each supported agent.
Which AI agents does compute-host-events-troubleshooting work with?
It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
Is compute-host-events-troubleshooting safe to use?
It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is compute-host-events-troubleshooting still maintained?
The repository was last updated about 2 months ago, so compute-host-events-troubleshooting is actively maintained.

name: compute-host-events-troubleshooting description: >- Investigates, diagnoses, and mitigates Google Compute Engine virtual machine (VM) host events, including planned infrastructure maintenance (migrateOnHostMaintenance, terminateOnHostMaintenance), physical host hardware errors (hostError), guest OS terminations (guestTerminate), and Spot or Preemptible VM preemptions (compute.instances.preempted) using shutdown-script metadata. Use ONLY when an existing Compute Engine VM unexpectedly reboots, stops, crashes, is preempted, or becomes unresponsive due to physical host maintenance, hardware errors, or Local SSD recovery. DO NOT read or use for creating new standalone VMs, Managed Instance Group (MIG) autoscaler scale-out or scale-in failures, Google Kubernetes Engine (GKE) clusters, application OOM debugging, or VPC firewall issues. metadata: version: "1.0.0" category: Compute

Compute Engine VM Host Events & Infrastructure Crash Troubleshooting

This skill diagnoses unexpected Google Compute Engine VM restarts, terminations, and unresponsiveness caused by infrastructure host events (compute.instances.hostError, compute.instances.migrateOnHostMaintenance, compute.instances.terminateOnHostMaintenance, compute.instances.preempted, compute.instances.automaticRestart) or guest-OS-initiated shutdowns (compute.instances.guestTerminate). It provides authoritative Cloud Audit Log queries, Log Analytics _Required._AllLogs SQL aggregations, upcoming maintenance window checks, and host scheduling remediations.

MCP Tools: get_instance_basic_info, list_instances, list_instance_attached_disks, start_instance, stop_instance, reset_instance, delete_instance, get_zone_operation

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.


Prerequisites & Environment Setup

Any host or project modifications (installing or updating gcloud, configuring the Compute Engine MCP server, enabling APIs or Log Analytics, mutating VM scheduling/metadata, creating log-based metrics, or deleting resources) must be explicitly approved by the user before execution.

  1. Google Cloud SDK: Verify gcloud is installed (gcloud --version). If missing or outdated, ask the user for approval before installing via Install the gcloud CLI.
  2. Compute Engine MCP Server & Capability Boundary:
    • The Compute Engine MCP server (Use the Compute Engine MCP server) exposes zonal VM discovery and lifecycle tools (get_instance_basic_info, list_instances, list_instance_attached_disks, start_instance, stop_instance, reset_instance, delete_instance, get_zone_operation, requiring roles/mcp.toolUser).
    • Critical Routing Rule: get_instance_basic_info returns a reduced InstanceBasicInfo projection (name, id, status, machine_type, create_time, guest_accelerators) that omits scheduling and resourceStatus.upcomingMaintenance, and Compute Engine MCP does not expose tools for Cloud Logging queries, serial console output, set-scheduling, perform-maintenance, or instance metadata updates. Always route full scheduling inspection, upcoming maintenance checks, serial port output, audit log queries, and scheduling/metadata mutations to gcloud (or Compute Engine / Cloud Logging REST APIs).
  3. Authentication:
    • Local CLI: gcloud auth login
    • Application Default Credentials: gcloud auth application-default login
    • Service Accounts: Set GOOGLE_APPLICATION_CREDENTIALS to your service account credentials path.
  4. Project, Region & Billing:
    gcloud config set project {project_id}
    gcloud config set compute/region {region}
    gcloud config set compute/zone {zone}
    
    Note: An active billing account attachment is required (even when evaluating Free Tier eligible resources). If no region is specified, default to us-central1 (us-central1-a), and check Google Cloud locations for regional hardware availability.
  5. API Enablement:
    gcloud services enable compute.googleapis.com logging.googleapis.com monitoring.googleapis.com
    
  6. Required IAM Roles:
    • Read-Only Diagnostics: roles/compute.viewer (instance scheduling and serial console output), roles/logging.viewer (or roles/logging.privateLogViewer to read system_event and activity audit logs), and roles/logging.viewAccessor for Log Analytics queries in Cloud Logging (plus roles/bigquery.jobUser and roles/bigquery.dataViewer when querying a linked Log Analytics dataset from BigQuery Studio or bq).
    • Remediation & MCP: roles/compute.instanceAdmin.v1 (to run set-scheduling, perform-maintenance, add-metadata, or remove-metadata), roles/logging.configWriter (to create log-based metrics), and roles/mcp.toolUser (for Compute Engine MCP calls).

Diagnostic Workflow: Classify the Termination Event

When a user reports an unexpected VM reboot, stop, or crash, run targeted Cloud Logging queries against cloudaudit.googleapis.com/system_event (Compute Engine infrastructure events) and cloudaudit.googleapis.com/activity (caller-initiated API stops/resets). Always pass --freshness=7d (or a window covering the incident timestamp) because gcloud logging read defaults --freshness to 1d and silently returns zero rows for incidents older than 24 hours. See Troubleshooting VM shutdowns and reboots.

Key Distinction: hostError vs. Planned Maintenance vs. preempted

  • compute.instances.hostError (Unplanned Hardware/Hypervisor Crash): Indicates an unexpected hardware or hypervisor failure on the physical server hosting the VM. If scheduling.automaticRestart is true (--restart-on-failure), Compute Engine automatically restarts the VM on a healthy physical host (typically within 3 to 5.5 minutes from detection on standard VMs, logging compute.instances.automaticRestart). On VMs with attached Local SSDs, Compute Engine logs compute.instances.hostError with operation.first="true" when Local SSD recovery begins and operation.last="true" when recovery completes or reaches scheduling.localSsdRecoveryTimeout.
  • compute.instances.migrateOnHostMaintenance / compute.instances.terminateOnHostMaintenance (Planned Infrastructure Maintenance): Compute Engine logs these exact system_event method names (along with compute.instances.upcomingMaintenance notifications) during scheduled hardware or hypervisor updates. Depending on onHostMaintenance, the VM either transparently live-migrates (MIGRATE -> compute.instances.migrateOnHostMaintenance) or terminates (TERMINATE -> compute.instances.terminateOnHostMaintenance, followed by compute.instances.automaticRestart if automaticRestart: true).
  • compute.instances.preempted (Spot / Preemptible VM Reclaimed): Indicates Compute Engine reclaimed capacity from a Spot VM or Preemptible VM.

1. Query Infrastructure Host Events & Caller Stops in Cloud Logging

Run this gcloud logging read command to determine whether {vm_name} experienced a physical host error, planned maintenance, Spot preemption, MIG recreation, or an external caller-initiated API stop/reset:

gcloud logging read 'resource.type="gce_instance" AND (log_id("cloudaudit.googleapis.com/system_event") OR log_id("cloudaudit.googleapis.com/activity")) AND protoPayload.methodName=~"(compute\.instances\.(hostError|migrateOnHostMaintenance|terminateOnHostMaintenance|preempted|automaticRestart|upcomingMaintenance|guestTerminate|repair.*)|v1\.compute\.instances\.(stop|reset|delete|performMaintenance|simulateMaintenanceEvent))" AND protoPayload.resourceName:"{vm_name}"' \
    --project={project_id} \
    --freshness=7d \
    --limit=25 \
    --format="table(timestamp, logName.basename(), protoPayload.methodName, protoPayload.authenticationInfo.principalEmail, operation.first, operation.last, protoPayload.status.message)"

2. Check Specifically for Guest OS Initiated Terminations (guestTerminate)

If the VM stopped without a hostError, maintenance termination, preemption, or user-initiated v1.compute.instances.stop Admin Activity log, check whether the shutdown was initiated from inside the Guest OS (sudo shutdown -h now, poweroff, systemctl poweroff, or an internal watchdog script):

gcloud logging read 'resource.type="gce_instance" AND log_id("cloudaudit.googleapis.com/system_event") AND protoPayload.methodName="compute.instances.guestTerminate" AND protoPayload.resourceName:"{vm_name}"' \
    --project={project_id} \
    --freshness=7d \
    --limit=20 \
    --format="yaml(timestamp, protoPayload.methodName, protoPayload.authenticationInfo.principalEmail, protoPayload.status)"
  • Critical guestTerminate Attribution Nuance: Because compute.instances.guestTerminate is a system_event generated when the guest ACPI power-off reaches the hypervisor, Compute Engine always records its generic built-in system principal in protoPayload.authenticationInfo.principalEmail — it never identifies which Linux/Windows user, cron job, or script inside the VM ran shutdown/poweroff (whereas external caller-initiated v1.compute.instances.stop, reset, or delete entries in cloudaudit.googleapis.com/activity record the external IAM user or service account in principalEmail).
  • How to Find the In-Guest Culprit: Inspect the VM's serial console output and guest OS logs from the previous boot (journalctl -b -1, /var/log/syslog or /var/log/messages, /var/log/auth.log, and last -x shutdown reboot):
    gcloud compute instances get-serial-port-output {vm_name} --project={project_id} --zone={zone} --port=1
    

3. Log Analytics SQL Query: Aggregate Host Events Across the Project

Compute Engine host events (hostError, migrateOnHostMaintenance, terminateOnHostMaintenance, preempted, automaticRestart, guestTerminate) are cloudaudit.googleapis.com/system_event logs. By default, Cloud Logging's _Default sink excludes system_event logs and routes them exclusively to the _Required log bucket.

Prerequisites for _Required._AllLogs SQL:

  1. Upgrade the _Required bucket to Log Analytics (seek user approval first):
    gcloud logging buckets update _Required --project={project_id} --location=global --enable-analytics
    
  2. In Log Analytics _AllLogs schemas, resource.labels has BigQuery type JSON (not STRUCT). Always extract fields with JSON_VALUE(resource.labels.zone) and JSON_VALUE(resource.labels.instance_id) — grouping directly on raw JSON expressions fails with Grouping by expressions of type JSON is not allowed.
SELECT
  JSON_VALUE(resource.labels.zone) AS zone,
  JSON_VALUE(resource.labels.instance_id) AS instance_id,
  REGEXP_EXTRACT(proto_payload.audit_log.resource_name, r'[^/]+$') AS vm_name,
  proto_payload.audit_log.method_name AS event_type,
  COUNT(*) AS event_count
FROM `{project_id}.global._Required._AllLogs`
WHERE
  resource.type = 'gce_instance'
  AND timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 DAY)
  AND proto_payload.audit_log.method_name IN (
    'compute.instances.hostError',
    'compute.instances.migrateOnHostMaintenance',
    'compute.instances.terminateOnHostMaintenance',
    'compu

Truncated for display — read the full file on GitHub.

Related Skills

View on GitHub
GitHub Stars20.3k
CategoryOperations
Updated2mo ago
Forks1.7k

Languages

Python

Trust signals

100/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

No cautions