Import¶
POST /api/v1/checker/import
Overview¶
Import one or more monitor configurations.
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| checkers | array | Y | Rule configuration list Can be empty: False |
| type | string | Pass smartMonitor for Smart Monitoring imports, aiMonitor for AI semantic monitors, and the default trigger for ordinary monitors.Can be empty: False Can be empty string: False Valid values: ['smartMonitor', 'trigger', 'aiMonitor'] |
|
| skipRepeatNameCheck | boolean | Whether to skip duplicate name detection. false performs duplicate name detection, true skips it.Example: False Can be empty: False |
|
| skipRepeatNameCreate | boolean | If true, monitors with the same name are skipped, and monitors with different names are created directly. If false, all imported information is created.Example: False Can be empty: False |
|
| deleteRepeatName | boolean | If true, deletes and imports monitors with the same name. Defaults to false.Example: False Can be empty: False |
Parameter Notes¶
For monitor template configuration, see the [Monitor Export API].
OuterEventChecker validates the entire batch of subUri/isChangeEvent before import; if any item fails, the number of created monitors is 0. The import does not reuse the original secret; each rule generates a new value.
Notes on related parameters.
If repeat_name appears in the returned content, it indicates that there are monitors with the same name. Add the skipRepeatNameCreate parameter to choose whether to skip them or create monitors with the same name.
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| checker | array | Yes | Rule configuration list |
| skipRepeatNameCheck | boolean | Yes | Whether to skip duplicate name detection. If not skipped (false), when the duplicate name check fails, the list of monitor names with the same name is returned. |
| skipRepeatNameCreate | boolean | Yes | Whether to skip creating monitors with the same name. If not skipped (false), monitors with the same name are created. |
| deleteRepeatName | boolean | No | Whether to delete and import monitors with the same name. Defaults to false. |
Request Example¶
curl 'https://openapi.guance.com/api/v1/checker/import' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"checkers":[{"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"},{"conditionLogic":"and","conditions":[{"alias":"Result","operands":["0"],"operator":">="}],"status":"error"}]},"is_disable":false,"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":"message1","noDataMessage":"","noDataTitle":"","recoverNeedPeriodCount":2,"targets":[{"alias":"Result","dql":"M::`ssh`:(count(`ssh_check`)) BY `host`","qtype":"dql"}],"title":"Host {{ host }} SSH error","type":"simpleCheck"},"monitorName":"default","secret":"","tagInfo":[],"type":"trigger"}]}' \
--compressed
Response¶
{
"code": 200,
"content": {
"declaration": {
"business": "",
"organization": "663dbba102482200070bbb02"
},
"rule": [
{
"createAt": 1756285080,
"createdWay": "import",
"creator": "wsak_22e2b98bd92b48ba9d92dcbd4e526f8e",
"crontabInfo": {
"crontab": "0 */1 * * * *",
"id": "cron-LoiyL3IGSZaV"
},
"deleteAt": -1,
"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"
},
{
"conditionLogic": "and",
"conditions": [
{
"alias": "Result",
"operands": [
"0"
],
"operator": ">="
}
],
"status": "error"
}
]
},
"id": null,
"isLocked": false,
"jsonScript": {
"atAccounts": [],
"atNoDataAccounts": [],
"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": "message1",
"name": "Host {{ host }} SSH error",
"noDataMessage": "",
"noDataTitle": "",
"recoverNeedPeriodCount": 2,
"targets": [
{
"alias": "Result",
"dql": "M::`ssh`:(count(`ssh_check`)) BY `host`",
"qtype": "dql"
}
],
"title": "Host {{ host }} SSH error",
"type": "simpleCheck"
},
"monitorUUID": "monitor_7dbd71a127f945c0a968f1e4582dd9c9",
"openPermissionSet": false,
"permissionSet": [],
"refKey": "",
"secret": null,
"status": 0,
"tagInfo": [],
"type": "trigger",
"updateAt": -1,
"updator": "",
"uuid": "rul_8e1a91ee842b4101ba23684f62b76fc0",
"workspaceUUID": "wksp_84c4a0044edc4f878ea88e4517659bda"
}
]
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-5C22D448-A71E-469A-B054-10C5EBD4089E"
}