Create¶
POST /api/v1/monitor/mute/create
Overview¶
Create a mute rule
Body Request Parameters¶
Parameter Name | Type | Required | Description |
---|---|---|---|
muteRanges | array | Mute range Can be empty: False |
|
name | string | Rule name Example: Name A Can be empty: False |
|
description | string | Description Example: Description A Can be empty: False Can be an empty string: True |
|
tags | json | Tag set Can be empty: False |
|
filterString | string | Event properties Can be empty: False Can be an empty string: True Maximum length: 2048 |
|
notifyTargets | array | Notification targets Can be empty: False |
|
notifyMessage | string | Notification message Can be empty: False Maximum length: 3000 |
|
notifyTimeStr | string | Notification time, %Y/%m/%d %H:%M:%S Example: 2023/08/21 19:19:00 Can be empty: False Can be an empty string: True |
|
startTime | string | Start time %Y/%m/%d %H:%M:%S Example: 2023/08/21 19:19:00 Can be empty: False |
|
endTime | string | End time %Y/%m/%d %H:%M:%S Example: 2023/08/21 19:19:00 Can be empty: False Can be an empty string: True |
|
repeatTimeSet | int | Y | Repeat configuration value sends 1, mute time is single sends 0 Example: 0 Can be empty: False |
repeatCrontabSet | None | Repeat crontab configuration Can be empty: False |
|
repeatCrontabSet.min | string | Minute Example: 10 Can be empty: False |
|
repeatCrontabSet.hour | string | Hour Example: 10 Can be empty: False |
|
repeatCrontabSet.day | string | Day Example: * Can be empty: False |
|
repeatCrontabSet.month | string | Month Example: * Can be empty: False |
|
repeatCrontabSet.week | string | Week Example: 1,3 Can be empty: False |
|
crontabDuration | int | End time minus start time, positive integer, unit in seconds Example: 3600 Can be empty: False |
|
repeatExpireTime | string | Repeat end time %Y/%m/%d %H:%M:%S Example: 0 Can be empty: False Can be an empty string: True |
|
timezone | str | Y | Mute rule timezone Example: Asia/Shanghai Can be empty: False |
type | str | Y | Mute rule type Example: custom Can be empty: False Optional values: ['checker', 'alertPolicy', 'tag', 'custom'] |
declaration | json | Custom claim information Can be empty: False |
Additional Parameter Explanation¶
Data explanation.*
1.Request parameter explanation
Parameter Name | type | Description |
---|---|---|
type | string | Corresponding mute rule type Monitor:checker, Alert strategy:monitor, Monitor tag:tag, Custom:custom |
muteRanges | list | Mute range, includes monitors, intelligent inspections, self-built inspections, SLOs, alert strategies |
name | str | Rule name |
description | str | Description |
tags | dict | Advanced configuration, event properties |
filterString | str | Event properties (expression form input) |
notifyTargets | list | to: List as notification objects, type as their notification types |
repeatTimeSet | int | Whether to repeat mute, 1 means enable repeat mute, 0 means only once |
repeatCrontabSet | dict | Repeat mute rule time configuration |
crontabDuration | int | Represents the duration of silence after the scheduled task starts |
notifyTargets | list | to: List as notification objects, type as their notification types | |
notifyTimeStr | str | Notification time,%Y/%m/%d %H:%M:%S |
startTime | str | Silence start time %Y/%m/%d %H:%M:%S |
endTime | str | Silence end time %Y/%m/%d %H:%M:%S |
repeatExpireTime | str | 0 represents forever repeat, repeat mute expiration time %Y/%m/%d %H:%M:%S |
timezone | str | Corresponding task timezone default Asia/Shanghai |
repeatExpire | int | Repeat mute expiration time (discontinued on 2023-08-24) |
start | int | Silence start time (discontinued on 2023-08-24) |
end | int | Silence end time (discontinued on 2023-08-24) | |
notifyTime | int | Notification time, corresponding second-level timestamp, -1 means immediate notification (discontinued on 2023-08-24) |
declaration | dict | Custom claim information |
-------------- |
2.Mute range explanation
Parameter Name | type | Required | Description |
---|---|---|---|
type | string | Y | Corresponding mute rule type Monitor:checker, Alert strategy:monitor, Monitor tag:tag, Custom:custom |
muteRanges | list | Y | Mute range, [] represents select all |
tags | dict | Y | Advanced configuration, event properties |
filterString | str | Event properties (expression form input) |
Tags configuration supports reverse selection configuration, example:
Type is checker, monitor type, example:
{
"tags": {
"host": [
"cn-hangzhou"
]
},
"muteRanges": [
{
"name": "Infrastructure survival detection - type ReplicaSet - {Result}",
"checkerUUID": "rul_xxxx22",
},
{
"name": "hhh",
"checkerUUID": "rul_xxxx21",
}
],
"type": "checker"
}
Type is alertPolicy, alert strategy type, example:
{
"tags": {
"host": [
"cn-hangzhou"
]
},
"muteRanges": [
{
"name": "gary-test1234",
"alertPolicyUUID": "altpl_xxxx26",
}
],
"type": "alertPolicy",
}
Type is tag, monitor tag, example:
{
"tags": {
"service": [
"kodo.nsq.consumer"
]
},
"muteRanges": [
{
"name": "zyl_test",
"tagUUID": "tag_xxxx23",
},
{
"name": "0306",
"tagUUID": "tag_xxxx28",
}
],
"type": "tag"
}
Type is custom, custom type, example:
{
"tags": {
"service": [
"kodo.nsq.consumer"
]
},
"muteRanges": [
{
"name": "Monitor optimization verification - Update 2",
"checkerUUID": "rul_xxxx22",
},
{
"name": "0306",
"tagUUID": "tag_xxxx25",
},
{
"name": "slo_test",
"sloUUID": "monitor_xxxx25",
}
],
"type": "custom",
}
filterString is the new event property, syntax follows the explorer syntax. Currently, the interface also supports tags as the old version event properties, prioritizing the value of filterString, for example:
3.Mute time explanation
Mute time is divided into single mute and repeated mute.
Single mute parameter configuration:
Parameter Name | type | Description |
---|---|---|
repeatTimeSet | int | Whether to repeat mute, 1 means enable repeat mute, 0 means only once |
startTime | str | Silence start time %Y/%m/%d %H:%M:%S |
endTime | str | Silence end time %Y/%m/%d %H:%M:%S |
timezone | str | Corresponding task timezone default Asia/Shanghai |
repeatTimeSet is 0, single mute, example:
{
"startTime": "2024/03/27 14:06:57",
"endTime": "2024/03/27 15:06:57",
"timezone": "Asia/Shanghai",
"repeatTimeSet": 0
}
Repeated mute parameter configuration:
Parameter Name | type | Description |
---|---|---|
repeatTimeSet | int | Whether to repeat mute, 1 means enable repeat mute, 0 means only once |
repeatCrontabSet | dict | Repeated mute rule time configuration , used for starting Crontab (Crontab syntax) |
crontabDuration | int | Represents the duration of silence after the scheduled task starts, unit seconds |
repeatExpireTime | str | 0 means forever repeat, repeated mute expiration time %Y/%m/%d %H:%M:%S |
timezone | str | Corresponding task timezone default Asia/Shanghai |
repeatTimeSet is 1, repeated mute, example:
{
"timezone": "Asia/Shanghai",
"repeatTimeSet": 1,
"repeatCrontabSet": {
"min": "0",
"hour": "0",
"day": "*",
"month": "*",
"week": "1,2"
},
"crontabDuration": 18000,
"repeatExpireTime": "0"
}
Request Example¶
curl 'https://openapi.guance.com/api/v1/monitor/mute/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"Name A","description":"Description A","startTime":"2023/08/23 14:00:07","endTime":"2023/08/23 14:31:07","notifyTargets":[{"to":["acnt_xxxx32"],"type":"mail"}],"tags":{},"muteRanges":[{"name":"Aerospike cluster【{cluster_name}】space【{{ ns }}】 Memory usage rate is too high","checkerUUID":"rul_xxxx32","type":"Monitor"}],"type":"checker","timezone":"Asia/Shanghai","notifyMessage":"cjkackcnkjcklasc","notifyTimeStr":"2023/08/23 13:45:07","repeatTimeSet":0}' \
--compressed \
--insecure
Response¶
{
"code": 200,
"content": {
"createAt": 1692771116,
"creator": "acnt_xxxx32",
"crontab": "",
"crontabDuration": 0,
"deleteAt": -1,
"description": "Description A",
"end": 1692772267,
"endTime": "2023/08/23 14:31:07",
"id": 643,
"muteRanges": [
{
"checkerUUID": "rul_xxxx32",
"name": "Aerospike cluster【{cluster_name}】space【{{ ns }}】 Memory usage rate is too high",
"type": "Monitor"
}
],
"name": "Name A",
"notifyMessage": "cjkackcnkjcklasc",
"notifyTargets": [
{
"to": [
"acnt_xxxx32"
],
"type": "mail"
}
],
"notifyTime": 1692769507,
"notifyTimeStr": "2023/08/23 13:45:07",
"repeatExpire": -1,
"repeatExpireTime": "-1",
"start": 1692770407,
"startTime": "2023/08/23 14:00:07",
"status": 0,
"tags": {},
"timezone": "Asia/Shanghai",
"type": "checker",
"updateAt": 1692771117,
"updator": "acnt_xxxx32",
"uuid": "mute_xxxx32",
"workspaceUUID": "wksp_xxxx32"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-C5BE0235-BB41-437E-801E-F925E98F8616"
}