com.pulumi.gcp.monitoring.kotlin.AlertPolicyArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.monitoring.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.monitoring.AlertPolicyArgs.builder
import com.pulumi.gcp.monitoring.kotlin.inputs.AlertPolicyAlertStrategyArgs
import com.pulumi.gcp.monitoring.kotlin.inputs.AlertPolicyAlertStrategyArgsBuilder
import com.pulumi.gcp.monitoring.kotlin.inputs.AlertPolicyConditionArgs
import com.pulumi.gcp.monitoring.kotlin.inputs.AlertPolicyConditionArgsBuilder
import com.pulumi.gcp.monitoring.kotlin.inputs.AlertPolicyDocumentationArgs
import com.pulumi.gcp.monitoring.kotlin.inputs.AlertPolicyDocumentationArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* 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:
* * [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.alertPolicies)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/monitoring/alerts/)
* ## Example Usage
* ### Monitoring Alert Policy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const alertPolicy = new gcp.monitoring.AlertPolicy("alert_policy", {
* displayName: "My Alert Policy",
* combiner: "OR",
* conditions: [{
* displayName: "test condition",
* conditionThreshold: {
* filter: "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* duration: "60s",
* comparison: "COMPARISON_GT",
* aggregations: [{
* alignmentPeriod: "60s",
* perSeriesAligner: "ALIGN_RATE",
* }],
* },
* }],
* userLabels: {
* foo: "bar",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* alert_policy = gcp.monitoring.AlertPolicy("alert_policy",
* display_name="My Alert Policy",
* combiner="OR",
* conditions=[gcp.monitoring.AlertPolicyConditionArgs(
* display_name="test condition",
* condition_threshold=gcp.monitoring.AlertPolicyConditionConditionThresholdArgs(
* filter="metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* duration="60s",
* comparison="COMPARISON_GT",
* aggregations=[gcp.monitoring.AlertPolicyConditionConditionThresholdAggregationArgs(
* alignment_period="60s",
* per_series_aligner="ALIGN_RATE",
* )],
* ),
* )],
* user_labels={
* "foo": "bar",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var alertPolicy = new Gcp.Monitoring.AlertPolicy("alert_policy", new()
* {
* DisplayName = "My Alert Policy",
* Combiner = "OR",
* Conditions = new[]
* {
* new Gcp.Monitoring.Inputs.AlertPolicyConditionArgs
* {
* DisplayName = "test condition",
* ConditionThreshold = new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdArgs
* {
* Filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* Duration = "60s",
* Comparison = "COMPARISON_GT",
* Aggregations = new[]
* {
* new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdAggregationArgs
* {
* AlignmentPeriod = "60s",
* PerSeriesAligner = "ALIGN_RATE",
* },
* },
* },
* },
* },
* UserLabels =
* {
* { "foo", "bar" },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := monitoring.NewAlertPolicy(ctx, "alert_policy", &monitoring.AlertPolicyArgs{
* DisplayName: pulumi.String("My Alert Policy"),
* Combiner: pulumi.String("OR"),
* Conditions: monitoring.AlertPolicyConditionArray{
* &monitoring.AlertPolicyConditionArgs{
* DisplayName: pulumi.String("test condition"),
* ConditionThreshold: &monitoring.AlertPolicyConditionConditionThresholdArgs{
* Filter: pulumi.String("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""),
* Duration: pulumi.String("60s"),
* Comparison: pulumi.String("COMPARISON_GT"),
* Aggregations: monitoring.AlertPolicyConditionConditionThresholdAggregationArray{
* &monitoring.AlertPolicyConditionConditionThresholdAggregationArgs{
* AlignmentPeriod: pulumi.String("60s"),
* PerSeriesAligner: pulumi.String("ALIGN_RATE"),
* },
* },
* },
* },
* },
* UserLabels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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()
* .displayName("My Alert Policy")
* .combiner("OR")
* .conditions(AlertPolicyConditionArgs.builder()
* .displayName("test condition")
* .conditionThreshold(AlertPolicyConditionConditionThresholdArgs.builder()
* .filter("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"")
* .duration("60s")
* .comparison("COMPARISON_GT")
* .aggregations(AlertPolicyConditionConditionThresholdAggregationArgs.builder()
* .alignmentPeriod("60s")
* .perSeriesAligner("ALIGN_RATE")
* .build())
* .build())
* .build())
* .userLabels(Map.of("foo", "bar"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* alertPolicy:
* type: gcp:monitoring:AlertPolicy
* name: alert_policy
* properties:
* displayName: My Alert Policy
* combiner: OR
* conditions:
* - displayName: test condition
* conditionThreshold:
* filter: metric.type="compute.googleapis.com/instance/disk/write_bytes_count" AND resource.type="gce_instance"
* duration: 60s
* comparison: COMPARISON_GT
* aggregations:
* - alignmentPeriod: 60s
* perSeriesAligner: ALIGN_RATE
* userLabels:
* foo: bar
* ```
*
* ### Monitoring Alert Policy Evaluation Missing Data
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const alertPolicy = new gcp.monitoring.AlertPolicy("alert_policy", {
* displayName: "My Alert Policy",
* combiner: "OR",
* conditions: [{
* displayName: "test condition",
* conditionThreshold: {
* filter: "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* duration: "60s",
* comparison: "COMPARISON_GT",
* aggregations: [{
* alignmentPeriod: "60s",
* perSeriesAligner: "ALIGN_RATE",
* }],
* evaluationMissingData: "EVALUATION_MISSING_DATA_INACTIVE",
* },
* }],
* userLabels: {
* foo: "bar",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* alert_policy = gcp.monitoring.AlertPolicy("alert_policy",
* display_name="My Alert Policy",
* combiner="OR",
* conditions=[gcp.monitoring.AlertPolicyConditionArgs(
* display_name="test condition",
* condition_threshold=gcp.monitoring.AlertPolicyConditionConditionThresholdArgs(
* filter="metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* duration="60s",
* comparison="COMPARISON_GT",
* aggregations=[gcp.monitoring.AlertPolicyConditionConditionThresholdAggregationArgs(
* alignment_period="60s",
* per_series_aligner="ALIGN_RATE",
* )],
* evaluation_missing_data="EVALUATION_MISSING_DATA_INACTIVE",
* ),
* )],
* user_labels={
* "foo": "bar",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var alertPolicy = new Gcp.Monitoring.AlertPolicy("alert_policy", new()
* {
* DisplayName = "My Alert Policy",
* Combiner = "OR",
* Conditions = new[]
* {
* new Gcp.Monitoring.Inputs.AlertPolicyConditionArgs
* {
* DisplayName = "test condition",
* ConditionThreshold = new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdArgs
* {
* Filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* Duration = "60s",
* Comparison = "COMPARISON_GT",
* Aggregations = new[]
* {
* new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdAggregationArgs
* {
* AlignmentPeriod = "60s",
* PerSeriesAligner = "ALIGN_RATE",
* },
* },
* EvaluationMissingData = "EVALUATION_MISSING_DATA_INACTIVE",
* },
* },
* },
* UserLabels =
* {
* { "foo", "bar" },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := monitoring.NewAlertPolicy(ctx, "alert_policy", &monitoring.AlertPolicyArgs{
* DisplayName: pulumi.String("My Alert Policy"),
* Combiner: pulumi.String("OR"),
* Conditions: monitoring.AlertPolicyConditionArray{
* &monitoring.AlertPolicyConditionArgs{
* DisplayName: pulumi.String("test condition"),
* ConditionThreshold: &monitoring.AlertPolicyConditionConditionThresholdArgs{
* Filter: pulumi.String("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""),
* Duration: pulumi.String("60s"),
* Comparison: pulumi.String("COMPARISON_GT"),
* Aggregations: monitoring.AlertPolicyConditionConditionThresholdAggregationArray{
* &monitoring.AlertPolicyConditionConditionThresholdAggregationArgs{
* AlignmentPeriod: pulumi.String("60s"),
* PerSeriesAligner: pulumi.String("ALIGN_RATE"),
* },
* },
* EvaluationMissingData: pulumi.String("EVALUATION_MISSING_DATA_INACTIVE"),
* },
* },
* },
* UserLabels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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()
* .displayName("My Alert Policy")
* .combiner("OR")
* .conditions(AlertPolicyConditionArgs.builder()
* .displayName("test condition")
* .conditionThreshold(AlertPolicyConditionConditionThresholdArgs.builder()
* .filter("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"")
* .duration("60s")
* .comparison("COMPARISON_GT")
* .aggregations(AlertPolicyConditionConditionThresholdAggregationArgs.builder()
* .alignmentPeriod("60s")
* .perSeriesAligner("ALIGN_RATE")
* .build())
* .evaluationMissingData("EVALUATION_MISSING_DATA_INACTIVE")
* .build())
* .build())
* .userLabels(Map.of("foo", "bar"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* alertPolicy:
* type: gcp:monitoring:AlertPolicy
* name: alert_policy
* properties:
* displayName: My Alert Policy
* combiner: OR
* conditions:
* - displayName: test condition
* conditionThreshold:
* filter: metric.type="compute.googleapis.com/instance/disk/write_bytes_count" AND resource.type="gce_instance"
* duration: 60s
* comparison: COMPARISON_GT
* aggregations:
* - alignmentPeriod: 60s
* perSeriesAligner: ALIGN_RATE
* evaluationMissingData: EVALUATION_MISSING_DATA_INACTIVE
* userLabels:
* foo: bar
* ```
*
* ### Monitoring Alert Policy Forecast Options
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const alertPolicy = new gcp.monitoring.AlertPolicy("alert_policy", {
* displayName: "My Alert Policy",
* combiner: "OR",
* conditions: [{
* displayName: "test condition",
* conditionThreshold: {
* filter: "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* duration: "60s",
* forecastOptions: {
* forecastHorizon: "3600s",
* },
* comparison: "COMPARISON_GT",
* aggregations: [{
* alignmentPeriod: "60s",
* perSeriesAligner: "ALIGN_RATE",
* }],
* },
* }],
* userLabels: {
* foo: "bar",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* alert_policy = gcp.monitoring.AlertPolicy("alert_policy",
* display_name="My Alert Policy",
* combiner="OR",
* conditions=[gcp.monitoring.AlertPolicyConditionArgs(
* display_name="test condition",
* condition_threshold=gcp.monitoring.AlertPolicyConditionConditionThresholdArgs(
* filter="metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* duration="60s",
* forecast_options=gcp.monitoring.AlertPolicyConditionConditionThresholdForecastOptionsArgs(
* forecast_horizon="3600s",
* ),
* comparison="COMPARISON_GT",
* aggregations=[gcp.monitoring.AlertPolicyConditionConditionThresholdAggregationArgs(
* alignment_period="60s",
* per_series_aligner="ALIGN_RATE",
* )],
* ),
* )],
* user_labels={
* "foo": "bar",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var alertPolicy = new Gcp.Monitoring.AlertPolicy("alert_policy", new()
* {
* DisplayName = "My Alert Policy",
* Combiner = "OR",
* Conditions = new[]
* {
* new Gcp.Monitoring.Inputs.AlertPolicyConditionArgs
* {
* DisplayName = "test condition",
* ConditionThreshold = new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdArgs
* {
* Filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
* Duration = "60s",
* ForecastOptions = new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdForecastOptionsArgs
* {
* ForecastHorizon = "3600s",
* },
* Comparison = "COMPARISON_GT",
* Aggregations = new[]
* {
* new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdAggregationArgs
* {
* AlignmentPeriod = "60s",
* PerSeriesAligner = "ALIGN_RATE",
* },
* },
* },
* },
* },
* UserLabels =
* {
* { "foo", "bar" },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := monitoring.NewAlertPolicy(ctx, "alert_policy", &monitoring.AlertPolicyArgs{
* DisplayName: pulumi.String("My Alert Policy"),
* Combiner: pulumi.String("OR"),
* Conditions: monitoring.AlertPolicyConditionArray{
* &monitoring.AlertPolicyConditionArgs{
* DisplayName: pulumi.String("test condition"),
* ConditionThreshold: &monitoring.AlertPolicyConditionConditionThresholdArgs{
* Filter: pulumi.String("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""),
* Duration: pulumi.String("60s"),
* ForecastOptions: &monitoring.AlertPolicyConditionConditionThresholdForecastOptionsArgs{
* ForecastHorizon: pulumi.String("3600s"),
* },
* Comparison: pulumi.String("COMPARISON_GT"),
* Aggregations: monitoring.AlertPolicyConditionConditionThresholdAggregationArray{
* &monitoring.AlertPolicyConditionConditionThresholdAggregationArgs{
* AlignmentPeriod: pulumi.String("60s"),
* PerSeriesAligner: pulumi.String("ALIGN_RATE"),
* },
* },
* },
* },
* },
* UserLabels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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()
* .displayName("My Alert Policy")
* .combiner("OR")
* .conditions(AlertPolicyConditionArgs.builder()
* .displayName("test condition")
* .conditionThreshold(AlertPolicyConditionConditionThresholdArgs.builder()
* .filter("metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"")
* .duration("60s")
* .forecastOptions(AlertPolicyConditionConditionThresholdForecastOptionsArgs.builder()
* .forecastHorizon("3600s")
* .build())
* .comparison("COMPARISON_GT")
* .aggregations(AlertPolicyConditionConditionThresholdAggregationArgs.builder()
* .alignmentPeriod("60s")
* .perSeriesAligner("ALIGN_RATE")
* .build())
* .build())
* .build())
* .userLabels(Map.of("foo", "bar"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* alertPolicy:
* type: gcp:monitoring:AlertPolicy
* name: alert_policy
* properties:
* displayName: My Alert Policy
* combiner: OR
* conditions:
* - displayName: test condition
* conditionThreshold:
* filter: metric.type="compute.googleapis.com/instance/disk/write_bytes_count" AND resource.type="gce_instance"
* duration: 60s
* forecastOptions:
* forecastHorizon: 3600s
* comparison: COMPARISON_GT
* aggregations:
* - alignmentPeriod: 60s
* perSeriesAligner: ALIGN_RATE
* userLabels:
* foo: bar
* ```
*
* ### Monitoring Alert Policy Promql Condition
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const alertPolicy = new gcp.monitoring.AlertPolicy("alert_policy", {
* displayName: "My Alert Policy",
* combiner: "OR",
* conditions: [{
* displayName: "test condition",
* conditionPrometheusQueryLanguage: {
* query: "compute_googleapis_com:instance_cpu_usage_time > 0",
* duration: "60s",
* evaluationInterval: "60s",
* alertRule: "AlwaysOn",
* ruleGroup: "a test",
* },
* }],
* alertStrategy: {
* autoClose: "1800s",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* alert_policy = gcp.monitoring.AlertPolicy("alert_policy",
* display_name="My Alert Policy",
* combiner="OR",
* conditions=[gcp.monitoring.AlertPolicyConditionArgs(
* display_name="test condition",
* condition_prometheus_query_language=gcp.monitoring.AlertPolicyConditionConditionPrometheusQueryLanguageArgs(
* query="compute_googleapis_com:instance_cpu_usage_time > 0",
* duration="60s",
* evaluation_interval="60s",
* alert_rule="AlwaysOn",
* rule_group="a test",
* ),
* )],
* alert_strategy=gcp.monitoring.AlertPolicyAlertStrategyArgs(
* auto_close="1800s",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var alertPolicy = new Gcp.Monitoring.AlertPolicy("alert_policy", new()
* {
* DisplayName = "My Alert Policy",
* Combiner = "OR",
* Conditions = new[]
* {
* new Gcp.Monitoring.Inputs.AlertPolicyConditionArgs
* {
* DisplayName = "test condition",
* ConditionPrometheusQueryLanguage = new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionPrometheusQueryLanguageArgs
* {
* Query = "compute_googleapis_com:instance_cpu_usage_time > 0",
* Duration = "60s",
* EvaluationInterval = "60s",
* AlertRule = "AlwaysOn",
* RuleGroup = "a test",
* },
* },
* },
* AlertStrategy = new Gcp.Monitoring.Inputs.AlertPolicyAlertStrategyArgs
* {
* AutoClose = "1800s",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/monitoring"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := monitoring.NewAlertPolicy(ctx, "alert_policy", &monitoring.AlertPolicyArgs{
* DisplayName: pulumi.String("My Alert Policy"),
* Combiner: pulumi.String("OR"),
* Conditions: monitoring.AlertPolicyConditionArray{
* &monitoring.AlertPolicyConditionArgs{
* DisplayName: pulumi.String("test condition"),
* ConditionPrometheusQueryLanguage: &monitoring.AlertPolicyConditionConditionPrometheusQueryLanguageArgs{
* Query: pulumi.String("compute_googleapis_com:instance_cpu_usage_time > 0"),
* Duration: pulumi.String("60s"),
* EvaluationInterval: pulumi.String("60s"),
* AlertRule: pulumi.String("AlwaysOn"),
* RuleGroup: pulumi.String("a test"),
* },
* },
* },
* AlertStrategy: &monitoring.AlertPolicyAlertStrategyArgs{
* AutoClose: pulumi.String("1800s"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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.AlertPolicyConditionConditionPrometheusQueryLanguageArgs;
* import com.pulumi.gcp.monitoring.inputs.AlertPolicyAlertStrategyArgs;
* 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()
* .displayName("My Alert Policy")
* .combiner("OR")
* .conditions(AlertPolicyConditionArgs.builder()
* .displayName("test condition")
* .conditionPrometheusQueryLanguage(AlertPolicyConditionConditionPrometheusQueryLanguageArgs.builder()
* .query("compute_googleapis_com:instance_cpu_usage_time > 0")
* .duration("60s")
* .evaluationInterval("60s")
* .alertRule("AlwaysOn")
* .ruleGroup("a test")
* .build())
* .build())
* .alertStrategy(AlertPolicyAlertStrategyArgs.builder()
* .autoClose("1800s")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* alertPolicy:
* type: gcp:monitoring:AlertPolicy
* name: alert_policy
* properties:
* displayName: My Alert Policy
* combiner: OR
* conditions:
* - displayName: test condition
* conditionPrometheusQueryLanguage:
* query: compute_googleapis_com:instance_cpu_usage_time > 0
* duration: 60s
* evaluationInterval: 60s
* alertRule: AlwaysOn
* ruleGroup: a test
* alertStrategy:
* autoClose: 1800s
* ```
*
* ## Import
* AlertPolicy can be imported using any of these accepted formats:
* * `{{name}}`
* When using the `pulumi import` command, AlertPolicy can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:monitoring/alertPolicy:AlertPolicy default {{name}}
* ```
* @property alertStrategy Control over how this alert policy's notification channels are notified.
* @property combiner 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`.
* @property conditions 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.
* @property displayName 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.
* @property documentation 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.
* @property enabled Whether or not the policy is enabled. The default is true.
* @property notificationChannels 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]'
* @property project
* @property severity The severity of an alert policy indicates how important incidents generated by that policy are. The severity level will
* be displayed on the Incident detail page and in notifications. Possible values: ["CRITICAL", "ERROR", "WARNING"]
* @property userLabels 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.
*/
public data class AlertPolicyArgs(
public val alertStrategy: Output? = null,
public val combiner: Output? = null,
public val conditions: Output>? = null,
public val displayName: Output? = null,
public val documentation: Output? = null,
public val enabled: Output? = null,
public val notificationChannels: Output>? = null,
public val project: Output? = null,
public val severity: Output? = null,
public val userLabels: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy