Replace Import¶
POST /api/v1/checker/{rule_uuid}/replace
Overview¶
Replace a specified monitor with an exported monitor template based on the rule_uuid.
Route Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| rule_uuid | string | Y | The UUID of the monitor to be replaced. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| checker | json | Y | The configuration of a single monitor template. Its structure is consistent with a single checker returned by the export interface.Allow Empty: False |
Parameter Additional Notes¶
The content of the checker parameter is consistent with a single content.checkers[] element in the result returned by the [Monitor Export Interface].
This interface only supports replacing a single existing monitor and does not support batch import.
Request Example¶
curl 'https://openapi.truewatch.com/api/v1/checker/rul_xxxxxx/replace' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"checker":{"extend":{"funcName":"","isNeedCreateIssue":false,"issueLevelUUID":"","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"}]},"is_disable":false,"jsonScript":{"checkerOpt":{"rules":[{"conditionLogic":"and","conditions":[{"alias":"Result","operands":["90"],"operator":">="}],"status":"critical"}]},"every":"1m","groupBy":["host"],"interval":300,"message":"message1","title":"Host {{ host }} SSH error","type":"simpleCheck","targets":[{"alias":"Result","dql":"M::`ssh`:(count(`ssh_check`)) BY `host`","qtype":"dql"}]},"monitorName":"default","tagInfo":[],"type":"trigger"}}' \
--compressed
Response¶
{
"code": 200,
"content": {
"createAt": 1710827935,
"createdWay": "manual",
"creator": "acnt_xxxx32",
"crontabInfo": {
"crontab": "*/1 * * * *",
"id": "cron-pwiThsuE9gtQ"
},
"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"
}
]
},
"jsonScript": {
"title": "Host {{ host }} SSH Service Exception",
"type": "simpleCheck",
"every": "1m",
"groupBy": [
"host"
],
"interval": 300,
"targets": [
{
"alias": "Result",
"dql": "M::`ssh`:(count(`ssh_check`)) BY `host`",
"qtype": "dql"
}
],
"checkerOpt": {
"rules": [
{
"conditionLogic": "and",
"conditions": [
{
"alias": "Result",
"operands": [
"90"
],
"operator": ">="
}
],
"status": "critical"
}
]
}
},
"uuid": "rul_xxxx32",
"workspaceUUID": "wksp_xxxx32"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-FF2C1DA3-1EE2-4802-A857-D37BCFB0C562"
}