# 服务状态

# 获取集群中所有服务的列表

# 请求 URL:

  • http://host:port/heycloud/api/monitor/service/list

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 用户登录后获得的访问令牌

# 请求示例

GET http://host:port/heycloud/api/monitor/service/list

# 正确响应示例:

{
  "result": [
    [
      {
        "id": "b95f1726-8a89-4034-9cac-df39103eebc5",
        "name": "heycloud-base-api",
        "title": "基础功能",
        "createdAt": "2021-02-01T02:21:21.017Z"
      },
      {
        "id": "155a05b1-f8f2-4302-a724-1974336b61ac",
        "name": "heycloud-io-api",
        "title": "数据导入导出",
        "createdAt": "2021-02-01T02:21:21.017Z"
      },
      {
        "id": "b07ea7be-1236-42df-a3f5-169f9a0e1baa",
        "name": "heycloud-render-api",
        "title": "渲染出图",
        "createdAt": "2021-02-01T02:21:21.017Z"
      }
    ]
  ]
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息",
}

# 获取集群中所有服务的概况

# 请求 URL:

  • http://host:port/heycloud/api/monitor/service/summary

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 用户登录后获得的访问令牌

# 请求示例

GET http://host:port/heycloud/api/monitor/service/summary

# 正确响应示例:

{
  "result": [
    [
      {
        "id": "b95f1726-8a89-4034-9cac-df39103eebc5",
        "name": "heycloud-base-api",
        "title": "基础功能",
        "status": {
          "total": 1,
          "running": 1
        }
      },
      {
        "id": "155a05b1-f8f2-4302-a724-1974336b61ac",
        "name": "heycloud-io-api",
        "title": "数据导入导出",
        "status": {
          "total": 1,
          "running": 0
        }
      },
      {
        "id": "b07ea7be-1236-42df-a3f5-169f9a0e1baa",
        "name": "heycloud-render-api",
        "title": "渲染出图",
        "status": {
          "total": 2,
          "running": 2
        }
      }
    ]
  ]
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息",
}

# 获取某个服务的状态

# 请求 URL:

  • http://host:port/heycloud/api/monitor/service/:serviceId/status

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 用户登录后获得的访问令牌

# 请求参数:

属性名称 可选值 类型 是否必须 默认值 说明
serviceId - String 服务ID
replicas 大于0的整数 Number 1 更新的容器数量

# 请求示例

GET http://host:port/heycloud/api/monitor/service/xxxxx/status?replicas=1

# 正确响应示例:

{
  "result": {
    "total": 2,
    "running": 2
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息",
}

# 重启某个服务

# 请求 URL:

  • http://host:port/heycloud/api/monitor/service/:serviceId/restart

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 用户登录后获得的访问令牌

# 请求参数:

属性名称 可选值 类型 是否必须 默认值 说明
serviceId - String 服务ID

# 请求示例

POST http://host:port/heycloud/api/monitor/service/xxxxx/restart

# 正确响应示例:

{
  "result": {
    "restartedAt":"2021-03-11T09:18:24.302Z"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息",
}

# 改变某个服务的容器数量

# 请求 URL:

  • http://host:port/heycloud/api/monitor/service/:serviceId/scale

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 用户登录后获得的访问令牌

# 请求参数:

属性名称 可选值 类型 是否必须 默认值 说明
serviceId - String 服务ID
replicas 大于0的整数 Number 1 更新的容器数量

# 请求示例

POST http://host:port/heycloud/api/monitor/service/xxxxx/scale

{
  replicas:1,
}

# 正确响应示例:

{
  "result": {
    "scaledAt":"2021-03-11T09:18:24.302Z"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息",
}