Specifying Conditions

This page describes how to specify the conditions for an alerting policy.

To add a condition to an alerting policy, expand the Conditions dialog on the Create New Alerting Policy page, if necessary. Next, click the Add Condition button. There are tabs for metric, uptime-check, and process-health conditions. Use the scroll arrows on the tab header if you do not see the desired tab. After the desired tab is visible, select the tab:

Add or edit a condition

Target

The target describes a metric and a resource that you want the alerting policy to monitor.

Adding a metric target

Select the Metric tab.

If you are editing an existing metric condition, the fields in the Metric tab are populated. If you are adding a new metric condition, these fields are empty.

In the Find resource type and metric drop-down list, select the resource type that you want to monitor:

Select resource type

After you have selected the resource type, all available metrics for that resource type are presented. Scroll through the Metrics options and select the specific metric that you want your policy to monitor:

Select metric

After you select the resource type and metric, this page expands to display a chart and to provide fine-grained control for your alerting condition. See Configuring a Target Metric for details on the new options. For additional information:

Adding an uptime check target

The best way to create an alerting policy for an uptime check is to create the policy from the Monitoring > Uptime check page. In this case, the condition fields in the alerting policy are populated for you. See Alerting on Uptime Checks for details.

Adding a process-health target

The process-health condition triggers if the number of processes that match a specific pattern falls above, or below, a threshold during a duration window.

Select the Process health tab. Use the scroll arrow in the tab bar if necessary.

Select the Resource Type fields:

  • Use the right drop-down menu to select the resource type to be monitored.
  • Use the left drop-down menu to select a single resource, a group of resources or all resources.

Select the Command Line, Command and User filters' match type and a query fields:

  • The match types are: Equals, Contains, Starts with, Ends with, and Regex. The operations are case sensitive.
  • The syntax of the query is dependent upon the operation choice. You can use wildcards in queries. For example, the wildcard * matches any process.

The filters are combined using logical AND and logical OR as: (Command line AND Command) ORUser. If no value is provided for the query portion of the filter, then the filter matches all values. For example, if you only complete the Command line filter, then the combined filter simplifies to that filter.

As an example, to count the number of nginx processes owned by root, you can configure the Target region as shown:

Show root nginx

In the preceding figure, the graph shows an alerting threshold of 1 process and data for two instances. One instance has no processes that meet the filter conditions, and the other instance has two processes that meet the filter conditions.

The following table illustrates different settings:

Filter Match type Query
Command line Equals /sbin/init
Command line Starts With /bin/bash -c
Command line Ends with --alsologtostderr
Command line Regex .*\\d{4}.*
Command line Contains nginx
Command line Regex .*(nginx.*)
Command line Equals *
Command Equals /opt/local/bin/httpd
Command Equals /bin/start-process
Users Equals root
Users Equals apache

Title

The title field is required. It is automatically populated with information based on your selections for the Target information. You can change the default content to something more meaningful to you.

If you are creating an alerting policy as part of creating an uptime check, the Target selections are auto-filled. In this case, you must manually enter a condition title.

Configuration

The Configuration region describes the behavior of the target metric that is considered as meeting the policy condition. Use this to specify how many of time series in the target metric (some, all, a percentage) must have some relationship (above, below, etc.) to a threshold value for a time period:

Configuring the target metric

This configuration lets you specify whether the target metric participates in a metric-threshold or metric-absence condition.

When you have completed describing your condition, click the Save Condition button at the bottom of the page. This takes you back to the Add (or Edit) Alerting Policy page, from which you can:

Was this page helpful? Let us know how we did:

Send feedback about...

Stackdriver Monitoring