alicloud logo
Alibaba Cloud v3.30.0, Feb 1 23

alicloud.cms.EventRule

Provides a Cloud Monitor Service Event Rule resource.

For information about Cloud Monitor Service Event Rule and how to use it, see What is Event Rule.

NOTE: Available in v1.182.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var @default = new AliCloud.Cms.MonitorGroup("default", new()
    {
        MonitorGroupName = "example_value",
    });

    var example = new AliCloud.Cms.EventRule("example", new()
    {
        RuleName = "example_value",
        GroupId = @default.Id,
        Description = "example_value",
        Status = "ENABLED",
        EventPattern = new AliCloud.Cms.Inputs.EventRuleEventPatternArgs
        {
            Product = "ecs",
            EventTypeLists = new[]
            {
                "StatusNotification",
            },
            LevelLists = new[]
            {
                "CRITICAL",
            },
            NameLists = new[]
            {
                "example_value",
            },
            SqlFilter = "example_value",
        },
        SilenceTime = 100,
    });

});
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cms.NewMonitorGroup(ctx, "default", &cms.MonitorGroupArgs{
			MonitorGroupName: pulumi.String("example_value"),
		})
		if err != nil {
			return err
		}
		_, err = cms.NewEventRule(ctx, "example", &cms.EventRuleArgs{
			RuleName:    pulumi.String("example_value"),
			GroupId:     _default.ID(),
			Description: pulumi.String("example_value"),
			Status:      pulumi.String("ENABLED"),
			EventPattern: &cms.EventRuleEventPatternArgs{
				Product: pulumi.String("ecs"),
				EventTypeLists: pulumi.StringArray{
					pulumi.String("StatusNotification"),
				},
				LevelLists: pulumi.StringArray{
					pulumi.String("CRITICAL"),
				},
				NameLists: pulumi.StringArray{
					pulumi.String("example_value"),
				},
				SqlFilter: pulumi.String("example_value"),
			},
			SilenceTime: pulumi.Int(100),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cms.MonitorGroup;
import com.pulumi.alicloud.cms.MonitorGroupArgs;
import com.pulumi.alicloud.cms.EventRule;
import com.pulumi.alicloud.cms.EventRuleArgs;
import com.pulumi.alicloud.cms.inputs.EventRuleEventPatternArgs;
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 default_ = new MonitorGroup("default", MonitorGroupArgs.builder()        
            .monitorGroupName("example_value")
            .build());

        var example = new EventRule("example", EventRuleArgs.builder()        
            .ruleName("example_value")
            .groupId(default_.id())
            .description("example_value")
            .status("ENABLED")
            .eventPattern(EventRuleEventPatternArgs.builder()
                .product("ecs")
                .eventTypeLists("StatusNotification")
                .levelLists("CRITICAL")
                .nameLists("example_value")
                .sqlFilter("example_value")
                .build())
            .silenceTime(100)
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default = alicloud.cms.MonitorGroup("default", monitor_group_name="example_value")
example = alicloud.cms.EventRule("example",
    rule_name="example_value",
    group_id=default.id,
    description="example_value",
    status="ENABLED",
    event_pattern=alicloud.cms.EventRuleEventPatternArgs(
        product="ecs",
        event_type_lists=["StatusNotification"],
        level_lists=["CRITICAL"],
        name_lists=["example_value"],
        sql_filter="example_value",
    ),
    silence_time=100)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const _default = new alicloud.cms.MonitorGroup("default", {monitorGroupName: "example_value"});
const example = new alicloud.cms.EventRule("example", {
    ruleName: "example_value",
    groupId: _default.id,
    description: "example_value",
    status: "ENABLED",
    eventPattern: {
        product: "ecs",
        eventTypeLists: ["StatusNotification"],
        levelLists: ["CRITICAL"],
        nameLists: ["example_value"],
        sqlFilter: "example_value",
    },
    silenceTime: 100,
});
resources:
  default:
    type: alicloud:cms:MonitorGroup
    properties:
      monitorGroupName: example_value
  example:
    type: alicloud:cms:EventRule
    properties:
      ruleName: example_value
      groupId: ${default.id}
      description: example_value
      status: ENABLED
      eventPattern:
        product: ecs
        eventTypeLists:
          - StatusNotification
        levelLists:
          - CRITICAL
        nameLists:
          - example_value
        sqlFilter: example_value
      silenceTime: 100

Create EventRule Resource

new EventRule(name: string, args: EventRuleArgs, opts?: CustomResourceOptions);
@overload
def EventRule(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              description: Optional[str] = None,
              event_pattern: Optional[EventRuleEventPatternArgs] = None,
              group_id: Optional[str] = None,
              rule_name: Optional[str] = None,
              silence_time: Optional[int] = None,
              status: Optional[str] = None)
@overload
def EventRule(resource_name: str,
              args: EventRuleArgs,
              opts: Optional[ResourceOptions] = None)
func NewEventRule(ctx *Context, name string, args EventRuleArgs, opts ...ResourceOption) (*EventRule, error)
public EventRule(string name, EventRuleArgs args, CustomResourceOptions? opts = null)
public EventRule(String name, EventRuleArgs args)
public EventRule(String name, EventRuleArgs args, CustomResourceOptions options)
type: alicloud:cms:EventRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args EventRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args EventRuleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args EventRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args EventRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args EventRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

EventRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The EventRule resource accepts the following input properties:

EventPattern Pulumi.AliCloud.Cms.Inputs.EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

RuleName string

The name of the event-triggered alert rule.

Description string

The description of the event-triggered alert rule.

GroupId string

The ID of the application group to which the event-triggered alert rule belongs.

SilenceTime int

The silence time.

Status string

The status of the resource. Valid values: ENABLED, DISABLED.

EventPattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

RuleName string

The name of the event-triggered alert rule.

Description string

The description of the event-triggered alert rule.

GroupId string

The ID of the application group to which the event-triggered alert rule belongs.

SilenceTime int

The silence time.

Status string

The status of the resource. Valid values: ENABLED, DISABLED.

eventPattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

ruleName String

The name of the event-triggered alert rule.

description String

The description of the event-triggered alert rule.

groupId String

The ID of the application group to which the event-triggered alert rule belongs.

silenceTime Integer

The silence time.

status String

The status of the resource. Valid values: ENABLED, DISABLED.

eventPattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

ruleName string

The name of the event-triggered alert rule.

description string

The description of the event-triggered alert rule.

groupId string

The ID of the application group to which the event-triggered alert rule belongs.

silenceTime number

The silence time.

status string

The status of the resource. Valid values: ENABLED, DISABLED.

event_pattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

rule_name str

The name of the event-triggered alert rule.

description str

The description of the event-triggered alert rule.

group_id str

The ID of the application group to which the event-triggered alert rule belongs.

silence_time int

The silence time.

status str

The status of the resource. Valid values: ENABLED, DISABLED.

eventPattern Property Map

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

ruleName String

The name of the event-triggered alert rule.

description String

The description of the event-triggered alert rule.

groupId String

The ID of the application group to which the event-triggered alert rule belongs.

silenceTime Number

The silence time.

status String

The status of the resource. Valid values: ENABLED, DISABLED.

Outputs

All input properties are implicitly available as output properties. Additionally, the EventRule resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing EventRule Resource

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

public static get(name: string, id: Input<ID>, state?: EventRuleState, opts?: CustomResourceOptions): EventRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        event_pattern: Optional[EventRuleEventPatternArgs] = None,
        group_id: Optional[str] = None,
        rule_name: Optional[str] = None,
        silence_time: Optional[int] = None,
        status: Optional[str] = None) -> EventRule
func GetEventRule(ctx *Context, name string, id IDInput, state *EventRuleState, opts ...ResourceOption) (*EventRule, error)
public static EventRule Get(string name, Input<string> id, EventRuleState? state, CustomResourceOptions? opts = null)
public static EventRule get(String name, Output<String> id, EventRuleState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string

The description of the event-triggered alert rule.

EventPattern Pulumi.AliCloud.Cms.Inputs.EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

GroupId string

The ID of the application group to which the event-triggered alert rule belongs.

RuleName string

The name of the event-triggered alert rule.

SilenceTime int

The silence time.

Status string

The status of the resource. Valid values: ENABLED, DISABLED.

Description string

The description of the event-triggered alert rule.

EventPattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

GroupId string

The ID of the application group to which the event-triggered alert rule belongs.

RuleName string

The name of the event-triggered alert rule.

SilenceTime int

The silence time.

Status string

The status of the resource. Valid values: ENABLED, DISABLED.

description String

The description of the event-triggered alert rule.

eventPattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

groupId String

The ID of the application group to which the event-triggered alert rule belongs.

ruleName String

The name of the event-triggered alert rule.

silenceTime Integer

The silence time.

status String

The status of the resource. Valid values: ENABLED, DISABLED.

description string

The description of the event-triggered alert rule.

eventPattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

groupId string

The ID of the application group to which the event-triggered alert rule belongs.

ruleName string

The name of the event-triggered alert rule.

silenceTime number

The silence time.

status string

The status of the resource. Valid values: ENABLED, DISABLED.

description str

The description of the event-triggered alert rule.

event_pattern EventRuleEventPatternArgs

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

group_id str

The ID of the application group to which the event-triggered alert rule belongs.

rule_name str

The name of the event-triggered alert rule.

silence_time int

The silence time.

status str

The status of the resource. Valid values: ENABLED, DISABLED.

description String

The description of the event-triggered alert rule.

eventPattern Property Map

Event mode, used to describe the trigger conditions for this event. See the following Block event_pattern.

groupId String

The ID of the application group to which the event-triggered alert rule belongs.

ruleName String

The name of the event-triggered alert rule.

silenceTime Number

The silence time.

status String

The status of the resource. Valid values: ENABLED, DISABLED.

Supporting Types

EventRuleEventPattern

Product string

The type of the cloud service.

EventTypeLists List<string>

The type of the event-triggered alert rule. Valid values:

LevelLists List<string>

The level of the event-triggered alert rule. Valid values:

NameLists List<string>

The name of the event-triggered alert rule.

SqlFilter string

The SQL condition that is used to filter events. If the content of an event meets the specified SQL condition, an alert is automatically triggered.

Product string

The type of the cloud service.

EventTypeLists []string

The type of the event-triggered alert rule. Valid values:

LevelLists []string

The level of the event-triggered alert rule. Valid values:

NameLists []string

The name of the event-triggered alert rule.

SqlFilter string

The SQL condition that is used to filter events. If the content of an event meets the specified SQL condition, an alert is automatically triggered.

product String

The type of the cloud service.

eventTypeLists List<String>

The type of the event-triggered alert rule. Valid values:

levelLists List<String>

The level of the event-triggered alert rule. Valid values:

nameLists List<String>

The name of the event-triggered alert rule.

sqlFilter String

The SQL condition that is used to filter events. If the content of an event meets the specified SQL condition, an alert is automatically triggered.

product string

The type of the cloud service.

eventTypeLists string[]

The type of the event-triggered alert rule. Valid values:

levelLists string[]

The level of the event-triggered alert rule. Valid values:

nameLists string[]

The name of the event-triggered alert rule.

sqlFilter string

The SQL condition that is used to filter events. If the content of an event meets the specified SQL condition, an alert is automatically triggered.

product str

The type of the cloud service.

event_type_lists Sequence[str]

The type of the event-triggered alert rule. Valid values:

level_lists Sequence[str]

The level of the event-triggered alert rule. Valid values:

name_lists Sequence[str]

The name of the event-triggered alert rule.

sql_filter str

The SQL condition that is used to filter events. If the content of an event meets the specified SQL condition, an alert is automatically triggered.

product String

The type of the cloud service.

eventTypeLists List<String>

The type of the event-triggered alert rule. Valid values:

levelLists List<String>

The level of the event-triggered alert rule. Valid values:

nameLists List<String>

The name of the event-triggered alert rule.

sqlFilter String

The SQL condition that is used to filter events. If the content of an event meets the specified SQL condition, an alert is automatically triggered.

Import

Cloud Monitor Service Event Rule can be imported using the id, e.g.

 $ pulumi import alicloud:cms/eventRule:EventRule example <rule_name>

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.