報警日誌

獲取報警日誌列表

URI

GET /admin-api/alarm_events

URI引數

  • level

    type: integer

    required: no

    description: 指定的級別 (不指定返回所有級別的報警日誌,0:STDERR,1:EMERG,2:ALERT,3:CRIT,4:ERROR,5:WARN,6:NOTICE,7:INFO,8:DEBUG)

  • page

    type: integer

    required: no

    description: 指定頁面 (預設為 1)

  • page_size

    type: integer

    required: no

    description: 每頁包含資料的數量 (預設為 20)

請求示例

Shell

curl http://{admin-site}/admin-api/admin-api/alarm_events?page=1&page_size=10&level=

響應示例

Status: 200 OK
{
  "status": 0,
  "data": {
    "meta": {
      "count": 2
    },
    "data": [{
      "_modified_unix": 1614928254.5028,
      "_created_unix": 1614928254.5028,
      "status": "UNRESOLVED",
      "id": 306408,
      "message": "Gateway nodes [49] online",
      "level": "WARNING",
      "from": "log-server"
    }, {
      "_modified_unix": 1614927900.4734,
      "_created_unix": 1614927900.4734,
      "status": "UNRESOLVED",
      "id": 306399,
      "message": "Gateway nodes [49] offline",
      "level": "ERROR",
      "from": "log-server"
    }]
  }
}

修改報警日誌

URI

PUT /admin-api/alarm_events/{id}

JSON Body 引數

  • id

    type: integer

    required: yes

    description: 要修改的報警日誌的 ID

  • status

    type: string

    required: yes

    description: 修改成為的狀態

請求示例

Shell

curl -X PUT http://{admin-site}/admin-api/admin-api/alarm_events/350
  '{
    status: "RESOLVING"
  }'

響應示例

Status: 200 OK
{
    "status": 0
}

刪除報警日誌

URI

DELETE /admin-api/alarm_events/{id}

引數

  • id

    type: integer

    required: yes

    description: 要刪除的報警日誌的 ID

請求示例

Shell

curl -X DELETE http://{admin-site}/admin-api/admin-api/alarm_events/350

響應示例

Status: 200 OK
{
    "status": 0
}