Using Uptime Checks

Stackdriver can verify the availability of your service by accessing it from locations around the world. You can use the results from these uptime checks in your alerting policies, or you can directly monitor the results in the Stackdriver Monitoring uptime-check dashboards.

This page shows you how to do the following:

  • Review the status of your uptime checks.
  • Use uptime checks in alerting policies.
  • Get a list of IP addresses used by uptime checks.

To create, update, and delete your uptime checks, see the Managing Uptime Checks page.

Before you begin

Your use of uptime checks is affected by your Stackdriver service tier and by any firewalls protecting your service.

Service tiers. Uptime checks are available to both Basic Tier and Premium Tier Stackdriver accounts, but uptime checks in Premium Tier accounts have some added information, including the Uptime Percentage value for individual checks. For more information about service tiers, see Stackdriver Pricing.

Firewalls. If the resource you are checking is not publicly available, you must configure the resource's firewall to permit incoming traffic from the uptime-check servers. See Getting IP addresses to download a list of the IP addresses.

Reviewing uptime checks

Stackdriver Monitoring has an overview that displays all your uptime checks, and detailed dashboards for individual checks.

Overview

To see the overview, go to Uptime Checks > Uptime Checks Overview:

Go to Uptime Checks Overview

For each uptime check, you can see the last check result from each location, as shown in the following screenshot:

Uptime checks monitor

Dashboards

To get the detailed status of a single uptime check, click on any of the checks in the overview or in the list in the Uptime Checks menu in the left-side navigation. Following is a sample dashboard:

Uptime check details

API

To retrieve your existing uptime check configurations, use projects.uptimeCheckConfigs.list.

In the API, uptime checks are identified by their [UPTIME_CHECK_ID], which is a respelling of the uptime check's name. For example, the dashboard check name "my uptime check" might become the ID "my-uptime-check", or the mapping might be more complicated.

You assign the name that you see in the Uptime Overview in the Stackdriver Monitoring Console.

Uptime percentage

Premium Tier Stackdriver accounts display Uptime for each uptime check. Uptime is a percentage calculated as (S/T)*100, where S is the number of successful check responses and T is the total number of check responses, from all locations.

For group checks, the values of S and T are summed across all current group members.

For example, over a 25 minute period, an uptime check with a default configuration would get 25 requests from each of 6 locations, for a total of 150 requests. If the dashboard reports an 83.3% uptime, that means 25 of 150 requests failed.

Using uptime checks in alerting policies

For details about alerting policies, see Introduction to Alerting.

To create an alerting policy that will trigger when an uptime check fails, do the following:

  1. Create the uptime check. For details, see Creating an uptime check.

  2. Go to Alerting > Create a Policy:

    Go to Create New Alerting Policy

  3. In the Conditions Section, choose the condition Basic Health > Uptime Check Health.

  4. Choose the uptime check to use and supply any other needed information.

  5. Complete the alerting policy.

Getting uptime-check IP addresses

If you are checking a service that is behind a firewall, you can configure your service's firewall to accept traffic from the current set of IP addresses used for uptime checking. To get the IP addresses, use the following instructions:

Console

1. Go to the Uptime Checks page for your project.

  1. In the More menu next to Add Uptime Check, select Download Source IPs:

    Uptime check download IPs

API

  1. Call the uptimeCheckIps.list method of the Stackdriver Monitoring API.

  2. The method returns the following information for each IP address:

    • The region: USA, EUROPE, SOUTH_AMERICA, or ASIA_PACIFIC.
    • A more specific location within the region.
    • The IP address, not a range, in IPv4 or IPv6 format.

Node.js

For more on installing and creating a Stackdriver Monitoring client, refer to Stackdriver Monitoring Client Libraries.

// Imports the Google Cloud client library
const monitoring = require('@google-cloud/monitoring');

// Creates a client
const client = new monitoring.UptimeCheckServiceClient();

// List uptime check IPs
client
  .listUptimeCheckIps()
  .then(results => {
    const uptimeCheckIps = results[0];
    uptimeCheckIps.forEach(uptimeCheckIp => {
      console.log(
        uptimeCheckIp.region,
        uptimeCheckIp.location,
        uptimeCheckIp.ipAddress
      );
    });
  })
  .catch(err => {
    console.error('ERROR:', err);
  });

The returned information typically contains about 20 IP addresses. Uptime checks can come from any of the IP addresses, but only one address from each geographic location is used for each time interval. The geographic locations are listed in the uptime checks dashboard, shown in the previous section. You can also use free, web-based services to identify the registered locations of the IP addresses you downloaded.

The IP addresses used by uptime checking might change, but typically not more than once per quarter and not without an announcement.

Identifying uptime check traffic

You can identify requests from the uptime-check servers by the following information in your service's request logs:

  • ip: The ip field contains one of the addresses used by the uptime-check servers. See Getting IP addresses.
  • User-Agent: The User-Agent header value is always the following:

    GoogleStackdriverMonitoring-UptimeChecks(https://cloud.google.com/monitoring)
    

    Specifying a User-Agent custom header results in a form validation error and prevents the check configuration from being saved.

Send feedback about...

Stackdriver Monitoring