Skip to content

Import



POST /api/v1/checker/import

Overview

Import one or multiple monitor configurations.

Body Request Parameters

Parameter Name Type Required Description
checkers array Y List of rule configurations.
Allow empty: False
type string For intelligent monitor import, pass smartMonitor. Default is regular monitor trigger.
Allow empty: False
Allow empty string: False
Allowed values: ['smartMonitor', 'trigger']
skipRepeatNameCheck boolean Whether to skip duplicate name detection. false performs duplicate name detection, true skips it.
Example: False
Allow empty: False
skipRepeatNameCreate boolean true skips creation for monitors with duplicate names, creates only those with different names. false creates all imported configurations.
Example: False
Allow empty: False
deleteRepeatName boolean true deletes and imports monitors with duplicate names. Default is false.
Example: False
Allow empty: False

Parameter Supplementary Notes

** For monitor template configuration, refer to the [Monitor Export API].**

Related parameter description. If the returned result content contains repeat_name, it indicates duplicate names exist. Add the parameter skipRepeatNameCreate to choose whether to skip or create duplicates.

Parameter Name Type Required Description
checker array Required List of rule configurations.
skipRepeatNameCheck boolean Required Whether to skip duplicate name detection. If not skipped (false): returns a list of duplicate monitor names if detection fails.
skipRepeatNameCreate boolean Required Whether to skip creation for duplicate names. If not skipped (false): creates monitors with the same name.
deleteRepeatName boolean Optional Whether to delete and import monitors with duplicate names. Default is false.

Request Example

curl 'https://openapi.truewatch.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"
}