ResourceMetricRule
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 com.aliyun.ros.cdk.cms.ResourceMetricRule;
ResourceMetricRule.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
.contactGroups(IResolvable)
.contactGroups(java.util.List<java.lang.String)
.contactGroups(IResolvable>)
.escalations(IResolvable)
.escalations(EscalationsProperty)
.metricName(java.lang.String)
.metricName(IResolvable)
.namespace(java.lang.String)
.namespace(IResolvable)
.resources(IResolvable)
.resources(java.util.List<java.util.Map<java.lang.String, java.lang.Object>>)
// .compositeExpression(IResolvable)
// .compositeExpression(CompositeExpressionProperty)
// .deletionForce(java.lang.Boolean)
// .deletionForce(IResolvable)
// .effectiveInterval(java.lang.String)
// .effectiveInterval(IResolvable)
// .emailSubject(java.lang.String)
// .emailSubject(IResolvable)
// .interval(java.lang.Number)
// .interval(IResolvable)
// .labels(IResolvable)
// .labels(java.util.List<IResolvable)
// .labels(LabelsProperty>)
// .noDataPolicy(java.lang.String)
// .noDataPolicy(IResolvable)
// .noEffectiveInterval(java.lang.String)
// .noEffectiveInterval(IResolvable)
// .period(java.lang.Number)
// .period(IResolvable)
// .prometheus(IResolvable)
// .prometheus(PrometheusProperty)
// .ruleId(java.lang.String)
// .ruleId(IResolvable)
// .ruleName(java.lang.String)
// .ruleName(IResolvable)
// .silenceTime(java.lang.Number)
// .silenceTime(IResolvable)
// .webhook(java.lang.String)
// .webhook(IResolvable)
.build();
Name | Type | Description |
---|---|---|
scope |
com.aliyun.ros.cdk.core.Construct |
No description. |
id |
java.lang.String |
No description. |
enableResourcePropertyConstraint |
java.lang.Boolean |
No description. |
contactGroups |
com.aliyun.ros.cdk.core.IResolvable OR java.util.List |
Property contactGroups: The alert contact group. |
escalations |
com.aliyun.ros.cdk.core.IResolvable OR EscalationsProperty |
Property escalations: You must select at least one of the Critical, Warn, and Info alert levels. |
metricName |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property metricName: The name of the metric. |
namespace |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property namespace: The namespace of the cloud service. |
resources |
com.aliyun.ros.cdk.core.IResolvable OR java.util.List |
Property resources: The information about the resource. |
compositeExpression |
com.aliyun.ros.cdk.core.IResolvable OR CompositeExpressionProperty |
Property compositeExpression: The trigger conditions for multiple metrics. |
deletionForce |
java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable |
Property deletionForce: Whether to delete rule even if it is not created by ROS. |
effectiveInterval |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property effectiveInterval: The time period during which the alert rule is effective. |
emailSubject |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property emailSubject: The subject of the alert notification email. |
interval |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property interval: The interval at which the alert is triggered. |
labels |
com.aliyun.ros.cdk.core.IResolvable OR java.util.List |
Property labels:. |
noDataPolicy |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property noDataPolicy: The processing method of alerts when no monitoring data is found. |
noEffectiveInterval |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property noEffectiveInterval: The time period during which the alert rule is ineffective. |
period |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property period: The statistical period of the metric. |
prometheus |
com.aliyun.ros.cdk.core.IResolvable OR PrometheusProperty |
Property prometheus: The Prometheus alert rule. |
ruleId |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property ruleId: The ID of the alert rule. |
ruleName |
java.lang.String OR com.aliyun.ros.cdk.core.IResolvable |
Property ruleName: The name of the alert rule. |
silenceTime |
java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable |
Property silenceTime: The mute period during which new alerts are not sent even if the trigger conditions are met. |
webhook |
java.lang.String OR com.aliyun.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. |
scope
Required
- Type: com.aliyun.ros.cdk.core.Construct
id
Required
- Type: java.lang.String
enableResourcePropertyConstraint
Optional
- Type: java.lang.Boolean
contactGroups
Required
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
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: com.aliyun.ros.cdk.core.IResolvable OR EscalationsProperty
Property escalations: You must select at least one of the Critical, Warn, and Info alert levels.
metricName
Required
- Type: java.lang.String OR com.aliyun.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: java.lang.String OR com.aliyun.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: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
>
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.
compositeExpression
Optional
- Type: com.aliyun.ros.cdk.core.IResolvable OR 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.
deletionForce
Optional
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property deletionForce: Whether to delete rule even if it is not created by ROS.
Default is false
effectiveInterval
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property effectiveInterval: The time period during which the alert rule is effective.
emailSubject
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property emailSubject: The subject of the alert notification email.
interval
Optional
- Type: java.lang.Number OR com.aliyun.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: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
LabelsProperty>
Property labels:.
noDataPolicy
Optional
- Type: java.lang.String OR com.aliyun.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.
noEffectiveInterval
Optional
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Property noEffectiveInterval: The time period during which the alert rule is ineffective.
period
Optional
- Type: java.lang.Number OR com.aliyun.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: com.aliyun.ros.cdk.core.IResolvable OR PrometheusProperty
Property prometheus: The Prometheus alert rule.
Note: This parameter is required only when you create a Prometheus alert rule for Hybrid Cloud Monitoring.
ruleId
Optional
- Type: java.lang.String OR com.aliyun.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.
ruleName
Optional
- Type: java.lang.String OR com.aliyun.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.
silenceTime
Optional
- Type: java.lang.Number OR com.aliyun.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: java.lang.String OR com.aliyun.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.
Methods
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
addCondition |
No description. |
addCount |
No description. |
addDependency |
No description. |
addResourceDesc |
No description. |
applyRemovalPolicy |
No description. |
getAtt |
No description. |
setMetadata |
No description. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
synthesize
public void synthesize(ISynthesisSession session)
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: com.aliyun.ros.cdk.core.ISynthesisSession
The synthesis session.
addCondition
public void addCondition(RosCondition condition)
- Type: com.aliyun.ros.cdk.core.RosCondition
addCount
public void addCount(java.lang.Number OR IResolvable count)
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
addDependency
public void addDependency(Resource resource)
- Type: com.aliyun.ros.cdk.core.Resource
addResourceDesc
public void addResourceDesc(java.lang.String desc)
- Type: java.lang.String
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
- Type: com.aliyun.ros.cdk.core.RemovalPolicy
getAtt
public IResolvable getAtt(java.lang.String name)
- Type: java.lang.String
setMetadata
public void setMetadata(java.lang.String key, java.lang.Object value)
- Type: java.lang.String
- Type: java.lang.Object
Static Functions
Name | Description |
---|---|
isConstruct |
Return whether the given object is a Construct. |
isConstruct
import com.aliyun.ros.cdk.cms.ResourceMetricRule;
ResourceMetricRule.isConstruct(java.lang.Object x)
Return whether the given object is a Construct.
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
com.aliyun.ros.cdk.core.ConstructNode |
The construct tree node associated with this construct. |
ref |
java.lang.String |
No description. |
stack |
com.aliyun.ros.cdk.core.Stack |
The stack in which this resource is defined. |
resource |
com.aliyun.ros.cdk.core.RosResource |
No description. |
attrRuleId |
com.aliyun.ros.cdk.core.IResolvable |
Attribute RuleId: The ID of the alert rule. |
attrRuleName |
com.aliyun.ros.cdk.core.IResolvable |
Attribute RuleName: The name of the alert rule. |
node
Required
public ConstructNode getNode();
- Type: com.aliyun.ros.cdk.core.ConstructNode
The construct tree node associated with this construct.
ref
Required
public java.lang.String getRef();
- Type: java.lang.String
stack
Required
public Stack getStack();
- Type: com.aliyun.ros.cdk.core.Stack
The stack in which this resource is defined.
resource
Optional
public RosResource getResource();
- Type: com.aliyun.ros.cdk.core.RosResource
attrRuleId
Required
public IResolvable getAttrRuleId();
- Type: com.aliyun.ros.cdk.core.IResolvable
Attribute RuleId: The ID of the alert rule.
attrRuleName
Required
public IResolvable getAttrRuleName();
- Type: com.aliyun.ros.cdk.core.IResolvable
Attribute RuleName: The name of the alert rule.