This Quickstart shows you how to use Monitoring Query Language (MQL) to explore metrics and create charts:
Create a Compute Engine instance.
Navigate to the Query Editor.
Perform a query and create a chart.
Before you begin
To use MQL, you need to create a Google Cloud project and enable billing.
Sign in to your Google Account.
If you don't already have one, sign up for a new account.
In the Cloud Console, on the project selector page, select or create a Cloud project.
Make sure that billing is enabled for your Google Cloud project. Learn how to confirm billing is enabled for your project.
Create a Compute Engine instance
To have a Google Cloud resource to collect metrics from, create a Compute Engine instance by completing the following steps:
From the Cloud Console menu, select Compute Engine.
Select Create instance, and then click Create.
Navigate to the Query Editor
To begin using MQL, do the following:
From the Cloud Console menu, select Monitoring.
The first time you access Monitoring in the Google Cloud Console, a Workspace must be created. If you've never used Monitoring, or if you've never created a multi-project Workspace, a Workspace is created automatically. Otherwise, a dialog appears and you can select between creating a Workspace and adding your project to an existing Workspace.
From the Monitoring menu, select Metrics Explorer.
Click code Query Editor on the Build Your Query pane.
The interface changes to the MQL Query Editor:
Use the Query Editor to construct, test, and run MQL queries.
Perform a simple query and create a chart
Create a simple query that charts the CPU utilization of your instance:
Enter the following query and then click Run Query:
A chart appears displaying your instance's CPU utilization.
To save the chart, click Save Chart. Give the chart a name and add it to either an existing dashboard or a new one. Then click Save.
The chart can be accessed by going to the Monitoring overview page, or if you saved it to a dashboard, by going to that dashboard's page.
To avoid incurring charges to your Google Cloud account for the resources used in this quickstart, follow these steps.
Go to the Identity and Access Management page in the Google Cloud Console:
Click Shut down delete and follow the instructions.