Get notified if your app stops responding

Learn how to get notified if your application stops responding to HTTP requests by completing the following tasks:

  1. Create an email notification channel.
  2. Create an uptime check and an alerting policy.
  3. View the uptime check dashboard.
  4. Force the uptime check to fail.
  5. View the email notification and the incident.
  6. Clean up.

To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:

Guide me


Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Cloud Monitoring API.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Cloud Monitoring API.

    Enable the API

Create an email notification channel

Before you create an alerting policy, configure the notification channels that you want the alerting policy to use. Cloud Monitoring supports many different types of notification channels, including email, Slack, PagerDuty, and Pub/Sub. For more information, see Create and manage notification channels. To get notifications by e-mail, do the following:
  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Alerting:

    Go to Alerting

  2. In the toolbar, click Edit Notification Channels.
  3. On the Notification channels page, scroll to Email, and then click Add new.
  4. Enter your email address, a display name such as My email, and then click Save.

Create an uptime check and alerting policy

To be notified when an application fails to respond to requests, configure an uptime check to send requests to the application, and then configure an alerting policy to monitor the responses to the uptime check:

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Uptime checks:

    Go to Uptime checks

  2. In the toolbar, click Create uptime check.
  3. For the Resource Type, select URL.
  4. For the Hostname, enter a valid URL for your company, or enter cloud.google.com.
  5. If you entered the URL for your company, leave the Path field empty. Otherwise, enter /monitoring/docs.

    The uptime check is configured to either send requests to the URL for your company, or to cloud.google.com/monitoring/docs.

  6. Click Continue to advance to the Response validation section.

    For information about these settings, see Validate response data.

  7. Click Continue to advance to the Alert & Notification section.
  8. Expand the Notification channels menu and select your notification channel.
  9. Click Continue to advance to the Review section.
  10. Enter a title, such as My check, for the uptime check.
  11. To verify your uptime check configuration, click Test.

    If you receive an error, see Verify your uptime check.

  12. Click Create.

Your uptime check and alerting policy are created, and your new uptime check is listed on the Uptime checks page.

View the uptime check dashboard

The Uptime checks page displays a list of your uptime checks and the status of each check. To view the detailed status of the uptime check you created, do the following:

  1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Uptime checks:

    Go to Uptime checks

  2. Click the name of the uptime check to open the uptime-check's dashboard.

    Because your uptime check hasn't executed, the charts are empty and the status for the uptime check is No checks have run.

  3. In the toolbar, enable auto-refresh on the charts by clicking Enable auto refresh.

  4. Wait until a few data points appear on the charts, and then refresh the page.

    When the status for each location is Pass, proceed to the next step. Otherwise, wait a minute and refresh the page to update the status pane.

Force the uptime check to fail

To force the uptime-check to fail, modify the Path such that the URL tested by the uptime check is invalid:

  1. In the toolbar, click Edit.
  2. In the Path field, append or enter HelloWorld.
  3. Click Save.
  4. In the toolbar, enable auto-refresh on the charts by clicking Enable auto refresh.
  5. Wait until the data points on the Passed Checks chart goes to zero, and then refresh the page.

    When the status for each location is Fail. proceed to the next step. Otherwise, wait a minute and refresh the page to update the status pane.

View the notification and incident

After the alerting policy determines that the uptime check has had two consecutive failures, Cloud Monitoring creates an incident and sends notifications. An incident is a record of an alerting policy that triggers, and it contains information that is useful for troubleshooting failures. To view the notification and incident, do the following:

  1. Open your email account, and view the message whose title starts with [ALERT] Failure of uptime check_id.
  2. To get details about the failure, in the notification, click View incident.

    The Incident details page opens in a new page of the Cloud console.

You have successfully created an uptime check and an alerting policy, you forced the uptime check to fail, and you've received a notification. You can now close the browser page that displays the Incident details page,

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

If you created a new project and you no longer need the project, then delete the project.

If you used an existing project, then do the following:

  1. Delete the uptime check that you created:

    1. In the navigation panel of the Google Cloud console, select Monitoring, and then select  Uptime checks:

      Go to Uptime checks

    2. Select the uptime check that you created, and then click Delete.

      When you delete an uptime check, you also delete the alerting policy that monitors that uptime check.

What's next