监控微服务接口

接口目录

创建监控任务

POST /monitor/api/create

JSON 参数

参数 描述 取值
title 监控任务标题 string
monitored_url 被监控的推流地址 string
callback_period (可选)监控回调周期(秒) int

返回

参数 描述 取值
errcode 错误码,1000 为正常 int
msg "OK" 或错误信息 string
id 监控任务 hash ID string

返回示例

{
    "errcode": 1000,
    "msg": "OK",
    "id": "17lok52y"
}

获取监控任务

GET /monitor/api/get

URL 参数

参数 描述 取值
id 监控任务 hash ID string

返回

参数 描述 取值
errcode 错误码,1000 为正常 int
msg "OK" 或错误信息 string
task 监控任务 object
task.id 监控任务 hash ID string
task.created_at 监控任务创建时间 string
task.title 监控任务标题 string
task.status 监控任务状态(1 为开启,2 为暂停) int
task.monitored_url 被监控的推流地址 string
task.callback_period 监控回调周期(秒) int

返回示例

{
  "errcode": 1000,
  "msg": "OK",
  "task": {
    "id": "l567bb23",
    "created_at": "2019-06-12T09:04:37+08:00",
    "callback_period": 5,
    "monitored_url": "rtmp://0.0.0.0/example/1",
    "status": 1,
    "title": "example",
    "updated_at": "2019-06-12T09:04:37+08:00"
  }
}

获取监控任务列表

GET /monitor/api/list

URL 参数

参数 描述 取值
search 搜索的内容 string
page 页数,默认 1 int
page_size 每页个数,默认 15 int

返回

参数 描述 取值
errcode 错误码,1000 为正常 int
msg "OK" 或错误信息 string
tasks 监控任务列表 object array
tasks.id 监控任务 hash ID string
tasks.created_at 监控任务创建时间 string
tasks.title 监控任务标题 string
tasks.status 监控任务状态(1 为开启,2 为暂停) int
tasks.monitored_url 被监控的推流地址 string
tasks.callback_period 监控回调周期(秒) int

返回示例

{
  "errcode": 1000,
  "msg": "OK",
  "count": 6,
  "tasks": [
    {
      "id": "l567bb23",
      "created_at": "2019-06-12T09:04:37+08:00",
      "callback_period": 5,
      "monitored_url": "rtmp://0.0.0.0/example/1",
      "status": 1,
      "title": "example",
      "updated_at": "2019-06-12T09:04:37+08:00"
    }
  ]
}

获取监控数据列表

GET /monitor/api/list_data

URL 参数

参数 描述 取值
id 监控任务 hash ID string
page 页数,默认 1 int
page_size 每页个数,默认 15 int
after 返回此时间戳之后的数据,单位为秒,默认为 0 int
before 返回此时间戳之前的数据,单位为秒,默认为当前时间 int
periods 数据的间隔时间,单位为秒,默认为 5 int
order 数据按时间顺序排序,正序为 asc,倒序为 desc,默认为 desc string

返回

参数 描述 取值
errcode 错误码,1000 为正常 int
msg "OK" 或错误信息 string
count 数据总数 int
task_ended 监控任务是否结束 bool
data 数据列表 object array
data.time 记录时间 string
data.empty 取空的次数 int
data.sum 取帧的次数 int
data.fps 视频帧率 float
data.kbpsv 视频比特率 int
data.kbpsa 音频比特率 int

返回示例

{
  "errcode": 1000,
  "msg": "OK",
  "task_ended": true,
  "count": 7,
  "data": [
    {
      "empty": 0,
      "fps": 0,
      "kbpsa": 0,
      "kbpsv": 0,
      "sum": 0,
      "time": "2019-06-12T19:22:30+08:00"
    },
    {
      "empty": 67,
      "fps": 20.2,
      "kbpsa": 133606,
      "kbpsv": 2273875,
      "sum": 125,
      "time": "2019-06-12T19:22:35+08:00"
    },
    {
      "empty": 6,
      "fps": 24,
      "kbpsa": 160472,
      "kbpsv": 2519571,
      "sum": 124,
      "time": "2019-06-12T19:22:40+08:00"
    },
    {
      "empty": 4,
      "fps": 24,
      "kbpsa": 159814,
      "kbpsv": 2308736,
      "sum": 125,
      "time": "2019-06-12T19:22:45+08:00"
    },
    {
      "empty": 5,
      "fps": 23.8,
      "kbpsa": 161368,
      "kbpsv": 2565712,
      "sum": 126,
      "time": "2019-06-12T19:22:50+08:00"
    },
    {
      "empty": 5,
      "fps": 24,
      "kbpsa": 158158,
      "kbpsv": 2550388,
      "sum": 124,
      "time": "2019-06-12T19:22:55+08:00"
    },
    {
      "empty": 6,
      "fps": 24,
      "kbpsa": 161219,
      "kbpsv": 2330902,
      "sum": 126,
      "time": "2019-06-12T19:23:00+08:00"
    }
  ],
  "starts": [
    0
  ]
}

设置监控任务状态

POST /monitor/api/modify_status

URL 参数

参数 描述 取值
id 监控任务 hash ID string

JSON 参数

参数 描述 取值
status 监控任务状态(1 为开启,2 为暂停) int

返回

参数 描述 取值
errcode 错误码,1000 为正常 int
msg "OK" 或错误信息 string

返回示例

{
    "errcode": 1000,
    "msg": "OK"
}

获取监控任务操作历史

GET /monitor/api/list_monitor_operation_history

URL 参数

参数 描述 取值
id 监控任务 hash ID string
after 返回此时间戳之后的数据,单位为秒,默认为 0 int
before 返回此时间戳之前的数据,单位为秒,默认为当前时间 int

返回

参数 描述 取值
errcode 错误码,1000 为正常 int
msg "OK" 或错误信息 string
histories 操作历史列表 object array
histories.time 操作发生的时间 string
histories.op_type 操作类型(0-开启,1-暂停,2-删除) int

删除监控任务

POST /monitor/api/delete

支持批量删除。

URL 参数

参数 描述 取值
id 监控任务 hash ID(可以传多个,用逗号隔开) string

返回

参数 描述 取值
errcode 错误码,1000 为正常 int
msg "OK" 或错误信息 string

返回示例

{
    "errcode": 1000,
    "msg": "OK"
}

results matching ""

    No results matching ""