Manage host events across H4D VMs

This document explains how to use the host maintenance features that are availablewith H4D VMs. It explains how to monitor, plan for,and perform scheduled maintenance on virtual machine (VM) instances.To manage maintenance on your reserved blocks of capacity, whether or not VMsare running on them, see insteadManage host events across reservations.

When you proactively manage upcomingmaintenance host events onyour VMs, you can minimize disruptions and maintain optimal performance.

Before you begin

Select the tab for how you plan to use the samples on this page:

Console

When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

gcloud

In the Google Cloud console, activate Cloud Shell.

Activate Cloud Shell

At the bottom of the Google Cloud console, aCloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

REST

To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.

    Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:

    gcloudinit

    If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.

Required roles

To get the permissions that you need to manage host maintenance events across VMs, ask your administrator to grant you the following IAM roles:

  • Compute Admin (roles/compute.admin) on the project
  • For read-only access to System Event audit logs:Logs Viewer (roles/logging.viewer) on the project

For more information about granting roles, seeManage access to projects, folders, and organizations.

These predefined roles contain the permissions required to manage host maintenance events across VMs. To see the exact permissions that are required, expand theRequired permissions section:

Required permissions

The following permissions are required to manage host maintenance events across VMs:

  • To view the details of a VM: compute.instances.get on the project

You might also be able to get these permissions withcustom roles or otherpredefined roles.

Overview

To optimize the maintenance of your VMs, complete the following steps:

  1. Understand host maintenance. Learn about the frequency and maintenancebehavior of your VMs based on their machine series. This information helpsyou minimize disruptions to your workloads.

  2. Set up notification alerts. Create log-based alerts to receivenotifications when maintenance for your VMs is scheduled, started, orcompleted. This approach helps you proactively plan your activities andavoid unexpected downtime.

  3. Manage maintenance across VMs. View if maintenance is scheduled for yourVMs. If needed, you can manually start maintenance across your VMs. Thisprocess helps you increase the resilience of your workloads to host events,prevent downtime, and maximize the availability of your applications.

Understand host maintenance

During thelifecycle of aCompute Engine instance, the host machine that your instance runs on undergoes multiplehost events.A host event can include the regular maintenance ofCompute Engine infrastructure, or in rare cases, a host error. Compute Engine alsoapplies some non-disruptive lightweight upgrades for the hypervisor and networkin the background.

The H4D machine series offers the following features related to hostmaintenance:

Machine typeTypical scheduled maintenance event frequencyMaintenance behaviorAdvanced notificationOn-demand maintenanceSimulate maintenance
h4d-standard-192Minimum of 30 daysTerminate7 daysYesNo
h4d-highmem-192Minimum of 30 daysTerminate7 daysYesNo
h4d-highmem-192-lssdMinimum of 30 daysTerminates with Local SSD data persistence7 daysYesNo

The maintenance frequencies shown in the previous table are approximations, not guarantees.Compute Engine might occasionally perform maintenance more frequently.

Set up notification alerts for VMs

You can get notified about scheduled, started, or completed maintenance eventsfor your VMs bycreating log-based alerting policies.

To create an alert for the maintenance events of your VMs, complete thefollowing procedure. Repeat this procedure for each alertthat you want to create.

  1. In the Google Cloud console, go to theLogs Explorer page:

    Go toLogs Explorer

    If you use the search bar to find this page, then select the result whose subheading isLogging.

  2. Click theShow query toggle to the on position.

  3. In theQuery pane, build one of the following queries. These queriesfilter log entries to identify specific maintenance events. If you want touse multiple queries, repeat this procedure to create an unique alert foreach query.

    • To receive alerts when maintenance for a VM is scheduled:

      protoPayload.methodName="compute.instances.upcomingMaintenance" severity>=DEFAULTprotoPayload.status.message =~ "scheduled"
    • To receive alerts when the maintenance window for a VM has opened:

      protoPayload.methodName="compute.instances.upcomingMaintenance" severity>=DEFAULTprotoPayload.status.message =~ "ongoing"
    • To receive alerts when maintenance for a VM has started:

      protoPayload.methodName="compute.instance.terminateOnHostMaintenance" severity>=DEFAULT
    • To receive alerts when maintenance for a VM has completed:

      protoPayload.methodName="compute.instances.upcomingMaintenance" severity>=DEFAULTprotoPayload.status.message =~ "completed"
  4. To validate the query, clickRun query. If the query is valid, then theQuery results pane displays log entries that match the query.

  5. In theQuery results toolbar, click theActions list, and thenselectCreate log alert.TheCreate logs-based alert policy pane appears.

  6. In theAlert details section, do the following:

    1. In theAlert Policy Name field, enter a name for the policy.

    2. In thePolicy severity level list, selectWarning (or a higherseverity).

    3. ClickNext.

  7. In theChoose logs to include in the alert section, clickNext.

  8. In theSet notification frequency and autoclose duration section,specify the following:

    1. In theTime between notifications list, select how often you want tobe notified.

    2. In theIncident autoclose duration list, select after how longCloud Logging stops sending notifications and automatically closesthe incident.

    3. ClickNext.

  9. In theWho should be notified? section, specify anotification channel forLogging to send notifications to.

  10. ClickSave.

To view examples of maintenance event notifications in the Logs Explorer,seeExamples of maintenance notificationsin the Compute Engine documentation.

Manage maintenance across VMs

You can view and control maintenance for your VMs by doing one or more of thefollowing:

View the maintenance state of VMs

You can view the state and scheduled time of upcoming maintenance for your VMsby checking the value of theupcomingMaintenance field in the instance'smetadata. If a VM doesn't contain theupcomingMaintenance field, then no hostmaintenance event is scheduled for the VM. For more information about the fieldsinupcomingMaintenance, seeMaintenance status definitionsin the Compute Engine documentation.

Additionally, if maintenance is scheduled for an VM, theupcomingGroupMaintenance field contains themaintenanceReasons field. Thisfield describes why maintenance was scheduled for your VM, as described in thefollowing table:

Maintenance typeMaintenance reasonVMs state
Planned maintenance for regular maintenance
  • PLANNED_UPDATE: planned infrastructure maintenance
  • PLANNED_NETWORK_UPDATE: planned network maintenance
Applies to running, stopped, or suspended VMs.
Unplanned, emergency maintenance
  • FAILURE_DISK: unplanned maintenance scheduled due to an error with a disk attached to a VM.
  • FAILURE_INFRA: unplanned maintenance scheduled due to an error with the infrastructure.
  • FAILURE_INTERFACE: unplanned maintenance scheduled due to an error with the NIC.
  • FAILURE_MEMORY: unplanned maintenance scheduled due to an error with a VM's memory.
  • FAILURE_NETWORK: unplanned maintenance scheduled due to an error with the network.
Applies only to running VMs.

To view themaintenanceReasons field in a VM, you must use thegcloud CLI or REST API. To view the maintenance state formultiple VMs simultaneously, you must use the Google Cloud console or RESTAPI. Otherwise, select one of the following options:

Console

  1. In the Google Cloud console, go to theVM instances page.

    Go to VM instances

  2. In theMaintenance status column, Compute Engine displaysthe maintenance state of your VMs. If you don't see this column in theVM instances table, then clickview_columnColumn display options, select theMaintenance status checkbox,and then clickOK.

gcloud

To view the maintenance state of a VM, use thegcloud compute instances describe commandwith the--flatten=resourceStatus.upcomingMaintenance flag:

gcloud compute instances describeVM_NAME \    --flatten=resourceStatus.upcomingMaintenance \    --zone=ZONE

Replace the following:

  • VM_NAME: the VM name.

  • ZONE: the zone where the VM exists.

The output is similar to one of the following:

  • If a host maintenance event is scheduled for your VM, then the output issimilar to the following:

    ---canReschedule: truelatestWindowStartTime: '2025-11-01T19:00:00Z'maintenanceReasons:- 'PLANNED_UPDATE'- 'PLANNED_NETWORK_UPDATE'maintenanceStatus: 'PENDING'type: 'SCHEDULED'windowEndTime: '2025-11-01T22:00:00Z'windowStartTime: '2025-11-01T19:00:00Z'
  • If a host maintenance event isn't scheduled for your VM, then the outputis similar to the following:

    ---null

REST

To view the maintenance state of your VMs, make one of the followingGETrequests. When you make a request, you must include thefields queryparameter to only show the name, machine type, and upcoming maintenance fora VM. You must also include thefilter query parameter to only filter VMsby a specific machine type.

  • To view VMs across all zones:instances.aggregatedList method.

    GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/instances?fields=items.name,items.machineType,items.upcomingMaintenance&filter=machineType%3AMACHINE_TYPE
  • To view VMs in a specific zone:instances.list method.

    GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances?fields=items.name,items.machineType,items.upcomingMaintenance&filter=machineType%3AMACHINE_TYPE

Replace the following:

  • PROJECT_ID: the ID of the project where you createdVMs.

  • ZONE: the zone where the VMs exist.

  • MACHINE_TYPE: the machine type that you want tofilter the VMs by.

If a host maintenance event is scheduled for a VM, then the VM contains theupcomingMaintenance field:

{  "items": [    {      "name": "vm-01",      "machineType": "https://www.googleapis.com/compute/v1/projects/example-project/zones/europe-west4-b/machineTypes/h4d-highmem-192-lssd",      "resourceStatus": {        "upcomingMaintenance": {          "canReschedule": true,          "latestWindowStartTime": "2024-11-01T19:00:00Z",          "maintenanceStatus": "PENDING",          "maintenanceReasons": [            "PLANNED_UPDATE",            "PLANNED_NETWORK_UPDATE"          ],          "type": "SCHEDULED",          "windowEndTime": "2024-11-01T22:00:00Z",          "windowStartTime": "2024-11-01T19:00:00Z"        }      }    },    ...  ]}

Optionally, to further narrow down a list of VMs, set thefilter queryparameter to a differentfilter expression.

Metadata server

To view the maintenance state of a VM, do the following:

  1. If you haven't already, then connect to yourLinux orWindows VM.

  2. Query the metadata server as follows:

    curl http://metadata.google.internal/computeMetadata/v1/instance/upcoming-maintenance?alt=json -H "Metadata-Flavor: Google"

    If a host maintenance event is scheduled for your VM, then the output issimilar to the following:

    "Upcoming maintenance": {  "can_reschedule": "true",  "latest_window_start_time": "2024-12-01T19:00:01Z",  "maintenance_reasons": [    "PLANNED_UPDATE",    "PLANNED_NETWORK_UPDATE"  ],  "maintenance_status": "PENDING",  "type": "SCHEDULED",  "window_end_time": "2024-12-01T21:00:01Z",  "window_start_time": "2024-12-01T19:00:01Z"}

    If a host maintenance event isn't scheduled, then the output is similarto the following:

    { }

Manually start maintenance on VMs

You can manually start maintenance for your VMs instead of waiting for thescheduled time.

Depending on the maintenance state of a VM, the following occurs:

Maintenance stateDescriptionWhat you see
ScheduledCompute Engine has scheduled maintenance for the VM. You can manually start maintenance before the scheduled time.
  • In the Google Cloud console, the maintenance state shows asReady to run - will run onDATE.
  • In the gcloud CLI or REST API, Compute Engine sets themaintenanceStatus field toPENDING.
In progressMaintenance is underway. You can't reschedule it.
  • In the Google Cloud console, the maintenance state shows asRunning.
  • In the gcloud CLI or REST API, Compute Engine sets themaintenanceStatus field toONGOING.
CompleteMaintenance is finished. Compute Engine has removed all maintenance notifications from the VM.
  • In the Google Cloud console, the maintenance state shows asUp-to-date.
  • In the gcloud CLI or REST API, Compute Engine sets themaintenanceStatus field toCOMPLETE.

You can manually start maintenance for multiple VMs simultaneously or forindividual VMs. For multiple VMs, use the Google Cloud console or, for VMslocated in the same zone, the gcloud CLI. For individual VMs, selectany of the following options:

Console

  1. In the Google Cloud console, go to theVM instances page.

    Go to VM instances

  2. Select the rows for the VMs where you want to start maintenance.

  3. ClickRun maintenance.

  4. To confirm, clickRun maintenance.

gcloud

To manually start maintenance for one or more VMs within the same zone, usethegcloud compute instances perform-maintenance command:

gcloud compute instances perform-maintenanceVM_NAMES \    --zone=ZONE

Replace the following:

  • VM_NAMES: a list of VM names separated by spaces; forexample,vm-01 vm-02 vm-03.

  • ZONE: the zone where the VMs exist.

REST

To manually start maintenance for a VM, make aPOST request to theinstances.performMaintenance method:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME/performMaintenance

Replace the following:

  • PROJECT_ID: the ID of the project where you createdthe VM.

  • ZONE: the zone where the VM exists.

  • VM_NAME: the VM name.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.