获取监测器 API编辑

通过 ID 检索监测器。

请求编辑

GET _watcher/watch/<watch_id>

先决条件编辑

  • 您必须拥有 manage_watchermonitor_watcher 集群权限才能使用此 API。有关更多信息,请参阅安全权限

路径参数编辑

<watch_id>
(必填,字符串)监测器的标识符。

示例编辑

以下示例获取 ID 为 my_watch 的监测器

GET _watcher/watch/my_watch

响应

{
  "found": true,
  "_id": "my_watch",
  "_seq_no": 0,
  "_primary_term": 1,
  "_version": 1,
  "status": { 
    "version": 1,
    "state": {
      "active": true,
      "timestamp": "2015-05-26T18:21:08.630Z"
    },
    "actions": {
      "test_index": {
        "ack": {
          "timestamp": "2015-05-26T18:21:08.630Z",
          "state": "awaits_successful_execution"
        }
      }
    }
  },
  "watch": {
    "input": {
      "simple": {
        "payload": {
          "send": "yes"
        }
      }
    },
    "condition": {
      "always": {}
    },
    "trigger": {
      "schedule": {
        "hourly": {
          "minute": [0, 5]
        }
      }
    },
    "actions": {
      "test_index": {
        "index": {
          "index": "test"
        }
      }
    }
  }
}

监测器的当前状态