Create¶
POST /api/v1/monitor/mute/create
Overview¶
Create a Mute rule
Body Request Parameters¶
Parameter Name | Type | Required | Description |
---|---|---|---|
muteRanges | array | Mute ranges Allow empty: False |
|
name | string | Rule name Example: Name A Allow empty: False |
|
description | string | Description Example: Description A Allow empty: False Allow empty string: True |
|
tags | json | Tag set Allow empty: False |
|
filterString | string | Event attributes Allow empty: False Allow empty string: True Max length: 2048 |
|
notifyTargets | array | Notification targets Allow empty: False |
|
notifyMessage | string | Notification message Allow empty: False Max length: 3000 |
|
notifyTimeStr | string | Notification time, %Y/%m/%d %H:%M:%S Example: 2023/08/21 19:19:00 Allow empty: False Allow empty string: True |
|
startTime | string | Start time %Y/%m/%d %H:%M:%S Example: 2023/08/21 19:19:00 Allow empty: False |
|
endTime | string | End time %Y/%m/%d %H:%M:%S Example: 2023/08/21 19:19:00 Allow empty: False Allow empty string: True |
|
repeatTimeSet | int | Y | Repeat configuration value is 1, Mute time is single time is 0 Example: 0 Allow empty: False |
repeatCrontabSet | None | Repeat crontab configuration Allow empty: False |
|
repeatCrontabSet.min | string | Minute Example: 10 Allow empty: False |
|
repeatCrontabSet.hour | string | Hour Example: 10 Allow empty: False |
|
repeatCrontabSet.day | string | Day Example: * Allow empty: False |
|
repeatCrontabSet.month | string | Month Example: * Allow empty: False |
|
repeatCrontabSet.week | string | Week Example: 1,3 Allow empty: False |
|
crontabDuration | int | End time minus start time, positive integer, unit is s Example: 3600 Allow empty: False |
|
repeatExpireTime | string | Repeat end time %Y/%m/%d %H:%M:%S Example: 0 Allow empty: False Allow empty string: True |
|
timezone | str | Y | Mute rule timezone Example: Asia/Shanghai Allow empty: False |
type | str | Y | Mute rule type Example: custom Allow empty: False Optional values: ['checker', 'alertPolicy', 'tag', 'custom'] |
declaration | json | Custom declaration information Allow empty: False |
Parameter Additional Explanation¶
Data Explanation.*
1. Request Parameter Explanation
Parameter Name | Type | Description |
---|---|---|
type | string | Corresponding Mute rule type checker:checker, alertPolicy:monitor, tag:tag, custom:custom |
muteRanges | list | Mute ranges, including checker, Intelligent Inspection, Self-built Nodes, SLO, alertPolicy |
name | str | Rule name |
description | str | Description |
tags | dict | Advanced configuration, event attributes |
filterString | str | Event attributes (expression form input) |
notifyTargets | list | to: list is notification targets, type is notification type |
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 Mute after the scheduled task starts, unit is s |
notifyTargets | list | to: list is notification targets, type is notification type |
notifyTimeStr | str | Notification time,%Y/%m/%d %H:%M:%S |
startTime | str | Mute start time %Y/%m/%d %H:%M:%S |
endTime | str | Mute end time %Y/%m/%d %H:%M:%S |
repeatExpireTime | str | 0 means repeat forever, repeat Mute expiration time %Y/%m/%d %H:%M:%S |
timezone | str | Corresponding task timezone default Asia/Shanghai |
repeatExpire | int | Repeat Mute expiration time (deprecated on 2023-08-24) |
start | int | Mute start time (deprecated on 2023-08-24) |
end | int | Mute end time (deprecated on 2023-08-24) |
notifyTime | int | Notification time, second level timestamp of time point, -1 means notify immediately (deprecated on 2023-08-24) |
declaration | dict | Custom declaration information |
2. Mute Ranges Explanation
Parameter Name | Type | Required | Description |
---|---|---|---|
type | string | Y | Corresponding Mute rule type checker:checker, alertPolicy:monitor, tag:tag, custom:custom |
muteRanges | list | Y | Mute ranges, [] means select all |
tags | dict | Y | Advanced configuration, event attributes |
filterString | str | Event attributes (expression form input) |
tags configuration supports reverse selection configuration, example:
type is checker, checker type, example:
{
"tags": {
"host": [
"cn-hangzhou"
]
},
"muteRanges": [
{
"name": "Infrastructure survival detection-type is ReplicaSet- {Result}",
"checkerUUID": "rul_xxxx22",
},
{
"name": "hhh",
"checkerUUID": "rul_xxxx21",
}
],
"type": "checker"
}
type is alertPolicy, alertPolicy type, example:
{
"tags": {
"host": [
"cn-hangzhou"
]
},
"muteRanges": [
{
"name": "gary-test1234",
"alertPolicyUUID": "altpl_xxxx26",
}
],
"type": "alertPolicy",
}
type is tag, checker 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": "Checker optimization verification-update 2",
"checkerUUID": "rul_xxxx22",
},
{
"name": "0306",
"tagUUID": "tag_xxxx25",
},
{
"name": "slo_test",
"sloUUID": "monitor_xxxx25",
}
],
"type": "custom",
}
filterString is the new version of event attributes, the syntax follows the Explorer syntax, currently the interface is also compatible with tags as the old version of event attributes, priority is given to the value of filterString, for example:
3. Mute Time Explanation
Mute time is divided into single Mute, repeat 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 | Mute start time %Y/%m/%d %H:%M:%S |
endTime | str | Mute 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
}
Repeat Mute parameter configuration:
Parameter Name | Type | Description |
---|---|---|
repeatTimeSet | int | Whether to repeat Mute, 1 means enable repeat Mute, 0 means only once |
repeatCrontabSet | dict | Repeat Mute rule time configuration , used for group start Crontab (Crontab syntax) |
crontabDuration | int | Represents the duration of Mute after the scheduled task starts, unit is s |
repeatExpireTime | str | 0 means repeat forever, repeat Mute expiration time %Y/%m/%d %H:%M:%S |
timezone | str | Corresponding task timezone default Asia/Shanghai |
repeatTimeSet is 1, repeat 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.truewatch.com/api/v1/monitor/mute/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"nameA","description":"descA","startTime":"2023/08/23 14:00:07","endTime":"2023/08/23 14:31:07","notifyTargets":[{"to":["acnt_xxxx32"],"type":"mail"}],"tags":{},"muteRanges":[{"name":"The Memory usage rate of the Aerospike cluster [{cluster_name}] space [{ns}] is too high","checkerUUID":"rul_xxxx32","type":"checker"}],"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": "descA",
"end": 1692772267,
"endTime": "2023/08/23 14:31:07",
"id": 643,
"muteRanges": [
{
"checkerUUID": "rul_xxxx32",
"name": "The Memory usage rate of the Aerospike cluster [{cluster_name}] space [{ns}] is too high",
"type": "checker"
}
],
"name": "nameA",
"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"
}