An alerting policy describes a set of conditions indicating a potentially unhealthy status in your system. Alerting policies can reference notification channels, which let you specify how you want to be informed that an alerting policy has been triggered. Alerting policies can also include documentation that will assist responders in handling the situation.
This page illustrates using the Stackdriver Monitoring console to create and manage an alerting policy. These tasks can also be performed by using the Stackdriver Monitoring API; 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 used with alerting policies; see Introduction to Alerting for more information.
Alert policies on uptime checks
You cannot create an uptime check from the alerting dialog. You must create the uptime check from the Monitoring > Uptime check page. See Creating uptime checks for details on creating an uptime check.
To create an alerting policy for an existing uptime check, create the policy from the Monitoring > Uptime check page. With this approach, the condition fields in the alerting policy are populated for you. See Alerting on uptime checks for details.
Creating an alerting policy
On the Google Cloud Platform Console, choose your project from the drop-down list and select Stackdriver > Monitoring from the menu on the left side. If this is the first time you've used the project in Stackdriver, you must create a Workspace. See Getting a Workspace quickly for details.
From the Monitoring console, select Alerting > Create a Policy:
This brings up the Create New Alerting Policy page, which offers four options:
The following sections describe each of these options.
Conditions describe the circumstances under which the policy will be triggered. A policy can have up to 6 conditions.
To add an alerting condition to a policy, expand the Conditions dialog on the Create New Alerting Policy page. Next, click the Add Condition button to bring up the following page:
For detailed information on how to select the resource type, the metric and the configuration, see Specifying Conditions.
Notification channels let you specify how you want to be informed of alerts. Configuring a notification channel is optional. If you do not configure a notification channel for an alert policy, then you will not be notified when an incident occurs. However, you can monitor the Stackdriver Monitoring dashboard for alert conditions.
To add a notification channel to your policy, click Add Notification Channel:
Click the drop-down icon and select a notification channel:
After you have selected the channel, the UI asks you for additional information that is specific to the type of channel you selected. For example, if you selected Email, the UI presents the button Add Email Address. Click this button and enter your information:
See Notification Options for details on your choices of notification channels.
You can use multiple notification channels in a policy. Having at least two different types of notification channel increases reliability in case one is unavailable. To add additional channels, click the Add Notification Channel button.
Documentation is optional information that is sent along with notifications to help the recipients handle the condition. You can use Markdown in this field to format your documentation. For example:
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. You can also include channel-specific tagging to control notifications. See Using channel controls for more information.
Name the policy
On the Name this policy pane, enter a policy name:
Save the policy
When you are ready to save your policy, click the Save button at the bottom of the page.
To manage a policy, select your Workspace, then select Alerting > Policies Overview. This brings up a summary of all the policies, along with the status of the policy and any incidents. The following screenshot shows a single policy from the overview:
From the Overview page, you can edit, copy, or delete policies.
To edit a policy, click the vertical ellipses, Creating an alerting policy. The main difference is that when you create an alerting policy, you must select values for all of the fields. When you are editing an existing policy, some, or all of the fields in the policy already have a value. You can change, and in some cases, delete these values., and select Edit. This brings up the Edit Alerting Policy page. Editing a policy is similar to the process of
From the Overview pages, you can also enable or disable policies. Each policy has an On/Off button next to it. Click the button to toggle the state of the alerting policy.