Modify a Monitor¶
POST /api/v1/checker/{rule_uuid}/modify
Overview¶
Modify the specified monitor information based on rule_uuid
Route Parameters¶
Parameter Name | Type | Required | Description |
---|---|---|---|
rule_uuid | string | Y | ID of the check item |
Body Request Parameters¶
Parameter Name | Type | Required | Description |
---|---|---|---|
extend | json | Additional information Can be empty: True |
|
status | integer | Monitor status field, 0 for enabled state, 2 for disabled state, default is enabled state, (added in iteration on 2025-02-19) Can be empty: False Optional values: [0, 2] |
|
monitorUUID | string | Group ID Can be empty: False Can be an empty string: True |
|
alertPolicyUUIDs | array | Alert policy UUID Can be empty: False |
|
dashboardUUID | string | Associated dashboard ID Can be empty: False |
|
tags | array | Tag names used for filtering Can be empty: False Example: ['xx', 'yy'] |
|
secret | string | Unique identifier secret in the middle of the Webhook URL Can be empty: False Example: secret_xxxxx |
|
jsonScript | json | Rule configuration Can be empty: False |
|
jsonScript.type | string | Y | Check method type Example: simpleCheck Can be empty: False |
jsonScript.windowDql | string | Window DQL Can be empty: False |
|
jsonScript.title | string | Y | Title of the generated event Example: Monitor: {monitor_name} Checker:{monitor_checker_name} Trigger value:{M1} Can be empty: False Can be an empty string: True Maximum length: 256 |
jsonScript.message | string | Event content Example: status: {status}, title: {title} Can be empty: False Can be an empty string: True |
|
jsonScript.recoverTitle | string | Output recovery event title template Example: Monitor: {monitor_name} Checker:{monitor_checker_name} Trigger value:{M1} Can be empty: False Can be an empty string: True |
|
jsonScript.recoverMessage | string | Output recovery event message template Example: status: {status}, title: {title} Can be empty: False Can be an empty string: True |
|
jsonScript.noDataTitle | string | Output no data event title template Example: Monitor: {monitor_name} Checker:{monitor_checker_name} Trigger value:{M1} Can be empty: False Can be an empty string: True |
|
jsonScript.noDataMessage | string | Output no data event message template Example: status: {status}, title: {title} Can be empty: False Can be an empty string: True |
|
jsonScript.openNotificationMessage | boolean | Whether to enable event notification content, default is not enabled (use event content as notification content) Example: False Can be empty: False |
|
jsonScript.notificationMessage | string | Event notification content Example: Monitor: {monitor_name} Checker:{monitor_checker_name} Trigger value:{M1} Can be empty: False Can be an empty string: True |
|
jsonScript.openNoDataNotificationMessage | boolean | Whether to enable no data event notification content, default is not enabled (use no data event content as notification content) Example: False Can be empty: False |
|
jsonScript.noDataNotificationMessage | string | No data event notification content Example: status: {status}, title: {title} Can be empty: False Can be an empty string: True |
|
jsonScript.noDataRecoverTitle | string | Output no data recovery event title template Example: Monitor: {monitor_name} Checker:{monitor_checker_name} Trigger value:{M1} Can be empty: False Can be an empty string: True |
|
jsonScript.noDataRecoverMessage | string | Output no data recovery event message template Example: status: {status}, title: {title} Can be empty: False Can be an empty string: True |
|
jsonScript.every | string | Check frequency Example: 1m Can be empty: False |
|
jsonScript.customCrontab | string | Custom check frequency Example: 0 */12 * * * Can be empty: False |
|
jsonScript.interval | integer | Query interval, i.e., the time range difference for one query Example: 60 Can be empty: False |
|
jsonScript.range | integer | Range parameter for advanced detection and anomaly detection, unit s Example: 3600 Can be empty: False |
|
jsonScript.range_2 | integer | Range_2 parameter for advanced detection and anomaly detection, unit s, special note (-1 represents year-over-year, 0 represents using periodBefore field) Example: 600 Can be empty: False |
|
jsonScript.periodBefore | integer | Yesterday/hour-ago parameter for advanced detection and anomaly detection, unit s Example: 600 Can be empty: False |
|
jsonScript.recoverNeedPeriodCount | integer | Specifies how many check cycles after an anomaly generates a recovery event. If the check frequency is custom crontab, this field indicates the time length, unit s; otherwise, it indicates the number of check cycles. Example: 60 Can be empty: False |
|
jsonScript.noDataInterval | integer | How long without data will generate a no data event Example: 60 Can be empty: False |
|
jsonScript.noDataAction | string | No data handling action Can be empty: False Optional values: ['none', 'checkAs0', 'noDataEvent', 'criticalEvent', 'errorEvent', 'warningEvent', 'okEvent', 'noData', 'recover'] |
|
jsonScript.checkFuncs | array | List of check function information Example: [{'funcId': 'xxx', 'kwargs': {}}] Can be empty: False |
|
jsonScript.groupBy | array | Trigger dimensions Example: ['hospital'] Can be empty: False |
|
jsonScript.targets | array | Check targets Example: [{'dql': 'M:: soldier_info :(AVG(potential_value )) [::auto] by gender ', 'alias': 'M1'}] Can be empty: False |
|
jsonScript.checkerOpt | json | Check condition settings Can be empty: False |
|
jsonScript.checkerOpt.rules | array | List of trigger conditions Example: [{'status': 'warning', 'conditions': [{'operands': [60], 'operator': '>', 'alias': 'M1'}], 'conditionLogic': 'and', 'matchTimes': 10}] Can be empty: False |
|
jsonScript.checkerOpt.openMatchTimes | boolean | Enable continuous trigger judgment, default is off false Example: True |
|
jsonScript.checkerOpt.infoEvent | boolean | Whether to generate info events when continuously normal, default is false Example: True |
|
jsonScript.checkerOpt.diffMode | string | Difference mode for anomaly detection in advanced detection, enum value, value, percent Example: value Optional values: ['value', 'percent'] |
|
jsonScript.checkerOpt.direction | string | Trigger condition direction for anomaly detection and interval detection in advanced detection Example: up Optional values: ['up', 'down', 'both'] |
|
jsonScript.checkerOpt.eps | float | Distance parameter, range: 0 ~ 3.0 Example: 0.5 |
|
jsonScript.checkerOpt.threshold | json | Premise condition settings for anomaly detection Can be empty: False |
|
jsonScript.checkerOpt.threshold.status | boolean | Y | Whether to enable premise condition for anomaly detection, Example: True |
jsonScript.checkerOpt.threshold.operator | string | Y | Operator for premise condition of anomaly detection Example: |
jsonScript.checkerOpt.threshold.value | float | Y | Detection value for premise condition of anomaly detection Example: 90 Can be empty: True |
jsonScript.checkerOpt.combineExpr | string | Combination monitoring, combination method Example: A && B Cannot be an empty string: False |
|
jsonScript.checkerOpt.ignoreNodata | boolean | Combination monitoring, whether to ignore no data results (true means ignoring), Example: True |
|
jsonScript.checkerOpt.confidenceInterval | integer | Interval detection V2 new parameter, confidence interval range 1-100, Example: 10 |
|
jsonScript.channels | array | List of channel UUIDs Example: ['name1', 'name2'] Can be empty: False |
|
jsonScript.atAccounts | array | List of account UUIDs to be @ in normal detection Example: ['xx1', 'xx2'] Can be empty: False |
|
jsonScript.atNoDataAccounts | array | List of account UUIDs to be @ in no data case Example: ['xx1', 'xx2'] Can be empty: False |
|
jsonScript.subUri | string | Suffix of the Webhook URL Example: datakit/push Can be empty: False |
|
jsonScript.disableCheckEndTime | boolean | Whether to disable end time restriction Example: True Can be empty: False |
|
jsonScript.eventChartEnable | boolean | Whether to enable event chart, default is disabled (note that it only takes effect when the main storage engine logging is doris) Example: False Can be empty: False |
|
jsonScript.eventCharts | array | List of event charts Example: True Can be empty: False |
|
jsonScript.eventCharts[*] | None | ||
jsonScript.eventCharts[*].dql | string | Query statement of the event chart Example: M:: cpu :(avg(load5s )) BY host Can be empty: False |
|
openPermissionSet | boolean | Enable custom permission configuration, (default false: not enabled), if enabled, the operation permissions of this rule are based on permissionSet Can be empty: False |
|
permissionSet | array | Operation permission configuration, can configure (role (except owner), member UUID, team UUID) Example: ['wsAdmin', 'acnt_xxxx', 'group_yyyy'] Can be empty: False |
Parameter Supplemental Explanation¶
Request Example¶
curl 'https://openapi.guance.com/api/v1/checker/rul_xxxxxx/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"extend":{"querylist":[{"datasource":"dataflux","qtype":"dql","query":{"code":"Result","type":"simple","namespace":"metric","dataSource":"ssh","field":"ssh_check","fieldType":"float","alias":"","fieldFunc":"count","groupByTime":"","groupBy":["host"],"q":"M::`ssh`:(count(`ssh_check`)) BY `host`","funcList":[]},"uuid":"aada629a-672e-46f9-9503-8fd61065c382"}],"funcName":"","rules":[{"conditionLogic":"and","conditions":[{"alias":"Result","operands":["90"],"operator":">="}],"status":"critical"},{"conditionLogic":"and","conditions":[{"alias":"Result","operands":["0"],"operator":">="}],"status":"error"}],"issueLevelUUID":"system_level_3","isNeedCreateIssue":false,"needRecoverIssue":false},"jsonScript":{"title":"Host {{ host }} SSH service abnormal","message":">Level: {status} \n>Host: {host} \n>Content: Host SSH status {{ Result | to_fixed(2) }}% \n>Suggestion: Check the status of the host SSH service","noDataTitle":"","noDataMessage":"","type":"simpleCheck","every":"1m","groupBy":["host"],"interval":300,"targets":[{"dql":"M::`ssh`:(count(`ssh_check`)) BY `host`","alias":"Result","qtype":"dql"}],"checkerOpt":{"rules":[{"conditionLogic":"and","conditions":[{"alias":"Result","operands":["90"],"operator":">="}],"status":"critical"},{"conditionLogic":"and","conditions":[{"alias":"Result","operands":["0"],"operator":">="}],"status":"error"}],"infoEvent":false},"recoverNeedPeriodCount":2,"channels":[],"atAccounts":[],"atNoDataAccounts":[],"disableCheckEndTime":false},"alertPolicyUUIDs":["altpl_xxxx32"],"tags":["Local test combined detection"]}' \
--compressed
Response¶
{
"code": 200,
"content": {
"createAt": 1710827935,
"createdWay": "manual",
"creator": "acnt_xxxx32",
"crontabInfo": {
"crontab": "*/1 * * * *",
"id": "cron-pwiThsuE9gtQ"
},
"declaration": {
"b": [
"asfawfgajfasfafgafwba",
"asfgahjfaf"
],
"business": "aaa",
"organization": "64fe7b4062f74d0007b46676"
},
"deleteAt": -1,
"extend": {
"funcName": "",
"isNeedCreateIssue": false,
"issueLevelUUID": "system_level_3",
"needRecoverIssue": false,
"querylist": [
{
"datasource": "dataflux",
"qtype": "dql",
"query": {
"alias": "",
"code": "Result",
"dataSource": "ssh",
"field": "ssh_check",
"fieldFunc": "count",
"fieldType": "float",
"funcList": [],
"groupBy": [
"host"
],
"groupByTime": "",
"namespace": "metric",
"q": "M::`ssh`:(count(`ssh_check`)) BY `host`",
"type": "simple"
},
"uuid": "aada629a-672e-46f9-9503-8fd61065c382"
}
],
"rules": [
{
"conditionLogic": "and",
"conditions": [
{
"alias": "Result",
"operands": [
"90"
],
"operator": ">="
}
],
"status": "critical"
},
{
"conditionLogic": "and",
"conditions": [
{
"alias": "Result",
"operands": [
"0"
],
"operator": ">="
}
],
"status": "error"
}
]
},
"id": 1118,
"isLocked": 0,
"jsonScript": {
"atAccounts": [],
"atNoDataAccounts": [],
"channels": [],
"checkerOpt": {
"infoEvent": false,
"rules": [
{
"conditionLogic": "and",
"conditions": [
{
"alias": "Result",
"operands": [
"90"
],
"operator": ">="
}
],
"status": "critical"
},
{
"conditionLogic": "and",
"conditions": [
{
"alias": "Result",
"operands": [
"0"
],
"operator": ">="
}
],
"status": "error"
}
]
},
"disableCheckEndTime": false,
"every": "1m",
"groupBy": [
"host"
],
"interval": 300,
"message": ">Level: {status} \n>Host: {host} \n>Content: Host SSH status {{ Result | to_fixed(2) }}% \n>Suggestion: Check the status of the host SSH service",
"name": "Host {{ host }} SSH service abnormal",
"noDataMessage": "",
"noDataTitle": "",
"recoverNeedPeriodCount": 2,
"targets": [
{
"alias": "Result",
"dql": "M::`ssh`:(count(`ssh_check`)) BY `host`",
"qtype": "dql"
}
],
"title": "Host {{ host }} SSH service abnormal",
"type": "simpleCheck"
},
"monitorUUID": "monitor_xxxx32",
"refKey": "",
"secret": "",
"status": 0,
"tagInfo": [
{
"id": "tag_xxxx32",
"name": "Local test combined detection"
}
],
"type": "trigger",
"updateAt": 1710831784,
"updator": "wsak_xxxxx",
"uuid": "rul_xxxx32",
"workspaceUUID": "wksp_xxxx32"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-FF2C1DA3-1EE2-4802-A857-D37BCFB0C562"
}