Uptime Checks is a service of Cloud Monitoring. You configure the service to check your system's health by sending requests to your applications, services, or URLs from various locations around the world. You can use the results of the checks as conditions in your alert policies, so you will be notified if system health is degraded.

An Alert Policy is a set of rules that determine whether your resources or groups are operating normally. The rules are logical conditions involving metric thresholds and uptime checks. For example, you can create a rule that your web site's average response latency must not exceed five seconds over a period of two minutes.

An alert occurs when an alert policy's conditions are met, causing an Incident to appear in the Incidents section of the Cloud Monitoring Console. Incidents remain open until the alert policy rules are no longer in violation or until the incident is manually closed.

You can associate notifications with alert policies. For example, alerts can send email or SMS notifications to people or services.

In this codelab, you'll learn how to create an Uptime check on a Compute Engine instance, attach an alerting policy to it, so that an incident from that policy will be created to notify you when the machine goes down.

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

Codelab-at-a-conference setup

The instructor will be sharing with you temporary accounts with existing projects that are already setup so you do not need to worry about enabling billing or any cost associated with running this codelab. Note that all these accounts will be disabled soon after the codelab is over.

Once you have received a temporary username / password to login from the instructor, log into Google Cloud Console: https://console.cloud.google.com/.

Here's what you should see once logged in :

Note the project ID you were assigned ( "codelab-test003" in the screenshot above). It will be referred to later in this codelab as PROJECT_ID.

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 a Compute Engine instance with NGINX through Cloud Launcher, so that we have a URL we can hit with a HTTP request to see if our resource is up and running.

To create the virtual machine:

  1. Visit the Cloud Launcher.
  2. Type "NGINX" i the search bar
  3. Click on the NGINX (Bitnami) options
  4. Click
  5. Leave all the options as the defaults, and click on
  6. The NGINX instance will now start up.
  7. We can leave this to continue in the background, while we move on to enabling Cloud Monitoring - so no need to watch it start up.

We now have a resource 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:

Now that monitoring is enabled, we want to create an Uptime Check. An uptime check is a process to make sure that a given resource is up and running all the time. There are a variety of ways that uptime checks can be made, including: HTTP, HTTPS, UDP and TCP.

For the purposes of this Code Lab, we will create a HTTP uptime check, to monitor our recently created NGINX web server.

To create the Uptime Check, click the "Create Check" button you will find on the monitoring dashboard:

From there, select the following options, so that the form looks like the below screenshot:

  1. Click to make sure that your Uptime Check works correctly. You should get back a
  2. Click to save your Uptime Check.
  3. Click "No Thanks" on the Alerting Policy question - we will do this in the next section.

Congratulations, You have now successfully created a Uptime Check!

You now have a Compute Engine instance that has it's uptime state monitored by a Uptime Check and a Alerting Policy

What we've covered

Next Steps

Learn More