ResourceMetricRule
- Implements: IResourceMetricRule
This class encapsulates and extends the ROS resource type ALIYUN::CMS::ResourceMetricRule, which is used to create a threshold-triggered 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]]],
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,
escalations: typing.Union[IResolvable, EscalationsProperty] = 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. |
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. |
escalations | typing.Union[ros_cdk_core.IResolvable, EscalationsProperty] | Property escalations: You must select at least one of the Critical, Warn, and Info alert levels. |
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. |
scopeRequired
- Type: ros_cdk_core.Construct
idRequired
- Type: str
contact_groupsRequired
- 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.
metric_nameRequired
- 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.
namespaceRequired
- 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.
resourcesRequired
- 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_expressionOptional
- 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_forceOptional
- 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_intervalOptional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property effectiveInterval: The time period during which the alert rule is effective.
email_subjectOptional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property emailSubject: The subject of the alert notification email.
escalationsOptional
- Type: typing.Union[ros_cdk_core.IResolvable, EscalationsProperty]
Property escalations: You must select at least one of the Critical, Warn, and Info alert levels.
intervalOptional
- 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.
labelsOptional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, LabelsProperty]]]
Property labels:.
no_data_policyOptional
- 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_intervalOptional
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property noEffectiveInterval: The time period during which the alert rule is ineffective.
periodOptional
- 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.
prometheusOptional
- 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_idOptional
- 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_nameOptional
- 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_timeOptional
- 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.
webhookOptional
- 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_constraintOptional
- 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. |
fetch_condition | No description. |
fetch_dependency | No description. |
fetch_resource_desc | 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
fetch_condition
def fetch_condition() -> RosCondition
fetch_dependency
def fetch_dependency() -> typing.List[str]
fetch_resource_desc
def fetch_resource_desc() -> str
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. |
env | ros_cdk_core.IResourceEnvironment | The environment this resource belongs to. |
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 | typing.Union[str, ros_cdk_core.IResolvable] | Attribute RuleId: The ID of the alert rule. |
attr_rule_name | typing.Union[str, ros_cdk_core.IResolvable] | Attribute RuleName: The name of the alert rule. |
props | ResourceMetricRuleProps | No description. |
nodeRequired
node: ConstructNode
- Type: ros_cdk_core.ConstructNode
The construct tree node associated with this construct.
envRequired
env: IResourceEnvironment
- Type: ros_cdk_core.IResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
refRequired
ref: str
- Type: str
stackRequired
stack: Stack
- Type: ros_cdk_core.Stack
The stack in which this resource is defined.
resourceOptional
resource: RosResource
- Type: ros_cdk_core.RosResource
attr_rule_idRequired
attr_rule_id: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute RuleId: The ID of the alert rule.
attr_rule_nameRequired
attr_rule_name: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute RuleName: The name of the alert rule.
propsRequired
props: ResourceMetricRuleProps
- Type: ResourceMetricRuleProps