All Products
Search
Document Center

Application Real-Time Monitoring Service:CreateOrUpdateSilencePolicy

Last Updated:Nov 05, 2024

Creates or modifies a silence policy.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
arms:CreateDispatchRulenone
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
IdlongNo

The ID of the silence policy.

  • If you do not configure this parameter, a new silence policy is created.
  • If you configure this parameter, the specified silence policy is modified.
1234
NamestringYes

The name of the silence policy.

silencepolicy_test
MatchingRulesstringNo

The matching rules. The following code shows the format of matching rules:

[
     {
	 "matchingConditions": [
	 {
	 "value": "test", // The value of the matching condition. 
	 "key": "altertname", // The key of the matching condition. 
	 "operator": "eq" // The logical operator of the matching condition, including eq (equal to), neq (not equal to), in (contains), nin (does not contain), re (regular expression match), and nre (regular expression mismatch).   
	 }
	 ]
     }
	 ]
[ { "matchingConditions": [ { "value": "test", "key": "altertname", "operator": "eq" } ] } ]
RegionIdstringNo

The ID of the region.

cn-hangzhou
StatestringNo

Specifies whether to enable the silence policy. Valid values: enable and disable.

enable
EffectiveTimeTypestringNo

The effective duration of the silence policy. Valid values: PERMANENT, CUSTOM_TIME, and CYCLE_EFFECT.

PERMANENT
TimePeriodstringNo

The recurring period. This parameter is required when EffectiveTimeType is set to CYCLE_EFFECT. DAY: The silence policy is effective by day. WEEK: The silence policy is effective by week.

DAY
TimeSlotsstringNo

The time period during which the silence policy is effective. If you set EffectiveTimeType to CUSTOM_TIME, specify a custom time period in the following format: [{"startTime":"2024-08-04 22:13","endTime":"2024-08-04 22:21"}] If you set EffectiveTimeType to CYCLE_EFFECT and TimePeriod to DAY, specify a custom time period in the following format: [{"startTime":"22:13","endTime":"22:21"}]. The start time cannot be later than the end time. If you set EffectiveTimeType to CYCLE_EFFECT and TimePeriod to WEEK, specify a custom time period in the following format: [{"startWeek":"1", "endWeek":"2" "startTime":"22:13","endTime":"22:21"}]. Valid values of startWeek and endWeek: 1 to 7. The start time cannot be later than the end time.

[{"startTime":"2024-08-04 22:13","endTime":"2024-08-04 22:21"}]

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The ID of the request.

A5EC8221-08F2-4C95-9AF1-49FD998C****
SilencePolicyobject

A list of silence policies.

Idlong

The ID of the silence policy.

1234
Namestring

The name of the silence policy.

silencepolicy_test
MatchingRulesarray<object>

A list of matching rules.

matchingRulesobject

The matching rule.

MatchingConditionsarray<object>

A list of matching conditions.

matchingConditionsobject

The matching condition.

Keystring

The key of the matching condition.

altertname
Valuestring

The value of the matching condition.

test
Operatorstring

The logical operator of the matching condition. Valid values:

  • eq: equal to
  • neq: not equal to
  • in: contains
  • nin: does not contain
  • re: regular expression match
  • nre: regular expression mismatch
eq
Statestring

Specifies whether to enable the silence policy. Valid values: enable and disable.

enable

Examples

Sample success responses

JSONformat

{
  "RequestId": "A5EC8221-08F2-4C95-9AF1-49FD998C****",
  "SilencePolicy": {
    "Id": 1234,
    "Name": "silencepolicy_test",
    "MatchingRules": [
      {
        "MatchingConditions": [
          {
            "Key": "altertname",
            "Value": "test",
            "Operator": "eq"
          }
        ]
      }
    ],
    "State": "enable",
    "EffectiveTimeType": "",
    "TimePeriod": "",
    "TimeSlots": ""
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-08-12The request parameters of the API has changed. The response structure of the API has changedView Change Details
2024-05-24The response structure of the API has changedView Change Details
2024-05-24The request parameters of the API has changed. The response structure of the API has changedView Change Details
2022-02-24Add OperationView Change Details