Show / Hide Table of Contents

Class AlertPolicy

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
  • How-to Guides
  • Official Documentation

Example Usage - Monitoring Alert Policy Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var alertPolicy = new Gcp.Monitoring.AlertPolicy("alertPolicy", new Gcp.Monitoring.AlertPolicyArgs
    {
        Combiner = "OR",
        Conditions = 
        {
            new Gcp.Monitoring.Inputs.AlertPolicyConditionArgs
            {
                ConditionThreshold = new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdArgs
                {
                    Aggregations = 
                    {
                        new Gcp.Monitoring.Inputs.AlertPolicyConditionConditionThresholdAggregationArgs
                        {
                            AlignmentPeriod = "60s",
                            PerSeriesAligner = "ALIGN_RATE",
                        },
                    },
                    Comparison = "COMPARISON_GT",
                    Duration = "60s",
                    Filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\"",
                },
                DisplayName = "test condition",
            },
        },
        DisplayName = "My Alert Policy",
        UserLabels = 
        {
            { "foo", "bar" },
        },
    });
}

}
Inheritance
System.Object
Resource
CustomResource
AlertPolicy
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.Monitoring
Assembly: Pulumi.Gcp.dll
Syntax
public class AlertPolicy : CustomResource

Constructors

View Source

AlertPolicy(String, AlertPolicyArgs, CustomResourceOptions)

Create a AlertPolicy resource with the given unique name, arguments, and options.

Declaration
public AlertPolicy(string name, AlertPolicyArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

AlertPolicyArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Combiner

How to combine the results of multiple conditions to determine if an incident should be opened.

Declaration
public Output<string> Combiner { get; }
Property Value
Type Description
Output<System.String>
View Source

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.

Declaration
public Output<ImmutableArray<AlertPolicyCondition>> Conditions { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<AlertPolicyCondition>>
View Source

CreationRecord

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.

Declaration
public Output<AlertPolicyCreationRecord> CreationRecord { get; }
Property Value
Type Description
Output<AlertPolicyCreationRecord>
View Source

DisplayName

A short name or phrase used to identify the condition in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple conditions in the same policy.

Declaration
public Output<string> DisplayName { get; }
Property Value
Type Description
Output<System.String>
View Source

Documentation

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. Structure is documented below.

Declaration
public Output<AlertPolicyDocumentation> Documentation { get; }
Property Value
Type Description
Output<AlertPolicyDocumentation>
View Source

Enabled

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

Declaration
public Output<bool?> Enabled { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Name

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

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

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]

Declaration
public Output<ImmutableArray<string>> NotificationChannels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Project

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

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

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.

Declaration
public Output<ImmutableDictionary<string, string>> UserLabels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>>

Methods

View Source

Get(String, Input<String>, AlertPolicyState, CustomResourceOptions)

Get an existing AlertPolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static AlertPolicy Get(string name, Input<string> id, AlertPolicyState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

AlertPolicyState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
AlertPolicy
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.