Managing alerting policies

Using the Google Cloud Console

An alerting policy describes a set of conditions that you want to monitor. These conditions might relate to the state of an unhealthy system or to resource consumption. For example, you might want to create a policy to monitor an uptime check, or to create a policy that monitors your Stackdriver Monitoring API usage. In addition to conditions, in an alerting policy, you can specify how you want to be notified and what documentation is included in that notification.

This page illustrates how to use the Stackdriver Monitoring console to create and manage an alerting policy. You can also use the Stackdriver Monitoring API to perform these tasks. For more information on this approach, see Managing alerting policies by API. To see policies represented in JSON, see Sample policies.

Before you begin

Before creating alerting policies, you should be familiar with the general concepts and terminology in alerting policies. This includes understanding the components of a policy, the concept of an incident, and pricing and limitations. See Introduction to alerting for more information.

Notification channels

Notification channels let you specify how you want to be informed of alerts. If a type of notification channel is configured, you have the option to select it when setting up notifications for your alerting policy.

For a list of notification channel types and channel configuration information, see Notification options.

Alerting policies on uptime checks

Create the alerting policy for an uptime check from the Uptime checks window. By following this guideline, most fields in the alerting policy are preconfigured:

Creating an alerting policy

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

    If you have never used Monitoring, then a Workspace is automatically created and your project is associated with that Workspace. Otherwise, if your project isn't associated with a Workspace, then a dialog appears and you can either create a new Workspace or add this project to an existing Workspace. After you make your selection, click Add. After the Workspace is created, you are automatically transitioned to Alerting.

  2. Select Alerting.

  3. Click Add Policy. The remainder of this section describe the four options in the Create New Alerting Policy:

    Create an alerting policy dialog is displayed.

  4. After you complete specifying the name, conditions, notification channels, and adding documentation, click Save.

Naming

In the Create New Alerting Policy window, enter a policy name.

The policy name is included in notifications, and it is displayed in the Policies window.

Conditions

Conditions describe what is being monitored and when an alerting policy is triggered. A policy can have up to 6 conditions.

To add an alerting condition to a policy, in the Create New Alerting Policy window, click Add Condition. For information on defining conditions, see Specifying conditions.

Notifications

Notification channels let you specify how you want to be informed of alerts. If you don't add at least one notification channel, then you aren't notified when an incident occurs. You can add multiple notification channels. For details on your choices of notification channels, see Notification options.

To add a notification channel, do the following:

  1. Click Add notification channel.
  2. Select the Notification Channel Type.
  3. You might need to complete additional fields. For example, if you select Email, then you are prompted for your email address.
  4. Click Add.

To add an additional notification channel to your policy, repeat the previous steps. Configuring at least two notification channel types increases reliability.

Documentation

Documentation is included in notifications to help you manage the failure condition. You can use Markdown to format your documentation, or use plain text.

For example, documentation might include a title such as Addressing High CPU Usage and details that identify the project:

   ## Addressing High CPU Usage

   This note contains information about high CPU Usage.

   You can include variables in the documentation. For example:

   This alert originated from the project ${project}, using
   the variable $${project}.

In addition to Markdown, you can use variables to pull information out of the policy itself to tailor the content of your documentation. For more information, see Using variables.

The variables are replaced by their values only in notifications. The Preview Markdown pane, and the other places in the Cloud Console that show the documentation, reflect only the Markdown formatting:

Example writing a documentation note using markdown.

You can also include channel-specific tagging to control notifications. For more information, see Using channel controls.

Managing policies

To list all alerting policies, do the following:

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

  2. Select Alerting.

  3. A partial list of policies is shown in the Policies pane. To see all policies and to enable filtering, click See all policies.

To view the details of an alerting policy, click on its name.

To restrict the alerting policies that are listed, add filters. Each filter is composed of a name and a value. You can set the value to be an exact match for a policy name, or a partial match. Matches are not case sensitive. If you have multiple filters, then the filters are automatically joined by a logical AND unless you insert an OR filter. The following screenshot list all alerting policies that matche test or My Uptime Check Alert Policy:

Sample alerts overview with filters.

From the Policies pane you can edit, delete, copy, enable, or disable an alerting policy:

  • To edit or copy a policy, click More , and select the corresponding option. Editing and copying a policy is similar to Creating an alerting policy. You can change, and in some cases, delete the values in the fields. When done, click Save.

  • To delete a policy, click More and select Delete. In the confirmation window, select Delete.

  • To turn on or off an alerting policy, click its toggle button.

If you select an alerting policy, then the Policy details are displayed. For example, the following screenshot illustrates the details for the alerting policy named My Uptime Check Alert Policy:

Sample alert-policy details page.

You can edit, delete, copy, enable, or disable an alerting policy from the Policy details window.

Using the Stackdriver Monitoring console

An alerting policy describes a set of conditions that you want to monitor. These conditions might relate to the state of an unhealthy system or to resource consumption. For example, you might want to create a policy to monitor an uptime check, or to create a policy that monitors your Stackdriver Monitoring API usage. In addition to conditions, in an alerting policy, you can specify how you want to be notified and what documentation is included in that notification.

This page illustrates how to use the Stackdriver Monitoring console to create and manage an alerting policy. You can also use the Stackdriver Monitoring API to perform these tasks; see Managing alerting policies by API for information on that approach. To see policies represented in JSON, see Sample policies.

Before you begin

Before creating alerting policies, you should be familiar with the general concepts and terminology in alerting policies. This includes understanding the components of a policy, the concept of an incident, and pricing and limitations. See Introduction to alerting for more information.

Setting up notification channels

Notification channels let you specify how you want to be informed of alerts. If a type of notification channel is configured, you have the option to select it when setting up notifications for your alerting policy. See Notification options for a list of available notification channel types and their configuration.

Alert policies on uptime checks

By creating an alerting policy for an uptime check from the Uptime checks window, the conditions field of the alerting policy are pre-populated for you.

  • To create an alerting policy for a new uptime check, see [Creating uptime checks][/monitoring/uptime-checks#create_sdv1] for information.

  • To create an alerting policy for an existing uptime check, see Alerting on uptime checks for more information.

Creating an alerting policy

  1. In the Google Cloud Console, choose your project from the drop-down list.

  2. Select Monitoring from the Google Cloud navigation menu .

    If you have never used Monitoring, then a Workspace is automatically created and your project is associated with that Workspace. Otherwise, if your project isn't associated with a Workspace, then a dialog appears and you can either create a new Workspace or add this project to an existing Workspace. After you make your selection, click Add.

    Go to Monitoring

  3. Go to Alerting > Create a Policy. The following sections describe the four options to customize your alerting policy.

    Alert-policy creation page

Conditions

Now that you have opened the Create New Alerting Policy window, the first step in defining your alerting policy is to add a condition. Conditions describe what is being monitored and when an alerting policy is triggered. A policy can have up to 6 conditions.

To add an alerting condition to a policy, in the Create New Alerting Policy window, click Add Condition. For information on defining conditions, see Specifying conditions.

Notifications

You have the option to add one or more notification channels to your alerting policy. Notification channels let you specify how you want to be informed of alerts. For details on your choices of notification channels, see Notification options.

Adding a notification channel to an alerting policy is optional. If you don't configure a notification channel for an alerting policy, then you won't be notified when an incident occurs. However, you can monitor the Stackdriver Monitoring dashboard for alerting policy conditions.

  1. In the Notification Channel Type drop-down list, select a notification channel, such as Google Cloud Console (mobile) or Email:

    Select notification channel

  2. Depending on the Notification Channel Type, you might need to complete additional fields. For example, if you select Email, you are prompted for your email address.

  3. Click Add Notification Channel.

  4. To add an additional notification channel to your policy, repeat the previous steps. Having at least two different types of notification channel increases reliability in case one is unavailable.

Documentation

You also have the option to add documentation to your alerting policy. Documentation is sent along with notifications to help the recipients handle the condition. You can use Markdown to format your documentation, or use plain text.

For example, documentation might include a title such as "Addressing High CPU Usage" and details that identify the project:

Writing documentation

In addition to Markdown, you can use variables to pull information out of the policy itself to tailor the content of your documentation. See Using variables for more information.

The variables are replaced by their values only in notifications. The Preview tab, and other places in the Stackdriver Monitoring console that show the documentation, reflect only the Markdown formatting:

Documentation preview tab

You can also include channel-specific tagging to control notifications. For more information, go to Using channel controls.

Finish creating the policy

  1. In the Create New Alerting Policy window, enter a policy name. The policy name is included in notifications, and it is displayed in the Policy overview pane.

    Naming the policy

  2. Click Save.

Managing policies

To view a summary of all alerting policies, do the following:

  1. In the Cloud Console, select Monitoring:

    Go to Monitoring

  2. Select Alerting > Policies overview.

The following screenshot shows a single policy from the overview page:

Alert-policy overview page

From this view, you can edit, delete, copy, enable, or disable an alerting policy.

  • To edit or copy a policy, click More, more_vert, and select the corresponding option. Editing and copying a policy is similar to Creating an alerting policy. You can change, and in some cases, delete the values in the fields. When done, click Save.

  • To delete a policy, click More, more_vert, and select Delete. In the confirmation window, select Delete.

  • To turn on or off an alerting policy, click its toggle button. You can enable or disable a policy from the Policies overview pane or from its dashboard.

Оцените, насколько информация на этой странице была вам полезна:

Оставить отзыв о...

Текущей странице
Stackdriver Monitoring