Skip to content

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
Allow empty: False
type string Smart monitor import parameter: smartMonitor, default is normal monitor trigger
Allow empty: False
Allow empty string: False
Optional values: ['smartMonitor', 'trigger']
skipRepeatNameCheck boolean Whether to skip duplicate name detection. false: perform duplicate name detection, true: skip duplicate name detection
Example: False
Allow empty: False
skipRepeatNameCreate boolean true: skip creation for duplicate names, create directly for different names; false: create all imported information
Example: False
Allow empty: False
deleteRepeatName boolean true: delete and import monitors with duplicate names, default is false
Example: False
Allow empty: False

Parameter Supplementary Notes

Monitor template configuration, see [Monitor Export API]

OuterEventChecker performs batch validation of subUri/isChangeEvent before import. If any item fails, the number of created entries is 0. Import does not reuse the original secret; each rule generates a new value.

Related parameter descriptions. In the returned result content, if repeat_name exists, it indicates duplicate names. Add the parameter skipRepeatNameCreate to choose to skip or create duplicate names.

Parameter Name type Required Description
checker array Required Rule configuration list
skipRepeatNameCheck boolean Required Whether to skip duplicate name detection. If not skipped (false): if duplicate name detection fails, return the list of duplicate monitor names
skipRepeatNameCreate boolean Required Whether to skip creation for duplicate names. If not skipped (false): create monitors with duplicate names
deleteRepeatName boolean Optional Whether to delete and import monitors with duplicate names, default is 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"
} 

Feedback

Is this page helpful?