Edit on GitHub
Report issue
Page history

Access time series data in InfluxDB Cloud with Google Data Studio

Author(s): @gunnaraasen ,   Published: 2020-12-08

Gunnar Aasen | Product Manager | InfluxData

Contributed by the Google Cloud community. Not official Google documentation.

Google Data Studio is an interactive dashboard tool that turns any internet-accessible data source into informative dashboards that are easy to build and share, which help you to derive powerful insights from your data.

The easy-to-use user interface makes it possible for anyone with the curiosity to drill down into their live datasets and build dashboard and reports with interactive controls such as data selectors, column sorts, and page-level filters. It also has support for calculated metrics and calculated fields. The InfluxData platform comes with a Data Studio connector that allows users to query time series data from their InfluxDB instance to build these Data Studio dashboards. In this tutorial, you use Data Studio to visualize monitoring metrics stored in InfluxDB Cloud.

The same general steps in this tutorial can be used for other InfluxDB measurement data being collected. Simply replace the references to diskio-usage and diskio with the bucket name and measurement name to connect to Data Studio.

Data Studio dashboard showing COVID-19 data

Objectives

  • Connect Data Studio to your InfluxDB Cloud instance.
  • Configure a downsampling task to aggregate metric data.
  • Create comprehensive dashboards using Data Studio and your time series data.

Costs

This tutorial does not incur any costs on InfluxDB Cloud if you use a Free-tier account.

This tutorial explains how to monitor existing Google Cloud resources but does not require any new resources on Google Cloud.

Before you begin

This tutorial assumes that you have Data Studio, an existing InfluxDB Cloud account, and Telegraf enabled to collect disk usage data.

We recommend following the tutorial on Monitoring Google Cloud with InfluxDB templates to set up an InfluxDB Cloud account and configure it to monitor your Google Cloud resources.

Configure InfluxDB Cloud

  1. Log in to your InfluxDB Cloud account.
  2. Create two buckets, named diskio-usage and diskio-usage-1h.

    You can also rename an existing bucket or, if you would like to use different bucket names, substitute the diskio-usage and diskio-usage-1h bucket names throughout this tutorial.

  3. Generate a new security token to be used in your Data Studio setup: In your InfluxDB Cloud instance, select Load Data > Tokens > Generate Read/Write Token.

    The new token only requires read permissions on the bucket where your disk usage data is stored.

Configure an InfluxDB task to downsample source data

We recommend using aggregated source data to avoid performance issues in the Data Studio UI.

The steps in this section show how to define a new task to downsample the disk usage metrics into a new bucket.

InfluxDB uses the Flux functional data scripting language to create data aggregation tasks.

  1. In your InfluxDB Cloud instance, select Task > Create Task.

  2. Copy the example Flux script below to create a new task for downsampling disk I/O metrics into 1-hour windows:

    // option task = {name: "diskio-usage-1h", every: 1h}
    data = from(bucket: "diskio-usage")
      |> range(start: -duration(v: int(v: task.every) * 24))
      |> filter(fn: (r) => (r["_measurement"] == "diskio"))
      |> filter(fn: (r) => (r["_field"] == "write_bytes" or r._field == "read_bytes" or r._field == "io_time" or r._field == "iops_in_progress"))
    
    data
      |> aggregateWindow(fn: sum, every: 1h)
      |> to(bucket: "diskio-usage-1h")
    
  3. Add the following settings to the task definition:

    • Name = diskio-usage-1h
    • Schedule Task {Every} = 1h
  4. Save the task, and wait for the task status to update to verify that it's running and aggregating data.

When the aggregated time series data is available, you can use it in your Data Studio project.

Connect InfluxDB Cloud to Data Studio

  1. Authorize the Data Studio InfluxDB Community Connector data source to enable a direct connection from Data Studio to InfluxDB Cloud.

  2. After authorizing the connector, enter the following connection details in the Data Studio data source wizard to connect with InfluxDB Cloud:

    • InfluxDB Cloud URL for your region, such as https://us-central1-1.gcp.cloud2.influxdata.com
    • Token created in the "Configure InfluxDB Cloud" section
    • Organization name
    • Bucket name: diskio-usage or diskio-usage-1h depending on whether downsampling was configured
    • Measurement name: diskio
  3. Click Connect to continue.

    After you complete the authorization, you see a list of fields available from your measurement, including all tags, fields, and timestamps.

    InfluxDB field list

  4. Click Create report in Data Studio to start building your charts.

Results

The Data Studio project can use InfluxDB Cloud as a data source for charts. Time series data stored in InfluxDB Cloud can be efficiently queried and combined with other data.

The task created in InfluxDB aggregates data every hour. Querying the aggregated hourly data creates even faster Data Studio reports, especially for longer time ranges.

Cleaning up

To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, you can delete the Data Studio InfluxDB Community Connector and remove the task from InfluxDB Cloud.

Delete the Data Studio InfluxDB Community Connector

  1. Navigate to the Data Studio data sources page.
  2. In the upper right corner of the the Data Studio InfluxDB Community Connector's card, click More.
  3. Click Revoke access.

Delete the InfluxDB Cloud task

  1. Follow the instructions to delete the task named diskio-usage-1h.

What's next

Submit a tutorial

Share step-by-step guides

Submit a tutorial

Request a tutorial

Ask for community help

Submit a request

View tutorials

Search Google Cloud tutorials

View tutorials

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