AlertPolicyArgs

data class AlertPolicyArgs(val alertStrategy: Output<AlertPolicyAlertStrategyArgs>? = null, val combiner: Output<String>? = null, val conditions: Output<List<AlertPolicyConditionArgs>>? = null, val displayName: Output<String>? = null, val documentation: Output<AlertPolicyDocumentationArgs>? = null, val enabled: Output<Boolean>? = null, val notificationChannels: Output<List<String>>? = null, val project: Output<String>? = null, val userLabels: Output<Map<String, String>>? = null) : ConvertibleToJava<AlertPolicyArgs>

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}}

Constructors

Link copied to clipboard
constructor(alertStrategy: Output<AlertPolicyAlertStrategyArgs>? = null, combiner: Output<String>? = null, conditions: Output<List<AlertPolicyConditionArgs>>? = null, displayName: Output<String>? = null, documentation: Output<AlertPolicyDocumentationArgs>? = null, enabled: Output<Boolean>? = null, notificationChannels: Output<List<String>>? = null, project: Output<String>? = null, userLabels: Output<Map<String, String>>? = null)

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>? = null

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
val displayName: Output<String>? = null

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>? = null

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

Link copied to clipboard
val notificationChannels: Output<List<String>>? = null

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>? = null

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 userLabels: Output<Map<String, String>>? = null

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.

Functions

Link copied to clipboard
open override fun toJava(): AlertPolicyArgs