This document describes how to monitor VM extensions managed by VM Extension Manager on your Compute Engine instances by using Cloud Monitoring. Monitoring extension health and resource consumption helps you track CPU and memory usage and detect installation or runtime failures across your VM fleet.
In this document, you learn how to complete the following tasks:
- Review the available metrics for VM extensions
- Build custom monitoring dashboards
- Set up alerting policies
Before you begin
-
If you haven't already, set up authentication.
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
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
-
Install the Google Cloud CLI, and then sign in to the gcloud CLI with your federated identity. After signing in, initialize the Google Cloud CLI by running the following command:
gcloud init - Set a default region and zone.
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, and then sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
Before you begin
Before you monitor your extensions, complete the following prerequisites:
- Install VM extensions by creating extension policies.
- Review the basics about VM Extension Manager.
- Review Monitoring retention periods and Monitoring pricing.
Required IAM permissions
To get the permissions that you need to monitor metrics, build dashboards, and configure alerting policies, ask your administrator to grant you the following IAM roles on your project:
To get the permissions that you need to monitor metrics, build dashboards, and configure alerting policies, ask your administrator to grant you the following IAM roles:
-
To view metrics and dashboards:
Monitoring Viewer (
roles/monitoring.viewer) on the project -
To create and manage dashboards and alerting policies:
Monitoring Editor (
roles/monitoring.editor) on the project
For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to monitor metrics, build dashboards, and configure alerting policies. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to monitor metrics, build dashboards, and configure alerting policies:
-
To view dashboards:
monitoring.dashboards.geton the project -
To create dashboards:
monitoring.dashboards.createon the project -
To set up alerts:
monitoring.alertPolicies.createon the project
You might also be able to get these permissions with custom roles or other predefined roles.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Available metrics for VM extensions
The following metrics are available for monitoring your VM extensions in Monitoring:
| Metric name | Metric type | Description |
|---|---|---|
| VM Extension Enforcement Status | compute.googleapis.com/vm_extensions/extension/enforcement_status |
The enforcement status of a Compute Engine VM extension. Labels include extension_name and status.
For a list of extension names, see Supported extensions. Possible values for
|
| VM Extension Health Status | compute.googleapis.com/vm_extensions/extension/health_status |
The health status of a VM extension. Labels include extension_name and status.
For a list of extension names, see Supported extensions. Possible values for
|
| VM Extension CPU Max Usage | compute.googleapis.com/vm_extensions/extension/cpu/max_usage |
The maximum CPU time that the VM extension uses, expressed as a percentage. |
| VM Extension Memory Max Used Bytes | compute.googleapis.com/vm_extensions/extension/memory/used_bytes |
The maximum memory that the VM extension uses, in bytes. |
Build custom monitoring dashboards
You can build Monitoring dashboards with the most relevant VM extension charts for your use case. To add a chart to a dashboard, complete the following steps:
- In the Google Cloud console, select Monitoring:
- In the navigation pane, select Dashboards.
- Click Create dashboard.
- Click Add widget.
- In the Add widget window, for Data, select Metric.
- To select a metric, expand the Select a metric menu and complete the
following steps:
- For Active resources, select VM Instance.
- For Metric category, select Vm_extensions.
- For Metric, select a metric, such as VM Extension Health Status. For a list of available metrics, see Available metrics for VM extensions.
- Click Apply.
You can add as many charts to the dashboard as you like. For more information, see Create and manage custom dashboards.
Set up alerting policies
Monitoring lets you create alerts and receive notifications when
a metric crosses a specified threshold. For example, you can receive a
notification when an extension's health status changes to CRASHED.
To create an alerting policy, complete the following steps:
- In the Google Cloud console, select Monitoring.
- In the navigation pane, select Alerting.
- Click Create policy.
- On the Create alerting policy page, configure the alerting condition by
completing the following steps:
- To select a metric, expand the Select a metric menu and complete
the following steps:
- For Active resources, select VM Instance.
- For Metric category, select Vm_extensions.
- For Metric, select a metric, such as VM Extension Enforcement Status. For a list of available metrics, see Available metrics for VM extensions.
- Click Apply.
- Configure the trigger conditions, such as whether the
statuslabel equalsINSTALL_FAILED.
- To select a metric, expand the Select a metric menu and complete
the following steps:
- Follow the prompts to add notification channels and name the policy.
- Click Create policy.
For more information, see Create alerting policies.
What's next
- To inspect rollout progress and extension health status, see View VM extension details and status.
- To query historical enforcement events and audit installation or crash records in Cloud Logging, see View VM extension logs.
- To diagnose failed rollouts, check running guest processes, or inspect guest agent debug logs, see Troubleshoot VM extensions.
- To modify configuration settings, change pinned versions, or remove deployed agents, see Manage VM extensions by using extension policies.