This page illustrates using the Stackdriver Monitoring console to create, edit, and manage alerting policies.
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.
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.
Creating an alerting policy
To create an alerting policy, select your account (in the following screenshot, “A GCP Project”), then select Alerting > Create a Policy:
This brings up the new-policy page, which offers four numbered options:
- Name this policy
The following sections describe each of these options, though conditions are treated in more detail on additional pages.
Although the options are numbered on the page, they do not have to be addressed in any particular order. The configuration of notifications and documentation is optional.
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, click the Add Condition button. If the policy already has conditions, these are listed. Existing conditions can be edited or deleted:
When adding a condition, you see the Select condition type page. At the top of this page is an invitation to try a new variant of the UI for specifying conditions:
Trying the new UI (Beta)
Why try it?
The beta interface serves the same purpose as the current current interface, but your ability to precisely tailor metrics to your needs is much greater.
- You have access to options for filtering, alignment, and aggregation the Target metric that the other variant hides.
- You can more precisely specify the behavior the metric must exhibit for the condition to be met, in the Configuration area.
- You can create conditions based on custom and logs-based metrics.
- You have access to metadata-filtering options.
- You can edit conditions created with the API that cannot be edited with the current UI.
With the beta interface, you can create metric-absence conditions and most types of metric-threshold conditions.
You cannot create conditions based on uptime checks and process counts with this beta UI. These “health” policies are created using the current UI. You can also use the API.
If you create or edit conditions with the new UI, you may not be able to edit them with the current UI.
Staying with the current UI
If you decide not to try the new UI, you will continue to use the existing UI, which provides a number of condition types with many options set for you. See Specifying Conditions (GA) for information on this interface. If you opt in to the new UI, you can always change your mind.
Add notification channels
Notification channels let you specify how you want to be informed of alerts. To add optional notification channels to your policy, click the Add Notification button. This gives you a drop-down menu from which you can select available notification channels:
For details on these choices, see Notification Options.
The following screenshot shows the configuration of a simple email notification:
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 Another Notification button.
Documentation is sent along with notifications to help the receipients handle the condition. To add optional documentation, click the Add Documentation button. This gives you an editable field for a documentation template.
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
To name your policy, enter a name in the field under the header Name this policy:
Save the policy
When you are ready to save your policy, click the Save Policy button at the bottom of the page.
To manage a policy, select your account, 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 Edit button. This brings up the Edit alerting policy page, which works exactly like the page for creating policies, described in Creating an alerting policy.
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.