ResourceMetricRule
This class encapsulates and extends the ROS resource type ALIYUN::CMS::ResourceMetricRule
, which is used to create an alert rule for a metric of a resource.
Initializers
import ros_cdk_cms
ros_cdk_cms.ResourceMetricRule(
scope: Construct,
id: str,
contact_groups: typing.Union[IResolvable, typing.List[typing.Union[str, IResolvable]]],
escalations: typing.Union[IResolvable, EscalationsProperty],
metric_name: typing.Union[str, IResolvable],
namespace: typing.Union[str, IResolvable],
resources: typing.Union[IResolvable, typing.List[typing.Mapping[typing.Any]]],
composite_expression: typing.Union[IResolvable, CompositeExpressionProperty] = None,
deletion_force: typing.Union[bool, IResolvable] = None,
effective_interval: typing.Union[str, IResolvable] = None,
email_subject: typing.Union[str, IResolvable] = None,
interval: typing.Union[typing.Union[int, float], IResolvable] = None,
labels: typing.Union[IResolvable, typing.List[typing.Union[IResolvable, LabelsProperty]]] = None,
no_data_policy: typing.Union[str, IResolvable] = None,
no_effective_interval: typing.Union[str, IResolvable] = None,
period: typing.Union[typing.Union[int, float], IResolvable] = None,
prometheus: typing.Union[IResolvable, PrometheusProperty] = None,
rule_id: typing.Union[str, IResolvable] = None,
rule_name: typing.Union[str, IResolvable] = None,
silence_time: typing.Union[typing.Union[int, float], IResolvable] = None,
webhook: typing.Union[str, IResolvable] = None,
enable_resource_property_constraint: bool = None
)
Name | Type | Description |
---|---|---|
scope |
ros_cdk_core.Construct |
No description. |
id |
str |
No description. |
contact_groups |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]] |
Property contactGroups: The alert contact group. |
escalations |
typing.Union[ros_cdk_core.IResolvable, EscalationsProperty] |
Property escalations: You must select at least one of the Critical, Warn, and Info alert levels. |
metric_name |
typing.Union[str, ros_cdk_core.IResolvable] |
Property metricName: The name of the metric. |
namespace |
typing.Union[str, ros_cdk_core.IResolvable] |
Property namespace: The namespace of the cloud service. |
resources |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Mapping[typing.Any]]] |
Property resources: The information about the resource. |
composite_expression |
typing.Union[ros_cdk_core.IResolvable, CompositeExpressionProperty] |
Property compositeExpression: The trigger conditions for multiple metrics. |
deletion_force |
typing.Union[bool, ros_cdk_core.IResolvable] |
Property deletionForce: Whether to delete rule even if it is not created by ROS. |
effective_interval |
typing.Union[str, ros_cdk_core.IResolvable] |
Property effectiveInterval: The time period during which the alert rule is effective. |
email_subject |
typing.Union[str, ros_cdk_core.IResolvable] |
Property emailSubject: The subject of the alert notification email. |
interval |
typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] |
Property interval: The interval at which the alert is triggered. |
labels |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, LabelsProperty]]] |
Property labels:. |
no_data_policy |
typing.Union[str, ros_cdk_core.IResolvable] |
Property noDataPolicy: The processing method of alerts when no monitoring data is found. |
no_effective_interval |
typing.Union[str, ros_cdk_core.IResolvable] |
Property noEffectiveInterval: The time period during which the alert rule is ineffective. |
period |
typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] |
Property period: The statistical period of the metric. |
prometheus |
typing.Union[ros_cdk_core.IResolvable, PrometheusProperty] |
Property prometheus: The Prometheus alert rule. |
rule_id |
typing.Union[str, ros_cdk_core.IResolvable] |
Property ruleId: The ID of the alert rule. |
rule_name |
typing.Union[str, ros_cdk_core.IResolvable] |
Property ruleName: The name of the alert rule. |
silence_time |
typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] |
Property silenceTime: The mute period during which new alerts are not sent even if the trigger conditions are met. |
webhook |
typing.Union[str, ros_cdk_core.IResolvable] |
Property webhook: The callback URL to which a POST request is sent when an alert is triggered based on the alert rule. |
enable_resource_property_constraint |
bool |
No description. |
scope
Required
- Type: ros_cdk_core.Construct
id
Required
- Type: str
contact_groups
Required
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]]
Property contactGroups: The alert contact group.
The alert notifications are sent to the contacts that belong to the alert contact group. Note: An alert contact group can contain one or more alert contacts. For information about how to create alert contacts and alert contact groups, see PutContact and PutContactGroup.
escalations
Required
- Type: typing.Union[ros_cdk_core.IResolvable, EscalationsProperty]
Property escalations: You must select at least one of the Critical, Warn, and Info alert levels.
metric_name
Required
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property metricName: The name of the metric.
For information about how to query the name of a metric, see Appendix 1: Metrics. Note: If you create a Prometheus alert rule for Hybrid Cloud Monitoring, you must set this parameter to the name of the namespace. For information about how to obtain the name of a namespace, see DescribeHybridMonitorNamespaceList.
namespace
Required
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property namespace: The namespace of the cloud service.
For information about how to query the namespace of a cloud service, Appendix 1: Metrics. Note: If you create a Prometheus alert rule for Hybrid Cloud Monitoring, you must set this parameter to acs_prometheus.
resources
Required
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Mapping[typing.Any]]]
Property resources: The information about the resource.
Examples: [{"instanceId":"i-uf6j91r34rnwawoo*"}] and [{"userId":"100931896542*"}]. For information about the supported dimensions that are used to query resources, see Appendix 1: Metrics.
composite_expression
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, CompositeExpressionProperty]
Property compositeExpression: The trigger conditions for multiple metrics.
Note: The trigger conditions for a single metric and multiple metrics are mutually exclusive. You cannot specify trigger conditions for a single metric and multiple metrics at the same time.
deletion_force
Optional
- Type: typing.Union[bool, ros_cdk_core.IResolvable]
Property deletionForce: Whether to delete rule even if it is not created by ROS.
Default is false
effective_interval
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property effectiveInterval: The time period during which the alert rule is effective.
email_subject
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property emailSubject: The subject of the alert notification email.
interval
Optional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property interval: The interval at which the alert is triggered.
Unit: seconds. Note: For information about how to query the statistical period of a metric, see Appendix 1: Metrics.
labels
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, LabelsProperty]]]
Property labels:.
no_data_policy
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property noDataPolicy: The processing method of alerts when no monitoring data is found.
Valid values:
- KEEP_LAST_STATE (default value): No operation is performed.
- INSUFFICIENT_DATA: An alert whose content is "Insufficient data" is triggered.
- OK: The status is considered normal.
no_effective_interval
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property noEffectiveInterval: The time period during which the alert rule is ineffective.
period
Optional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property period: The statistical period of the metric.
Unit: seconds. The default value is the interval at which the monitoring data of the metric is collected. Note: For information about how to query the statistical period of a metric, see Appendix 1: Metrics.
prometheus
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, PrometheusProperty]
Property prometheus: The Prometheus alert rule.
Note: This parameter is required only when you create a Prometheus alert rule for Hybrid Cloud Monitoring.
rule_id
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property ruleId: The ID of the alert rule.
If not specified, ROS will generate one. You can specify a new ID or the ID of an existing alert rule. For information about how to query the ID of an alert rule, see DescribeMetricRuleList. Note: If you specify a new ID, a threshold-triggered alert rule is created.
rule_name
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property ruleName: The name of the alert rule.
If not specified and the rule is created by ROS, default to RuleId. You can specify a new name or the name of an existing alert rule. For information about how to query the name of an alert rule, see DescribeMetricRuleList. Note: If you specify a new name, a threshold-triggered alert rule is created.
silence_time
Optional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property silenceTime: The mute period during which new alerts are not sent even if the trigger conditions are met.
Unit: seconds. Default value: 86400. Note: If an alert is not cleared within the mute period, a new alert notification is sent when the mute period ends.
webhook
Optional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property webhook: The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
enable_resource_property_constraint
Optional
- Type: bool
Methods
Name | Description |
---|---|
to_string |
Returns a string representation of this construct. |
synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
add_condition |
No description. |
add_count |
No description. |
add_dependency |
No description. |
add_resource_desc |
No description. |
apply_removal_policy |
No description. |
get_att |
No description. |
set_metadata |
No description. |
to_string
def to_string() -> str
Returns a string representation of this construct.
synthesize
def synthesize(
session: ISynthesisSession
) -> None
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack
and Asset
as they participate in synthesizing the cloud assembly.
- Type: ros_cdk_core.ISynthesisSession
The synthesis session.
add_condition
def add_condition(
condition: RosCondition
) -> None
- Type: ros_cdk_core.RosCondition
add_count
def add_count(
count: typing.Union[typing.Union[int, float], IResolvable]
) -> None
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
add_dependency
def add_dependency(
resource: Resource
) -> None
- Type: ros_cdk_core.Resource
add_resource_desc
def add_resource_desc(
desc: str
) -> None
- Type: str
apply_removal_policy
def apply_removal_policy(
policy: RemovalPolicy
) -> None
- Type: ros_cdk_core.RemovalPolicy
get_att
def get_att(
name: str
) -> IResolvable
- Type: str
set_metadata
def set_metadata(
key: str,
value: typing.Any
) -> None
- Type: str
- Type: typing.Any
Static Functions
Name | Description |
---|---|
is_construct |
Return whether the given object is a Construct. |
is_construct
import ros_cdk_cms
ros_cdk_cms.ResourceMetricRule.is_construct(
x: typing.Any
)
Return whether the given object is a Construct.
- Type: typing.Any
Properties
Name | Type | Description |
---|---|---|
node |
ros_cdk_core.ConstructNode |
The construct tree node associated with this construct. |
ref |
str |
No description. |
stack |
ros_cdk_core.Stack |
The stack in which this resource is defined. |
resource |
ros_cdk_core.RosResource |
No description. |
attr_rule_id |
ros_cdk_core.IResolvable |
Attribute RuleId: The ID of the alert rule. |
attr_rule_name |
ros_cdk_core.IResolvable |
Attribute RuleName: The name of the alert rule. |
node
Required
node: ConstructNode
- Type: ros_cdk_core.ConstructNode
The construct tree node associated with this construct.
ref
Required
ref: str
- Type: str
stack
Required
stack: Stack
- Type: ros_cdk_core.Stack
The stack in which this resource is defined.
resource
Optional
resource: RosResource
- Type: ros_cdk_core.RosResource
attr_rule_id
Required
attr_rule_id: IResolvable
- Type: ros_cdk_core.IResolvable
Attribute RuleId: The ID of the alert rule.
attr_rule_name
Required
attr_rule_name: IResolvable
- Type: ros_cdk_core.IResolvable
Attribute RuleName: The name of the alert rule.