Skip to content

ResourceMetricRule

This class encapsulates and extends the ROS resource type ALIYUN::CMS::ResourceMetricRule.

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>)
    .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)
//  .escalations(IResolvable)
//  .escalations(EscalationsProperty)
//  .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.
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 alert 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.
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.
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.ListLabelsProperty> Property labels: Labels to add to a triggered alert.
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 configurations for a 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.

scopeRequired

  • Type: com.aliyun.ros.cdk.core.Construct

idRequired

  • Type: java.lang.String

enableResourcePropertyConstraintOptional

  • Type: java.lang.Boolean

contactGroupsRequired

  • 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.


metricNameRequired

  • 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.


namespaceRequired

  • 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.


resourcesRequired

  • 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.


compositeExpressionOptional

Property compositeExpression: The alert conditions for multiple metrics.

The settings for a single metric and multiple metrics are mutually exclusive. You cannot configure both.


deletionForceOptional

  • 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


effectiveIntervalOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property effectiveInterval: The time period during which the alert rule is effective.


emailSubjectOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property emailSubject: The subject of the alert notification email.


escalationsOptional

Property escalations: You must select at least one of the Critical, Warn, and Info alert levels.


intervalOptional

  • 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.


labelsOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.ListLabelsProperty>

Property labels: Labels to add to a triggered alert.

These labels appear in the alert notification.

This feature is equivalent to the label feature in Prometheus alerting.


noDataPolicyOptional

  • 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.

noEffectiveIntervalOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property noEffectiveInterval: The time period during which the alert rule is ineffective.


periodOptional

  • 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.


prometheusOptional

Property prometheus: The configurations for a Prometheus alert rule.

You need to configure this parameter only when you create a Prometheus alert rule for CloudMonitor for Enterprise.


ruleIdOptional

  • 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.


ruleNameOptional

  • 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.


silenceTimeOptional

  • 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.


webhookOptional

  • 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.
fetchCondition No description.
fetchDependency No description.
fetchResourceDesc 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.

sessionRequired

  • Type: com.aliyun.ros.cdk.core.ISynthesisSession

The synthesis session.


addCondition

public void addCondition(RosCondition condition)

conditionRequired

  • Type: com.aliyun.ros.cdk.core.RosCondition

addCount

public void addCount(java.lang.Number OR IResolvable count)

countRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

addDependency

public void addDependency(Resource resource)

resourceRequired

  • Type: com.aliyun.ros.cdk.core.Resource

addResourceDesc

public void addResourceDesc(java.lang.String desc)

descRequired

  • Type: java.lang.String

applyRemovalPolicy

public void applyRemovalPolicy(RemovalPolicy policy)

policyRequired

  • Type: com.aliyun.ros.cdk.core.RemovalPolicy

fetchCondition

public RosCondition fetchCondition()

fetchDependency

public java.util.List<java.lang.String> fetchDependency()

fetchResourceDesc

public java.lang.String fetchResourceDesc()

getAtt

public IResolvable getAtt(java.lang.String name)

nameRequired

  • Type: java.lang.String

setMetadata

public void setMetadata(java.lang.String key, java.lang.Object value)

keyRequired

  • Type: java.lang.String

valueRequired

  • 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.

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node com.aliyun.ros.cdk.core.ConstructNode The construct tree node associated with this construct.
env com.aliyun.ros.cdk.core.IResourceEnvironment The environment this resource belongs to.
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 java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Attribute RuleId: The ID of the alert rule.
attrRuleName java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Attribute RuleName: The name of the alert rule.
props ResourceMetricRuleProps No description.

nodeRequired

public ConstructNode getNode();
  • Type: com.aliyun.ros.cdk.core.ConstructNode

The construct tree node associated with this construct.


envRequired

public IResourceEnvironment getEnv();
  • Type: com.aliyun.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

public java.lang.String getRef();
  • Type: java.lang.String

stackRequired

public Stack getStack();
  • Type: com.aliyun.ros.cdk.core.Stack

The stack in which this resource is defined.


resourceOptional

public RosResource getResource();
  • Type: com.aliyun.ros.cdk.core.RosResource

attrRuleIdRequired

public java.lang.Object getAttrRuleId();
  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Attribute RuleId: The ID of the alert rule.


attrRuleNameRequired

public java.lang.Object getAttrRuleName();
  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Attribute RuleName: The name of the alert rule.


propsRequired

public ResourceMetricRuleProps getProps();