AlertPolicy

class AlertPolicy : KotlinCustomResource

A description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state. To get more information about AlertPolicy, see:

Example Usage

Monitoring Alert Policy Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.monitoring.AlertPolicy;
import com.pulumi.gcp.monitoring.AlertPolicyArgs;
import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionArgs;
import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionConditionThresholdArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var alertPolicy = new AlertPolicy("alertPolicy", AlertPolicyArgs.builder()
.combiner("OR")
.conditions(AlertPolicyConditionArgs.builder()
.conditionThreshold(AlertPolicyConditionConditionThresholdArgs.builder()
.aggregations(AlertPolicyConditionConditionThresholdAggregationArgs.builder()
.alignmentPeriod("60s")
.perSeriesAligner("ALIGN_RATE")
.build())
.comparison("COMPARISON_GT")
.duration("60s")
.filter("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"")
.build())
.displayName("test condition")
.build())
.displayName("My Alert Policy")
.userLabels(Map.of("foo", "bar"))
.build());
}
}

Monitoring Alert Policy Evaluation Missing Data

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.monitoring.AlertPolicy;
import com.pulumi.gcp.monitoring.AlertPolicyArgs;
import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionArgs;
import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionConditionThresholdArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var alertPolicy = new AlertPolicy("alertPolicy", AlertPolicyArgs.builder()
.combiner("OR")
.conditions(AlertPolicyConditionArgs.builder()
.conditionThreshold(AlertPolicyConditionConditionThresholdArgs.builder()
.aggregations(AlertPolicyConditionConditionThresholdAggregationArgs.builder()
.alignmentPeriod("60s")
.perSeriesAligner("ALIGN_RATE")
.build())
.comparison("COMPARISON_GT")
.duration("60s")
.evaluationMissingData("EVALUATION_MISSING_DATA_INACTIVE")
.filter("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"")
.build())
.displayName("test condition")
.build())
.displayName("My Alert Policy")
.userLabels(Map.of("foo", "bar"))
.build());
}
}

Monitoring Alert Policy Forecast Options

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.monitoring.AlertPolicy;
import com.pulumi.gcp.monitoring.AlertPolicyArgs;
import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionArgs;
import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionConditionThresholdArgs;
import com.pulumi.gcp.monitoring.inputs.AlertPolicyConditionConditionThresholdForecastOptionsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var alertPolicy = new AlertPolicy("alertPolicy", AlertPolicyArgs.builder()
.combiner("OR")
.conditions(AlertPolicyConditionArgs.builder()
.conditionThreshold(AlertPolicyConditionConditionThresholdArgs.builder()
.aggregations(AlertPolicyConditionConditionThresholdAggregationArgs.builder()
.alignmentPeriod("60s")
.perSeriesAligner("ALIGN_RATE")
.build())
.comparison("COMPARISON_GT")
.duration("60s")
.filter("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"")
.forecastOptions(AlertPolicyConditionConditionThresholdForecastOptionsArgs.builder()
.forecastHorizon("3600s")
.build())
.build())
.displayName("test condition")
.build())
.displayName("My Alert Policy")
.userLabels(Map.of("foo", "bar"))
.build());
}
}

Import

AlertPolicy can be imported using any of these accepted formats:

$ pulumi import gcp:monitoring/alertPolicy:AlertPolicy default {{name}}

Properties

Link copied to clipboard

Control over how this alert policy's notification channels are notified. Structure is documented below.

Link copied to clipboard
val combiner: Output<String>

How to combine the results of multiple conditions to determine if an incident should be opened. Possible values are: AND, OR, AND_WITH_MATCHING_RESOURCE.

Link copied to clipboard

A list of conditions for the policy. The conditions are combined by AND or OR according to the combiner field. If the combined conditions evaluate to true, then an incident is created. A policy can have from one to six conditions. Structure is documented below.

Link copied to clipboard

A read-only record of the creation of the alerting policy. If provided in a call to create or update, this field will be ignored. Structure is documented below.

Link copied to clipboard
val displayName: Output<String>

A short name or phrase used to identify the policy in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple policies in the same project. The name is limited to 512 Unicode characters.

Link copied to clipboard

Documentation that is included with notifications and incidents related to this policy. Best practice is for the documentation to include information to help responders understand, mitigate, escalate, and correct the underlying problems detected by the alerting policy. Notification channels that have limited capacity might not show this documentation. Structure is documented below.

Link copied to clipboard
val enabled: Output<Boolean>?

Whether or not the policy is enabled. The default is true.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

(Output) The unique resource name for this condition. Its syntax is: projects/PROJECT_ID/alertPolicies/POLICY_ID/conditions/CONDITION_ID is assigned by Stackdriver Monitoring when the condition is created as part of a new or updated alerting policy.

Link copied to clipboard

Identifies the notification channels to which notifications should be sent when incidents are opened or closed or when new violations occur on an already opened incident. Each element of this array corresponds to the name field in each of the NotificationChannel objects that are returned from the notificationChannels.list method. The syntax of the entries in this field is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]

Link copied to clipboard
val project: Output<String>

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val userLabels: Output<Map<String, String>>?

This field is intended to be used for organizing and identifying the AlertPolicy objects.The field can contain up to 64 entries. Each key and value is limited to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values can contain only lowercase letters, numerals, underscores, and dashes. Keys must begin with a letter.