UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

504 lines (503 loc) 17.9 kB
import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "../types"; /** * Manages a Cloud Eye alarm rule resource within HuaweiCloud. * * ## Example Usage * ### Basic example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const instanceId1 = config.requireObject("instanceId1"); * const instanceId2 = config.requireObject("instanceId2"); * const topicUrn = config.requireObject("topicUrn"); * const test = new huaweicloud.cse.Alarmrule("test", { * alarmName: "rule-test", * alarmActionEnabled: true, * alarmEnabled: true, * alarmType: "MULTI_INSTANCE", * metric: { * namespace: "SYS.ECS", * }, * resources: [ * { * dimensions: [{ * name: "instance_id", * value: instanceId1, * }], * }, * { * dimensions: [{ * name: "instance_id", * value: instanceId2, * }], * }, * ], * conditions: [ * { * period: 1200, * filter: "average", * comparisonOperator: ">", * value: 6.5, * unit: "B/s", * count: 1, * suppressDuration: 300, * metricName: "network_outgoing_bytes_rate_inband", * alarmLevel: 4, * }, * { * period: 3600, * filter: "average", * comparisonOperator: ">=", * value: 20, * unit: "B/s", * count: 1, * suppressDuration: 300, * metricName: "network_outgoing_bytes_rate_inband", * alarmLevel: 4, * }, * ], * alarmActions: [{ * type: "notification", * notificationLists: [topicUrn], * }], * }); * ``` * ### Alarm rule for All instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const topicUrn = config.requireObject("topicUrn"); * const test = new huaweicloud.cse.Alarmrule("test", { * alarmName: "rule-test", * alarmActionEnabled: true, * alarmEnabled: true, * alarmType: "ALL_INSTANCE", * metric: { * namespace: "AGT.ECS", * }, * resources: [{ * dimensions: [ * { * name: "instance_id", * }, * { * name: "mount_point", * }, * ], * }], * conditions: [{ * alarmLevel: 2, * suppressDuration: 0, * period: 1, * filter: "average", * comparisonOperator: ">", * value: 80, * count: 1, * metricName: "disk_usedPercent", * }], * alarmActions: [{ * type: "notification", * notificationLists: [topicUrn], * }], * }); * ``` * ### Alarm rule for event monitoring * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const topicUrn = config.requireObject("topicUrn"); * const test = new huaweicloud.cse.Alarmrule("test", { * alarmName: "rule-test", * alarmActionEnabled: true, * alarmType: "EVENT.SYS", * metric: { * namespace: "SYS.ECS", * }, * conditions: [{ * metricName: "stopServer", * period: 0, * filter: "average", * comparisonOperator: ">=", * value: 1, * unit: "count", * count: 1, * suppressDuration: 0, * alarmLevel: 2, * }], * alarmActions: [{ * type: "notification", * notificationLists: [topicUrn], * }], * }); * ``` * ### Alarm rule using the alarm template * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const topicUrn = config.requireObject("topicUrn"); * const alarmTemplateId = config.requireObject("alarmTemplateId"); * const instanceId = config.requireObject("instanceId"); * const test = new huaweicloud.cse.Alarmrule("test", { * alarmName: "rule-test", * alarmEnabled: true, * alarmActionEnabled: true, * alarmType: "MULTI_INSTANCE", * alarmTemplateId: alarmTemplateId, * metric: { * namespace: "SYS.ECS", * }, * resources: [{ * dimensions: [{ * name: "instance_id", * value: instanceId, * }], * }], * alarmActions: [{ * type: "notification", * notificationLists: [topicUrn], * }], * }); * ``` * * ## Import * * CES alarm rules can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Cse/alarmrule:Alarmrule alarm_rule al1619578509719Ga0X1RGWv * ``` */ export declare class Alarmrule extends pulumi.CustomResource { /** * Get an existing Alarmrule resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AlarmruleState, opts?: pulumi.CustomResourceOptions): Alarmrule; /** * Returns true if the given object is an instance of Alarmrule. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Alarmrule; /** * Specifies whether to enable the action to be triggered by an alarm. The * default value is true. */ readonly alarmActionEnabled: pulumi.Output<boolean | undefined>; /** * Specifies the action triggered by an alarm. The structure is described * below. */ readonly alarmActions: pulumi.Output<outputs.Cse.AlarmruleAlarmAction[] | undefined>; /** * The value can be a string of 0 to 256 characters. */ readonly alarmDescription: pulumi.Output<string | undefined>; /** * Specifies whether to enable the alarm. The default value is true. */ readonly alarmEnabled: pulumi.Output<boolean | undefined>; /** * Specifies the alarm severity of the condition. The value can be 1, 2, 3 or 4, * which indicates *critical*, *major*, *minor*, and *informational*, respectively. * The default value is 2. */ readonly alarmLevel: pulumi.Output<number>; /** * Specifies the name of an alarm rule. The value can be a string of `1` to `128` * characters that can consist of English letters, Chinese characters, digits, underscores (_), hyphens (-). */ readonly alarmName: pulumi.Output<string>; /** * Indicates the alarm status. The value can be: * + ok: The alarm status is normal; * + alarm: An alarm is generated; * + insufficient_data: The required data is insufficient. */ readonly alarmState: pulumi.Output<string>; /** * Specifies the ID of the alarm template. * When using `alarmTemplateId`, the fields `alarmName`, `alarmDescription`, `alarmActionEnabled`, `alarmActions` * and `okActions` cannot be updated. * Changing this creates a new resource. */ readonly alarmTemplateId: pulumi.Output<string | undefined>; /** * Specifies the alarm type. The value can be **EVENT.SYS**, **EVENT.CUSTOM**, * **MULTI_INSTANCE** and **ALL_INSTANCE**. Defaults to **MULTI_INSTANCE**. */ readonly alarmType: pulumi.Output<string | undefined>; /** * Specifies the alarm triggering condition. * The condition structure is documented below. */ readonly conditions: pulumi.Output<outputs.Cse.AlarmruleCondition[]>; /** * Specifies the enterprise project ID of the alarm rule. */ readonly enterpriseProjectId: pulumi.Output<string>; /** * @deprecated insufficientdata_actions is deprecated */ readonly insufficientdataActions: pulumi.Output<outputs.Cse.AlarmruleInsufficientdataAction[] | undefined>; /** * Specifies the alarm metrics. The structure is described below. Changing this * creates a new resource. */ readonly metric: pulumi.Output<outputs.Cse.AlarmruleMetric>; /** * Specifies the alarm notification start time, for * example: **05:30**. Changing this creates a new resource. */ readonly notificationBeginTime: pulumi.Output<string>; /** * Specifies the alarm notification stop time, for * example: **22:10**. Changing this creates a new resource. */ readonly notificationEndTime: pulumi.Output<string>; /** * Specifies the action triggered by the clearing of an alarm. The structure is * described below. */ readonly okActions: pulumi.Output<outputs.Cse.AlarmruleOkAction[] | undefined>; /** * The region in which to create the alarm rule resource. If omitted, the * provider-level region will be used. Changing this creates a new resource. */ readonly region: pulumi.Output<string>; /** * schema: Internal */ readonly resourceGroupId: pulumi.Output<string>; /** * Specifies the list of the resources to add into the alarm rule. * The structure is described below. */ readonly resources: pulumi.Output<outputs.Cse.AlarmruleResource[]>; /** * Indicates the time when the alarm status changed. The value is a UNIX timestamp and the unit is ms. */ readonly updateTime: pulumi.Output<number>; /** * Create a Alarmrule resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: AlarmruleArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Alarmrule resources. */ export interface AlarmruleState { /** * Specifies whether to enable the action to be triggered by an alarm. The * default value is true. */ alarmActionEnabled?: pulumi.Input<boolean>; /** * Specifies the action triggered by an alarm. The structure is described * below. */ alarmActions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleAlarmAction>[]>; /** * The value can be a string of 0 to 256 characters. */ alarmDescription?: pulumi.Input<string>; /** * Specifies whether to enable the alarm. The default value is true. */ alarmEnabled?: pulumi.Input<boolean>; /** * Specifies the alarm severity of the condition. The value can be 1, 2, 3 or 4, * which indicates *critical*, *major*, *minor*, and *informational*, respectively. * The default value is 2. */ alarmLevel?: pulumi.Input<number>; /** * Specifies the name of an alarm rule. The value can be a string of `1` to `128` * characters that can consist of English letters, Chinese characters, digits, underscores (_), hyphens (-). */ alarmName?: pulumi.Input<string>; /** * Indicates the alarm status. The value can be: * + ok: The alarm status is normal; * + alarm: An alarm is generated; * + insufficient_data: The required data is insufficient. */ alarmState?: pulumi.Input<string>; /** * Specifies the ID of the alarm template. * When using `alarmTemplateId`, the fields `alarmName`, `alarmDescription`, `alarmActionEnabled`, `alarmActions` * and `okActions` cannot be updated. * Changing this creates a new resource. */ alarmTemplateId?: pulumi.Input<string>; /** * Specifies the alarm type. The value can be **EVENT.SYS**, **EVENT.CUSTOM**, * **MULTI_INSTANCE** and **ALL_INSTANCE**. Defaults to **MULTI_INSTANCE**. */ alarmType?: pulumi.Input<string>; /** * Specifies the alarm triggering condition. * The condition structure is documented below. */ conditions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleCondition>[]>; /** * Specifies the enterprise project ID of the alarm rule. */ enterpriseProjectId?: pulumi.Input<string>; /** * @deprecated insufficientdata_actions is deprecated */ insufficientdataActions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleInsufficientdataAction>[]>; /** * Specifies the alarm metrics. The structure is described below. Changing this * creates a new resource. */ metric?: pulumi.Input<inputs.Cse.AlarmruleMetric>; /** * Specifies the alarm notification start time, for * example: **05:30**. Changing this creates a new resource. */ notificationBeginTime?: pulumi.Input<string>; /** * Specifies the alarm notification stop time, for * example: **22:10**. Changing this creates a new resource. */ notificationEndTime?: pulumi.Input<string>; /** * Specifies the action triggered by the clearing of an alarm. The structure is * described below. */ okActions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleOkAction>[]>; /** * The region in which to create the alarm rule resource. If omitted, the * provider-level region will be used. Changing this creates a new resource. */ region?: pulumi.Input<string>; /** * schema: Internal */ resourceGroupId?: pulumi.Input<string>; /** * Specifies the list of the resources to add into the alarm rule. * The structure is described below. */ resources?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleResource>[]>; /** * Indicates the time when the alarm status changed. The value is a UNIX timestamp and the unit is ms. */ updateTime?: pulumi.Input<number>; } /** * The set of arguments for constructing a Alarmrule resource. */ export interface AlarmruleArgs { /** * Specifies whether to enable the action to be triggered by an alarm. The * default value is true. */ alarmActionEnabled?: pulumi.Input<boolean>; /** * Specifies the action triggered by an alarm. The structure is described * below. */ alarmActions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleAlarmAction>[]>; /** * The value can be a string of 0 to 256 characters. */ alarmDescription?: pulumi.Input<string>; /** * Specifies whether to enable the alarm. The default value is true. */ alarmEnabled?: pulumi.Input<boolean>; /** * Specifies the alarm severity of the condition. The value can be 1, 2, 3 or 4, * which indicates *critical*, *major*, *minor*, and *informational*, respectively. * The default value is 2. */ alarmLevel?: pulumi.Input<number>; /** * Specifies the name of an alarm rule. The value can be a string of `1` to `128` * characters that can consist of English letters, Chinese characters, digits, underscores (_), hyphens (-). */ alarmName: pulumi.Input<string>; /** * Specifies the ID of the alarm template. * When using `alarmTemplateId`, the fields `alarmName`, `alarmDescription`, `alarmActionEnabled`, `alarmActions` * and `okActions` cannot be updated. * Changing this creates a new resource. */ alarmTemplateId?: pulumi.Input<string>; /** * Specifies the alarm type. The value can be **EVENT.SYS**, **EVENT.CUSTOM**, * **MULTI_INSTANCE** and **ALL_INSTANCE**. Defaults to **MULTI_INSTANCE**. */ alarmType?: pulumi.Input<string>; /** * Specifies the alarm triggering condition. * The condition structure is documented below. */ conditions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleCondition>[]>; /** * Specifies the enterprise project ID of the alarm rule. */ enterpriseProjectId?: pulumi.Input<string>; /** * @deprecated insufficientdata_actions is deprecated */ insufficientdataActions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleInsufficientdataAction>[]>; /** * Specifies the alarm metrics. The structure is described below. Changing this * creates a new resource. */ metric: pulumi.Input<inputs.Cse.AlarmruleMetric>; /** * Specifies the alarm notification start time, for * example: **05:30**. Changing this creates a new resource. */ notificationBeginTime?: pulumi.Input<string>; /** * Specifies the alarm notification stop time, for * example: **22:10**. Changing this creates a new resource. */ notificationEndTime?: pulumi.Input<string>; /** * Specifies the action triggered by the clearing of an alarm. The structure is * described below. */ okActions?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleOkAction>[]>; /** * The region in which to create the alarm rule resource. If omitted, the * provider-level region will be used. Changing this creates a new resource. */ region?: pulumi.Input<string>; /** * schema: Internal */ resourceGroupId?: pulumi.Input<string>; /** * Specifies the list of the resources to add into the alarm rule. * The structure is described below. */ resources?: pulumi.Input<pulumi.Input<inputs.Cse.AlarmruleResource>[]>; }