Strackdriver Monitoring provides dashboards and alerts for your cloud-powered applications. You configure Stackdriver Monitoring using the Stackdriver Monitoring Console. Review performance metrics for cloud services, virtual machines, and common open source servers such as MongoDB, Apache, Nginx, Elasticsearch, and more.

In this codelab, you'll learn the basics of Stackdriver Monitoring, how to navigate the Monitoring console, and where to look for basic monitoring events and statistics.

What you'll learn

What you'll need

How will you use this tutorial?

Read it through only Read it and complete the exercises

How would rate your experience with Google Cloud Platform?

Novice Intermediate Proficient

Self-paced environment setup

If you don't already have a Google Account (Gmail or Google Apps), you must create one. Sign-in to Google Cloud Platform console (console.cloud.google.com) and create a new project:

Remember the project ID, a unique name across all Google Cloud projects (the name above has already been taken and will not work for you, sorry!).

Next, you'll need to enable billing in the Developers Console in order to use Google Cloud resources.

Running through this codelab shouldn't cost you more than a few cents, but it could be more if you decide to use more storage or if you do not delete your objects (see "Delete a bucket" section at the end of this document). Google Cloud Storage pricing is documented here.

New users of Google Cloud Platform are eligible for a $300 free trial.

Before we can enable monitoring, we will need some kind of infrastructure within this Google Cloud Platform project to actually monitor, so let us create that now.

We will create:

  1. A Debian virtual machine running on Google Compute Engine
  2. A Cloud SQL instance

Creating the Virtual Machine

To create the virtual machine:

  1. Visit the Compute Engine Console.
  2. Click
  3. Leave all the options as the defaults, we aren't going to do anything with this machine, we just need to it to generate some data for us to monitor.
  4. Click
  5. Your instance should now be creating in the background.

Creating the Cloud SQL Instance

To create the Cloud SQL instance:

  1. Visit the SQL Console.
  2. Click
  3. Click
  4. Give your SQL instance an Instance ID, e.g. "my-cloud-db".
  5. Leave all the other options as the default values.
  6. Click
  7. Your SQL database will now create in the background.

We now have some resources that we can monitor!

Before we can use Stackdriver Monitoring, it must first be enabled for your project.

To use Stackdriver Monitoring with one of your projects, do the following:

  1. Visit the Stackdriver Monitoring Console, and click
  2. Select your project from the drop dropdown, and click
  3. You may be prompted to login with again, click Log in with Google, and then choose your account to login.

  1. Once logged in, Stackdriver will ask you to add the project to a Stackdriver account. Choose Create a new Stackdriver account, and click Continue.

  1. Click to create a Stackdriver account on this project
  2. Then add the project to the Stackdriver Monitoring. If the Continue button is disabled, refresh the page to retry.

  1. Select the project, and click Continue.
  2. If you use AWS, you can also monitor AWS resources with Stackdriver Monitoring. For this lab, skip this section, click Done.

  1. Stackdriver will then initialize, and once it's ready, click Launch monitoring.

You are now looking at the Stackdriver Monitoring Console. The information shown will vary depending on the Google (and AWS) services you are using and the monitoring features you have set up, but it will look something like the following:

Let's take an initial look at the monitoring dashboard, because there is a lot of good information here, right from the outset.

Uptime Checks

In the top left corner, you can see a list of current Uptime checks. This is likely to be empty at this stage, as we have yet to set any up. We will do that in a separate code lab.

Uptime checks let you quickly verify the health of any web page, instance, or group of resources. Each configured check is regularly contacted from a variety of locations around the world. Uptime checks can be used as conditions in alerting policy definitions.

Incidents

Within Stackdriver Monitoring you can set up alerting policies to define conditions that determine whether or not your cloud services and platforms are operating normally. Stackdriver Monitoring provides many different kinds of metrics and health checks that you can use in the policies.

When an alerting policy's conditions are violated, an incident is created and displayed on in the Incident section that can be found on the dashboard. Responders can acknowledge receipt of the notification and can close the incident when it has been taken care of.

There should be no incidents at this stage (thankfully!).

Event Log

At the bottom of the dashboard you will find the Event Log.

The Event Log is a list of events that have occurred in your project. This includes system events such as servers being created or being restarted, but you can also add your own message as an event, to keep a record not captured by the monitoring software.

Graphs and Charts

You will also find a variety of graphs and charts on the right hand side that will show you metrics, depending on what resources are currently utilised in your project.

Let's take a look at some of the deeper information we can find out about Compute Engine instances via Stackdriver Monitoring.

  1. At the left side of the page, click on Resources > Instances.
  2. You should see a list of the Google Compute Engine instances.
  3. Click on the link for the Compute Engine instance entitled "instance-1"

You will now be able to see, for this specific Compute Engine Instance:

  1. Any Uptime Checks on this instance
  2. The Event Log for this instance
  3. An overview of all it's details, including IP Addresses, Launch times, Volumes etc.
  4. Graphs of CPU Usage, Disk I/O and Network Traffic.

Let's also take a look at some of the deeper information we can find out about the Cloud SQL instance we created earlier.

  1. On the left side of the page, click on Resources > Cloud SQL.
  2. Under Inventory you will see a list of your databases - click on the one we created earlier, e.g. "my-cloud-db"

You will now be able to see for this specific Cloud SQL instance:

  1. Any Incidents that exist for this Database
  2. The Event Log for this instance
  3. Various settings for this Database, including its Settings, IP Configuration and Backup Configuration.

You are well on your way to having your Google Cloud Platform project monitored with Stackdriver Monitoring.

What we've covered

Next Steps

Learn More