Create and manage custom dashboards

This document describes how to create and manage custom dashboards by using the Google Cloud console. Custom dashboards let you display information that is of interest to you, organized in a way that's useful to you. For example, you might create a dashboard to display the logs, performance metrics, and alerting policies for virtual machines (VM) in your production environment. After you create a custom dashboard, you can also copy, modify, and share it. To create dashboards, you can use the Google Cloud console, the Cloud Monitoring API, or the Google Cloud CLI.

This document describes how to create and manage your custom dashboards by using the Google Cloud console:

About custom dashboards

Custom dashboards support a variety of widget types, so you can choose the best way to display your data. By default, dashboards display all metric data that is available to your Google Cloud project. If you configure a metrics scope, then your dashboard can display metric data for multiple Google Cloud projects.

A custom dashboard can display all of the following:

You can improve the load time or usability of a dashboard by grouping widgets. For example, you might add sections to a dashboard. Alternatively, you might add widgets to a container which is either expanded or collapsed.

After you create a dashboard, you can add filters, events, or labels:

  • Dashboard-wide filters apply to all, or some, widgets on the dashboard. These filters can be helpful when you are troubleshooting. For example, you can use these filters to display data only for a specific zone. For more information, see Add or remove filters.

  • Events, such as the crash of a Google Kubernetes Engine Pod, can help you correlate data from different sources when you're troubleshooting an issue. For more information, see Show events on a dashboard.

  • Labels can help you locate dashboards based on the type of content they display. For example, you might add the label prod to dashboards that display information about production systems. Similarly, you might add the label staging to indicate the dashboard displays information about staging systems.

    When viewing your dashboards, you can select a label to filter the list to those dashboards that contain the selected label.

Before you begin

To get the permissions that you need to create and modify custom dashboards by using the Google Cloud console, ask your administrator to grant you the Monitoring Editor (roles/monitoring.editor) IAM role on your project. 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.

For more information about roles, see Control access with Identity and Access Management.

Add a custom dashboard to your project

There are different approaches that you can use to add a custom dashboard to your Google Cloud project:

  • You can create a dashboard.
  • You can copy, or duplicate, a dashboard.
  • You can copy a dashboard from project to project.
  • You can upload or install dashboards from a shared location.
  • You can import a dashboard from Grafana.

For example, suppose you have multiple Google Cloud projects and you want them to define the same custom dashboard. For this situation, you might create the dashboard in one project and then copy the dashboard definition to other projects. Alternatively, you might download the dashboard definition to your local system, and then install that definition in other Google Cloud projects.

Create a new dashboard

To create a custom dashboard, do the following:

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

    Go to Dashboards

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

  2. In the Dashboards page, click Create custom dashboard.
  3. To add widgets to your dashboard, do the following:

    1. In the dashboard toolbar, click  Add widget.
    2. In the Add widget pane, select a widget to add to your dashboard.

      You can select a widget based on the type of data to display or how you want to display the data. In all cases, a configuration pane is opened. For example, you can select the Metric widget and then set the visualization to Stacked area. Or, you can select the Stacked area widget and then select the metric.

    3. Configure the widget.

    4. To apply your changes to the dashboard, in the toolbar, click Apply. To discard your changes, click Cancel.

      After the widget is added to your dashboard, you can change the widget's configuration.

  4. To save your modified dashboard, in the toolbar, click Save.

  5. Optional: Add labels to your dashboard:

    1. In the list of dashboards, locate the dashboard and then click Select.
    2. In the toolbar, click Labels, and then do one of the following:
      • To create a label and add it to your dashboard, in the Create a new label textbox, enter the name of the label, and then click Create and apply.

        The label is created and added to your dashboard.

      • To configure which labels are added to your dashboard, click Select labels to apply, select the labels, and then click Ok.
    3. To save your changes, click Confirm.

Copy a dashboard

When you want to experiment with different metrics or different aggregation options, you can copy a dashboard and then use the new dashboard for experimentation purposes.

To copy a dashboard, do the following:

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

    Go to Dashboards

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

  2. In the Dashboards Overview page, identify the dashboard to copy, and then click Copy dashboard.
  3. Optional: Update the dashboard's name.
  4. Click Copy in the confirmation dialog.

Copy a dashboard into another project

To copy a dashboard from one project to another, your IAM role for the destination Google Cloud projects must include the Monitoring editor permission. For more information about roles, see Control access with Identity and Access Management.

To copy a dashboard to another Google Cloud project, do the following:

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

    Go to Dashboards

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

  2. Copy the dashboard's definition into your clipboard:

    1. In the dashboard toolbar, click Settings, then JSON, and then JSON Editor.
    2. In the editor's toolbar, click Copy.
  3. Paste the definition into a new dashboard created in a different project:

    1. Use the Google Cloud console project picker to select the project where you want to save the dashboard definition.
    2. Click Create custom dashboard.
    3. In the dashboard toolbar, click Settings, click JSON, and then click JSON Editor.
    4. Paste the content of your clipboard into the editor.
    5. Click Apply changes.
    6. To save your modified dashboard, in the toolbar, click Save.

Install a dashboard

You can upload to your Google Cloud project a custom dashboard whose definition is stored in a shared location. Cloud Monitoring, for example, provides a curated set of dashboard definitions on GitHub that are specific to various Google Cloud services. The charts on these dashboards present a selection of metrics relevant to a specific service.

After you upload a dashboard definition, you can modify them to show the data you want to view.

For more information, see Install sample dashboards.

Import a dashboard from Grafana

Cloud Monitoring provides an importer that you can use to import dashboard files in the Grafana JSON format into Cloud Monitoring. For more information, see Import Grafana dashboards into Cloud Monitoring.

Find and view a dashboard

Custom dashboards are displayed in the same list as the service-specific dashboards that Cloud Monitoring creates as you add resources to your Google Cloud project.

To view a dashboard, do the following:

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

    Go to Dashboards

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

    The My Dashboards page lists all dashboards in your Google Cloud project.

  2. To find a dashboard, do any of the following:

    • Select a category. For example, to list the dashboards that are created automatically by Google Cloud based on your usage of Google Cloud services, select G​C​P. To further refine the list, use the Filter bar.

    • Select a user-defined label. For example, suppose you created a label named Staging and then applied that label to your dashboards that display information about your staging resources. To list these dashboards, select the label Staging. To further refine the list, use the Filter bar.

    • Add filters to the Filter bar:

      • To list dashboards whose name or description contains specific text, enter that text into the Filter bar.

      • To list dashboards after filtering by the value of dashboard field, do the following:

        1. Select Filter dashboards and then select a field to filter by. You can filter by the following dashboard fields: name, description, type, and user-defined label.

        2. Either enter a value for the filter or make a selection from the menu.

      • To list dashboards that don't have any charts, select Filter dashboards, select Labels, and then select (Empty).

      When you add multiple filters and don't include the OR operator between two filters, an AND operator joins the filters.

  3. After you locate the dashboard, select it.

Modify a dashboard

After you create a dashboard, you might determine that it needs modification to be more useful to you. For example, you might want to add or remove widgets, change the layout, or change how a widget displays data. Additionally, you might want to add labels to a dashboard, either to make it easier to find or to indicate the type of content on the dashboard.

Add or remove labels

To add or remove labels, do the following:

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

    Go to Dashboards

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

  2. In the list of dashboards, locate the dashboard and then click Select.
  3. In the toolbar, click Labels, and then do one of the following:
    • To create a label and add it to your dashboard, in the Create a new label textbox, enter the name of the label, and then click Create and apply.

      The label is created and added to your dashboard.

    • To configure which labels are added to your dashboard, click Select labels to apply, select the labels, and then click Ok.
  4. To save your changes, click Confirm.

Add or remove filters and variables

After you create a dashboard, you can add filters and variables. Filters apply to all widgets on a dashboard. Variables apply to some widgets on the dashboard. Filters and variables can be helpful when you are troubleshooting. For example, you can use a filter so that the dashboard displays data only for a specific zone.

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

    Go to Dashboards

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

  2. Locate and select the dashboard.

    • To add a dashboard-wide filter that applies only for your current session, use the dashboard's filter bar. For more information, see Temporary filters.

    • To add a dashboard-wide filter that is permanent, in the dashboard toolbar, go to Settings, and then select Manage Filters. For more information, see Create and manage variables and pinned filters.

Modify widgets or change layout

To modify the widgets on a dashboard or the layout of the dashboard, do any of the following:

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

    Go to Dashboards

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

  2. Locate and select the dashboard.
  3. Optional: To add a widget to your dashboard, in the dashboard toolbar, click  Add widget, then select and configure the widget. To apply your changes to the dashboard, in the toolbar, click Apply. To discard your changes, click Cancel.

    For more information, see the following pages:

  4. Optional: To modify a widget, do one of the following:

    • Place your pointer on the widget to activate the toolbar, click  Edit widget, and then update the widget. To apply your changes to the dashboard, in the toolbar, click Apply. To discard your changes, click Cancel.

      You can change most settings for the widget, including the widget type. For example, to change a line chart to a stacked area chart, click Line chart and select Stacked area chart from the menu. For more information, see Change a widget's type.

    • Click Settings, click JSON, and then click JSON Editor. If you modify the JSON, then you must click Apply changes.

      You can also access the JSON for a widget by editing the widget, in the widgets toolbar, and then clicking  View code.

  5. Optional: To delete a widget, place your pointer on the widget to activate the toolbar, and then do one of the following:

    • If the toolbar of the widget displays a Delete button, then click that button.
    • Otherwise, click More options, and then select Delete widget.

    To apply your changes to the dashboard, in the toolbar, click Apply. To discard your changes, click Cancel.

  6. Optional: To reposition a widget, use your pointer to drag the widget by its header to a new location. To apply your changes to the dashboard, in the toolbar, click Apply. To discard your changes, click Cancel.

    You can't reposition widgets when a dashboard is in grid mode.

  7. Optional: To resize a widget, use your pointer to reposition the right-hand corner of the widget. To apply your changes to the dashboard, in the toolbar, click Apply. To discard your changes, click Cancel.

    You can't resize widgets when a dashboard is in grid mode.

  8. To save your modified dashboard, in the toolbar, click Save.

Delete a dashboard

Deleting a dashboard that contains a chart for an alerting policy doesn't delete the alerting policies whose data was displayed on those charts. Therefore, you might receive notifications from those policies after the dashboard is deleted. For information about how to manage your policies, which you do from the Alerting page in the Google Cloud console, see Manage alerting policies.

To delete a custom dashboard, do the following:

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

    Go to Dashboards

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

  2. To begin the delete action, find the dashboard you want to delete and click Delete.
  3. In the confirmation dialog, click Delete.
  4. To save your modified dashboard, in the toolbar, click Save.

Save a dashboard definition to a local system

You might have created a custom dashboard that others in your team or organization want to install in their projects. When you want to share a dashboard definition, save it to your local system, and then move or copy the definition to a shared location. For example, you might copy the definition to a shared drive or to a source code repository like GitHub. Any individual with access to the stored location can install the dashboard into their Google Cloud projects.

To save the definition of a custom dashboard to a JSON-formatted file that is stored on your local system, do the following:

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

    Go to Dashboards

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

  2. In the dashboard toolbar, click Settings, click JSON, and then click JSON Editor.
  3. To save the dashboard definition to a local system, click File Download:

    The created file, which has the same name as the dashboard, contains a JSON representation of the dashboard. This file only stores the definition of the dashboard, it doesn't store time-series data.

Share a dashboard

When you are investigating a data anomaly, you might want another individual in your team or your organization to view the same data that you are viewing. For example, you might see an unexpected drop, or spike, in a performance metric and you want to consult with a teammate. In this scenario, you want your teammate to view the dashboard and its data.

For information about how to share a link to a dashboard, see Share a custom dashboard.

Configure data refresh

When you open a dashboard, it is configured with auto refresh disabled. The toolbar displays a toggle, , which indicates this state.

For your current session, to enable auto refresh, go to the toolbar and select Enable auto refresh.

To disable auto refresh after you've enabled it, go to the toolbar and select Disabled auto refresh.

Enable automatic saving of configuration changes

By default, dashboards don't save your changes. To enable auto-save, click the Autosave toggle until it is the On position. When Cloud Done is displayed, your changes have been saved.

What's next