Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

ClusterAlertRule

Provides a Rancher v2 Cluster Alert Rule resource. This can be used to create Cluster Alert Rule for Rancher v2 environments and retrieve their information.

Example Usage

using Pulumi;
using Rancher2 = Pulumi.Rancher2;

class MyStack : Stack
{
    public MyStack()
    {
        // Create a new Rancher2 Cluster Alert Group
        var fooClusterAlertGroup = new Rancher2.ClusterAlertGroup("fooClusterAlertGroup", new Rancher2.ClusterAlertGroupArgs
        {
            ClusterId = "<cluster_id>",
            Description = "Terraform cluster alert group",
            GroupIntervalSeconds = 300,
            RepeatIntervalSeconds = 3600,
        });
        // Create a new Rancher2 Cluster Alert Rule
        var fooClusterAlertRule = new Rancher2.ClusterAlertRule("fooClusterAlertRule", new Rancher2.ClusterAlertRuleArgs
        {
            ClusterId = fooClusterAlertGroup.ClusterId,
            GroupId = fooClusterAlertGroup.Id,
            GroupIntervalSeconds = 600,
            RepeatIntervalSeconds = 6000,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-rancher2/sdk/v2/go/rancher2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        fooClusterAlertGroup, err := rancher2.NewClusterAlertGroup(ctx, "fooClusterAlertGroup", &rancher2.ClusterAlertGroupArgs{
            ClusterId:             pulumi.String("<cluster_id>"),
            Description:           pulumi.String("Terraform cluster alert group"),
            GroupIntervalSeconds:  pulumi.Int(300),
            RepeatIntervalSeconds: pulumi.Int(3600),
        })
        if err != nil {
            return err
        }
        _, err = rancher2.NewClusterAlertRule(ctx, "fooClusterAlertRule", &rancher2.ClusterAlertRuleArgs{
            ClusterId:             fooClusterAlertGroup.ClusterId,
            GroupId:               fooClusterAlertGroup.ID(),
            GroupIntervalSeconds:  pulumi.Int(600),
            RepeatIntervalSeconds: pulumi.Int(6000),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_rancher2 as rancher2

# Create a new Rancher2 Cluster Alert Group
foo_cluster_alert_group = rancher2.ClusterAlertGroup("fooClusterAlertGroup",
    cluster_id="<cluster_id>",
    description="Terraform cluster alert group",
    group_interval_seconds=300,
    repeat_interval_seconds=3600)
# Create a new Rancher2 Cluster Alert Rule
foo_cluster_alert_rule = rancher2.ClusterAlertRule("fooClusterAlertRule",
    cluster_id=foo_cluster_alert_group.cluster_id,
    group_id=foo_cluster_alert_group.id,
    group_interval_seconds=600,
    repeat_interval_seconds=6000)
import * as pulumi from "@pulumi/pulumi";
import * as rancher2 from "@pulumi/rancher2";

// Create a new Rancher2 Cluster Alert Group
const fooClusterAlertGroup = new rancher2.ClusterAlertGroup("fooClusterAlertGroup", {
    clusterId: "<cluster_id>",
    description: "Terraform cluster alert group",
    groupIntervalSeconds: 300,
    repeatIntervalSeconds: 3600,
});
// Create a new Rancher2 Cluster Alert Rule
const fooClusterAlertRule = new rancher2.ClusterAlertRule("fooClusterAlertRule", {
    clusterId: fooClusterAlertGroup.clusterId,
    groupId: fooClusterAlertGroup.id,
    groupIntervalSeconds: 600,
    repeatIntervalSeconds: 6000,
});

Create a ClusterAlertRule Resource

new ClusterAlertRule(name: string, args: ClusterAlertRuleArgs, opts?: CustomResourceOptions);
def ClusterAlertRule(resource_name: str, opts: Optional[ResourceOptions] = None, annotations: Optional[Mapping[str, Any]] = None, cluster_id: Optional[str] = None, event_rule: Optional[ClusterAlertRuleEventRuleArgs] = None, group_id: Optional[str] = None, group_interval_seconds: Optional[int] = None, group_wait_seconds: Optional[int] = None, inherited: Optional[bool] = None, labels: Optional[Mapping[str, Any]] = None, metric_rule: Optional[ClusterAlertRuleMetricRuleArgs] = None, name: Optional[str] = None, node_rule: Optional[ClusterAlertRuleNodeRuleArgs] = None, repeat_interval_seconds: Optional[int] = None, severity: Optional[str] = None, system_service_rule: Optional[ClusterAlertRuleSystemServiceRuleArgs] = None)
func NewClusterAlertRule(ctx *Context, name string, args ClusterAlertRuleArgs, opts ...ResourceOption) (*ClusterAlertRule, error)
public ClusterAlertRule(string name, ClusterAlertRuleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ClusterAlertRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ClusterAlertRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ClusterAlertRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ClusterAlertRule Resource Properties

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

Inputs

The ClusterAlertRule resource accepts the following input properties:

ClusterId string

The cluster id where create cluster alert rule (string)

GroupId string

The cluster alert rule alert group ID (string)

Annotations Dictionary<string, object>

The cluster alert rule annotations (map)

EventRule ClusterAlertRuleEventRuleArgs

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

GroupIntervalSeconds int

The cluster alert rule group interval seconds. Default: 180 (int)

GroupWaitSeconds int

The cluster alert rule group wait seconds. Default: 180 (int)

Inherited bool

The cluster alert rule inherited. Default: true (bool)

Labels Dictionary<string, object>

The cluster alert rule labels (map)

MetricRule ClusterAlertRuleMetricRuleArgs

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

Name string

The cluster alert rule name (string)

NodeRule ClusterAlertRuleNodeRuleArgs

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

RepeatIntervalSeconds int

The cluster alert rule wait seconds. Default: 3600 (int)

Severity string

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

SystemServiceRule ClusterAlertRuleSystemServiceRuleArgs

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

ClusterId string

The cluster id where create cluster alert rule (string)

GroupId string

The cluster alert rule alert group ID (string)

Annotations map[string]interface{}

The cluster alert rule annotations (map)

EventRule ClusterAlertRuleEventRule

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

GroupIntervalSeconds int

The cluster alert rule group interval seconds. Default: 180 (int)

GroupWaitSeconds int

The cluster alert rule group wait seconds. Default: 180 (int)

Inherited bool

The cluster alert rule inherited. Default: true (bool)

Labels map[string]interface{}

The cluster alert rule labels (map)

MetricRule ClusterAlertRuleMetricRule

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

Name string

The cluster alert rule name (string)

NodeRule ClusterAlertRuleNodeRule

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

RepeatIntervalSeconds int

The cluster alert rule wait seconds. Default: 3600 (int)

Severity string

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

SystemServiceRule ClusterAlertRuleSystemServiceRule

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

clusterId string

The cluster id where create cluster alert rule (string)

groupId string

The cluster alert rule alert group ID (string)

annotations {[key: string]: any}

The cluster alert rule annotations (map)

eventRule ClusterAlertRuleEventRule

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

groupIntervalSeconds number

The cluster alert rule group interval seconds. Default: 180 (int)

groupWaitSeconds number

The cluster alert rule group wait seconds. Default: 180 (int)

inherited boolean

The cluster alert rule inherited. Default: true (bool)

labels {[key: string]: any}

The cluster alert rule labels (map)

metricRule ClusterAlertRuleMetricRule

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

name string

The cluster alert rule name (string)

nodeRule ClusterAlertRuleNodeRule

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

repeatIntervalSeconds number

The cluster alert rule wait seconds. Default: 3600 (int)

severity string

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

systemServiceRule ClusterAlertRuleSystemServiceRule

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

cluster_id str

The cluster id where create cluster alert rule (string)

group_id str

The cluster alert rule alert group ID (string)

annotations Mapping[str, Any]

The cluster alert rule annotations (map)

event_rule ClusterAlertRuleEventRuleArgs

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

group_interval_seconds int

The cluster alert rule group interval seconds. Default: 180 (int)

group_wait_seconds int

The cluster alert rule group wait seconds. Default: 180 (int)

inherited bool

The cluster alert rule inherited. Default: true (bool)

labels Mapping[str, Any]

The cluster alert rule labels (map)

metric_rule ClusterAlertRuleMetricRuleArgs

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

name str

The cluster alert rule name (string)

node_rule ClusterAlertRuleNodeRuleArgs

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

repeat_interval_seconds int

The cluster alert rule wait seconds. Default: 3600 (int)

severity str

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

system_service_rule ClusterAlertRuleSystemServiceRuleArgs

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

Outputs

All input properties are implicitly available as output properties. Additionally, the ClusterAlertRule 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing ClusterAlertRule Resource

Get an existing ClusterAlertRule 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?: ClusterAlertRuleState, opts?: CustomResourceOptions): ClusterAlertRule
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, annotations: Optional[Mapping[str, Any]] = None, cluster_id: Optional[str] = None, event_rule: Optional[ClusterAlertRuleEventRuleArgs] = None, group_id: Optional[str] = None, group_interval_seconds: Optional[int] = None, group_wait_seconds: Optional[int] = None, inherited: Optional[bool] = None, labels: Optional[Mapping[str, Any]] = None, metric_rule: Optional[ClusterAlertRuleMetricRuleArgs] = None, name: Optional[str] = None, node_rule: Optional[ClusterAlertRuleNodeRuleArgs] = None, repeat_interval_seconds: Optional[int] = None, severity: Optional[str] = None, system_service_rule: Optional[ClusterAlertRuleSystemServiceRuleArgs] = None) -> ClusterAlertRule
func GetClusterAlertRule(ctx *Context, name string, id IDInput, state *ClusterAlertRuleState, opts ...ResourceOption) (*ClusterAlertRule, error)
public static ClusterAlertRule Get(string name, Input<string> id, ClusterAlertRuleState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Annotations Dictionary<string, object>

The cluster alert rule annotations (map)

ClusterId string

The cluster id where create cluster alert rule (string)

EventRule ClusterAlertRuleEventRuleArgs

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

GroupId string

The cluster alert rule alert group ID (string)

GroupIntervalSeconds int

The cluster alert rule group interval seconds. Default: 180 (int)

GroupWaitSeconds int

The cluster alert rule group wait seconds. Default: 180 (int)

Inherited bool

The cluster alert rule inherited. Default: true (bool)

Labels Dictionary<string, object>

The cluster alert rule labels (map)

MetricRule ClusterAlertRuleMetricRuleArgs

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

Name string

The cluster alert rule name (string)

NodeRule ClusterAlertRuleNodeRuleArgs

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

RepeatIntervalSeconds int

The cluster alert rule wait seconds. Default: 3600 (int)

Severity string

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

SystemServiceRule ClusterAlertRuleSystemServiceRuleArgs

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

Annotations map[string]interface{}

The cluster alert rule annotations (map)

ClusterId string

The cluster id where create cluster alert rule (string)

EventRule ClusterAlertRuleEventRule

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

GroupId string

The cluster alert rule alert group ID (string)

GroupIntervalSeconds int

The cluster alert rule group interval seconds. Default: 180 (int)

GroupWaitSeconds int

The cluster alert rule group wait seconds. Default: 180 (int)

Inherited bool

The cluster alert rule inherited. Default: true (bool)

Labels map[string]interface{}

The cluster alert rule labels (map)

MetricRule ClusterAlertRuleMetricRule

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

Name string

The cluster alert rule name (string)

NodeRule ClusterAlertRuleNodeRule

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

RepeatIntervalSeconds int

The cluster alert rule wait seconds. Default: 3600 (int)

Severity string

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

SystemServiceRule ClusterAlertRuleSystemServiceRule

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

annotations {[key: string]: any}

The cluster alert rule annotations (map)

clusterId string

The cluster id where create cluster alert rule (string)

eventRule ClusterAlertRuleEventRule

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

groupId string

The cluster alert rule alert group ID (string)

groupIntervalSeconds number

The cluster alert rule group interval seconds. Default: 180 (int)

groupWaitSeconds number

The cluster alert rule group wait seconds. Default: 180 (int)

inherited boolean

The cluster alert rule inherited. Default: true (bool)

labels {[key: string]: any}

The cluster alert rule labels (map)

metricRule ClusterAlertRuleMetricRule

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

name string

The cluster alert rule name (string)

nodeRule ClusterAlertRuleNodeRule

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

repeatIntervalSeconds number

The cluster alert rule wait seconds. Default: 3600 (int)

severity string

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

systemServiceRule ClusterAlertRuleSystemServiceRule

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

annotations Mapping[str, Any]

The cluster alert rule annotations (map)

cluster_id str

The cluster id where create cluster alert rule (string)

event_rule ClusterAlertRuleEventRuleArgs

The cluster alert rule event rule. ConflictsWith: "metric_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

group_id str

The cluster alert rule alert group ID (string)

group_interval_seconds int

The cluster alert rule group interval seconds. Default: 180 (int)

group_wait_seconds int

The cluster alert rule group wait seconds. Default: 180 (int)

inherited bool

The cluster alert rule inherited. Default: true (bool)

labels Mapping[str, Any]

The cluster alert rule labels (map)

metric_rule ClusterAlertRuleMetricRuleArgs

The cluster alert rule metric rule. ConflictsWith: "event_rule", "node_rule", "system_service_rule"` (list Maxitems:1)

name str

The cluster alert rule name (string)

node_rule ClusterAlertRuleNodeRuleArgs

The cluster alert rule node rule. ConflictsWith: "event_rule", "metric_rule", "system_service_rule"` (list Maxitems:1)

repeat_interval_seconds int

The cluster alert rule wait seconds. Default: 3600 (int)

severity str

The cluster alert rule severity. Supported values : "critical" | "info" | "warning". Default: critical (string)

system_service_rule ClusterAlertRuleSystemServiceRuleArgs

The cluster alert rule system service rule. ConflictsWith: "event_rule", "metric_rule", "node_rule" (list Maxitems:1)

Supporting Types

ClusterAlertRuleEventRule

ResourceKind string

Resource kind. Supported values : "DaemonSet" | "Deployment" | "Node" | "Pod" | "StatefulSet" (string)

EventType string

Event type. Supported values : "Warning" | "Normal". Default: Warning (string)

ResourceKind string

Resource kind. Supported values : "DaemonSet" | "Deployment" | "Node" | "Pod" | "StatefulSet" (string)

EventType string

Event type. Supported values : "Warning" | "Normal". Default: Warning (string)

resourceKind string

Resource kind. Supported values : "DaemonSet" | "Deployment" | "Node" | "Pod" | "StatefulSet" (string)

eventType string

Event type. Supported values : "Warning" | "Normal". Default: Warning (string)

resource_kind str

Resource kind. Supported values : "DaemonSet" | "Deployment" | "Node" | "Pod" | "StatefulSet" (string)

event_type str

Event type. Supported values : "Warning" | "Normal". Default: Warning (string)

ClusterAlertRuleMetricRule

Duration string

Metric rule duration (string)

Expression string

Metric rule expression (string)

ThresholdValue double

Metric rule threshold value (float64)

Comparison string

Metric rule comparison. Supported values : "equal" | "greater-or-equal" | "greater-than" | "less-or-equal" | "less-than" | "not-equal" | "has-value". Default: equal (string)

Description string

Metric rule description (string)

Duration string

Metric rule duration (string)

Expression string

Metric rule expression (string)

ThresholdValue float64

Metric rule threshold value (float64)

Comparison string

Metric rule comparison. Supported values : "equal" | "greater-or-equal" | "greater-than" | "less-or-equal" | "less-than" | "not-equal" | "has-value". Default: equal (string)

Description string

Metric rule description (string)

duration string

Metric rule duration (string)

expression string

Metric rule expression (string)

thresholdValue number

Metric rule threshold value (float64)

comparison string

Metric rule comparison. Supported values : "equal" | "greater-or-equal" | "greater-than" | "less-or-equal" | "less-than" | "not-equal" | "has-value". Default: equal (string)

description string

Metric rule description (string)

duration str

Metric rule duration (string)

expression str

Metric rule expression (string)

threshold_value float

Metric rule threshold value (float64)

comparison str

Metric rule comparison. Supported values : "equal" | "greater-or-equal" | "greater-than" | "less-or-equal" | "less-than" | "not-equal" | "has-value". Default: equal (string)

description str

Metric rule description (string)

ClusterAlertRuleNodeRule

Condition string

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

CpuThreshold int

Node rule cpu threshold. Default: 70 (int)

MemThreshold int

Node rule mem threshold. Default: 70 (int)

NodeId string

Node ID (string)

Selector Dictionary<string, object>

Node rule selector (map)

Condition string

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

CpuThreshold int

Node rule cpu threshold. Default: 70 (int)

MemThreshold int

Node rule mem threshold. Default: 70 (int)

NodeId string

Node ID (string)

Selector map[string]interface{}

Node rule selector (map)

condition string

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

cpuThreshold number

Node rule cpu threshold. Default: 70 (int)

memThreshold number

Node rule mem threshold. Default: 70 (int)

nodeId string

Node ID (string)

selector {[key: string]: any}

Node rule selector (map)

condition str

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

cpu_threshold int

Node rule cpu threshold. Default: 70 (int)

mem_threshold int

Node rule mem threshold. Default: 70 (int)

node_id str

Node ID (string)

selector Mapping[str, Any]

Node rule selector (map)

ClusterAlertRuleSystemServiceRule

Condition string

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

Condition string

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

condition string

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

condition str

System service rule condition. Supported values : "controller-manager" | "etcd" | "scheduler". Default: scheduler (string)

Import

Cluster Alert Rule can be imported using the Rancher cluster alert rule ID

 $ pulumi import rancher2:index/clusterAlertRule:ClusterAlertRule foo &lt;CLUSTER_ALERT_RULE_ID&gt;

Package Details

Repository
https://github.com/pulumi/pulumi-rancher2
License
Apache-2.0
Notes
This Pulumi package is based on the rancher2 Terraform Provider.