public static final class PutResourceMetricRuleRequest.Builder extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
PutResourceMetricRuleRequest |
build() |
PutResourceMetricRuleRequest.Builder |
compositeExpression(PutResourceMetricRuleRequest.CompositeExpression compositeExpression)
The trigger conditions for multiple metrics.
|
PutResourceMetricRuleRequest.Builder |
contactGroups(String contactGroups)
The alert contact groups.
|
PutResourceMetricRuleRequest.Builder |
effectiveInterval(String effectiveInterval)
The period of time during which the alert rule is effective.
|
PutResourceMetricRuleRequest.Builder |
emailSubject(String emailSubject)
The subject of the alert notification email.
|
PutResourceMetricRuleRequest.Builder |
escalations(PutResourceMetricRuleRequest.Escalations escalations)
Escalations.
|
PutResourceMetricRuleRequest.Builder |
interval(String interval)
The interval at which alerts are triggered based on the alert rule.
|
PutResourceMetricRuleRequest.Builder |
labels(List<PutResourceMetricRuleRequest.Labels> labels)
If the metric meets the specified condition in the alert rule and CloudMonitor sends an alert notification, the tag is also written to the metric and displayed in the alert notification.
|
PutResourceMetricRuleRequest.Builder |
metricName(String metricName)
The metric name.
|
PutResourceMetricRuleRequest.Builder |
namespace(String namespace)
The namespace of the cloud service.
|
PutResourceMetricRuleRequest.Builder |
noDataPolicy(String noDataPolicy)
The method that is used to handle alerts when no monitoring data is found.
|
PutResourceMetricRuleRequest.Builder |
noEffectiveInterval(String noEffectiveInterval)
The period of time during which the alert rule is ineffective.
|
PutResourceMetricRuleRequest.Builder |
period(String period)
The statistical period of the metric.
|
PutResourceMetricRuleRequest.Builder |
prometheus(PutResourceMetricRuleRequest.Prometheus prometheus)
Prometheus alerts.
|
PutResourceMetricRuleRequest.Builder |
resources(String resources)
The resource information.
|
PutResourceMetricRuleRequest.Builder |
ruleId(String ruleId)
The ID of the alert rule.
|
PutResourceMetricRuleRequest.Builder |
ruleName(String ruleName)
The name of the alert rule.
|
PutResourceMetricRuleRequest.Builder |
sendOK(Boolean sendOK)
SendOK.
|
PutResourceMetricRuleRequest.Builder |
silenceTime(Integer silenceTime)
The mute period during which new alert notifications are not sent even if the trigger conditions are met.
|
PutResourceMetricRuleRequest.Builder |
webhook(String webhook)
The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
|
public PutResourceMetricRuleRequest.Builder escalations(PutResourceMetricRuleRequest.Escalations escalations)
public PutResourceMetricRuleRequest.Builder compositeExpression(PutResourceMetricRuleRequest.CompositeExpression compositeExpression)
The trigger conditions for multiple metrics.
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.
public PutResourceMetricRuleRequest.Builder contactGroups(String contactGroups)
The alert contact groups. Alert notifications are sent to the alert contacts in the alert contact group.
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.
This parameter is required.
example:ECS_Group
public PutResourceMetricRuleRequest.Builder effectiveInterval(String effectiveInterval)
The period of time during which the alert rule is effective.
example:00:00-23:59
public PutResourceMetricRuleRequest.Builder emailSubject(String emailSubject)
The subject of the alert notification email.
public PutResourceMetricRuleRequest.Builder interval(String interval)
The interval at which alerts are triggered based on the alert rule. Unit: seconds.
example:For more information about how to query the statistical periods of metrics, see Appendix 1: Metrics.
60
public PutResourceMetricRuleRequest.Builder labels(List<PutResourceMetricRuleRequest.Labels> labels)
If the metric meets the specified condition in the alert rule and CloudMonitor sends an alert notification, the tag is also written to the metric and displayed in the alert notification.
This parameter is equivalent to the Label parameter of Prometheus alerts.
public PutResourceMetricRuleRequest.Builder metricName(String metricName)
The metric name. For more information about how to query metric names, see Appendix 1: Metrics.
If you create a Prometheus alert rule for Hybrid Cloud Monitoring, you must set this parameter to the name of the namespace. For more information about how to query the names of namespaces, see DescribeHybridMonitorNamespaceList.
This parameter is required.
example:cpu_total
public PutResourceMetricRuleRequest.Builder namespace(String namespace)
The namespace of the cloud service. For more information about how to query the namespaces of cloud services, see Appendix 1: Metrics.
If you create a Prometheus alert rule for Hybrid Cloud Monitoring, you must set this parameter to
acs_prometheus.
This parameter is required.
example:acs_ecs_dashboard
public PutResourceMetricRuleRequest.Builder noDataPolicy(String noDataPolicy)
The method that is used to handle alerts when no monitoring data is found. Valid value:
KEEP_LAST_STATE
public PutResourceMetricRuleRequest.Builder noEffectiveInterval(String noEffectiveInterval)
The period of time during which the alert rule is ineffective.
example:00:00-06:00
public PutResourceMetricRuleRequest.Builder period(String 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.
example:For more information about how to query the statistical periods of metrics, see Appendix 1: Metrics.
60
public PutResourceMetricRuleRequest.Builder prometheus(PutResourceMetricRuleRequest.Prometheus prometheus)
Prometheus alerts.
This parameter is required only if you create a Prometheus alert rule for Hybrid Cloud Monitoring.
public PutResourceMetricRuleRequest.Builder resources(String resources)
The resource information. Examples: [{"instanceId":"i-uf6j91r34rnwawoo****"}] and [{"userId":"100931896542****"}].
For more information about the supported dimensions that are used to query resources, see Appendix 1: Metrics.
example:[{"instanceId":"i-uf6j91r34rnwawoo****"}]
public PutResourceMetricRuleRequest.Builder ruleId(String ruleId)
The ID of the alert rule.
You can specify a new ID or the ID of an existing alert rule. For more information about how to query the IDs of alert rules, see DescribeMetricRuleList.
If you specify a new ID, a threshold-triggered alert rule is created.
This parameter is required.
example:a151cd6023eacee2f0978e03863cc1697c89508****
public PutResourceMetricRuleRequest.Builder ruleName(String ruleName)
The name of the alert rule.
You can specify a new name or the name of an existing alert rule. For more information about how to query the names of alert rules, see DescribeMetricRuleList.
If you specify a new name, a threshold-triggered alert rule is created.
This parameter is required.
example:test123
public PutResourceMetricRuleRequest.Builder sendOK(Boolean sendOK)
public PutResourceMetricRuleRequest.Builder silenceTime(Integer silenceTime)
The mute period during which new alert notifications are not sent even if the trigger conditions are met. Unit: seconds. Default value: 86400.
example:If an alert is not cleared after the mute period ends, CloudMonitor resends an alert notification.
86400
public PutResourceMetricRuleRequest.Builder webhook(String webhook)
The callback URL to which a POST request is sent when an alert is triggered based on the alert rule.
example:public PutResourceMetricRuleRequest build()
Copyright © 2026. All rights reserved.