# 节点状态

# 获取集群中所有节点的列表

# 请求 URL:

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

# 请求方式:

  • GET

# 请求 Header:

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

# 请求示例

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

# 正确响应示例:

{
  "result": [
    {
      "id": "4f8d9d31-2f96-4d7d-97bf-c8c7ccd3aa2a",
      "title": "All-In-One",
      "host": "heycloud-all-in-one",
      "createdAt": "2021-02-01T02:20:36.735Z"
    }
  ]
}

# 错误响应示例:

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

# 获取集群中所有节点的概况,统计最近5分钟的值

# 请求 URL:

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

# 请求方式:

  • GET

# 请求 Header:

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

# 请求示例

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

# 正确响应示例:

{
  "result": [
    {
      "id": "4f8d9d31-2f96-4d7d-97bf-c8c7ccd3aa2a",
      "host": "heycloud-all-in-one",
      "metrics": {
        "memUsage": 0.7999607523769342,
        "diskUsage": {
          "/dev/vda1": 0.1694549771961672
        }
      }
    }
  ]
}

# 错误响应示例:

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

# 获取某个节点的状态

# 请求 URL:

  • http://host:port/heycloud/api/monitor/node/:nodeId/status

# 请求方式:

  • GET

# 请求 Header:

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

# 请求参数:

字段 可选值 类型 是否必选 说明
nodeId - String 节点ID

# 请求示例

GET http://host:port/heycloud/api/monitor/node/xxxxx/status

# 正确响应示例:

{
  "result": [
    {
      "id": "4f8d9d31-2f96-4d7d-97bf-c8c7ccd3aa2a",
      "title": "All-In-One",
      "host": "heycloud-all-in-one",
      "createdAt": "2021-02-01T02:20:36.735Z",
      "metrics": {
        "uname": {
          "os": "Linux",
          "release": "4.19.121-linuxkit",
          "version": "#1 SMP Tue Dec 1 17:50:32 UTC 2020"
        },
        "cpuSeconds": {
          "0": {
            "idle": 90985.46,
            "iowait": 57.88,
            "irq": 0,
            "nice": 0,
            "softirq": 36.5,
            "steal": 0,
            "system": 2306.27,
            "user": 1231.65
          },
          "1": {
            "idle": 90973.58,
            "iowait": 74.12,
            "irq": 0,
            "nice": 0,
            "softirq": 33.17,
            "steal": 0,
            "system": 2180.67,
            "user": 1092.11
          }
        },
        "memMegabytes": {
          "avail": 399.21484375,
          "total": 1990.56640625
        },
        "diskMegabytes": {
          "/dev/vda1": {
            "mountpoint": "/etc/hostname",
            "avail": 49683.0078125,
            "size": 59819.81640625
          }
        }
      }
    }
  ]
}

# 错误响应示例:

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

# 获取所有集群中节点的历史信息,默认返回之前一个小时的历史

# 请求 URL:

  • http://host:port/heycloud/api/monitor/node/:nodeId/history

# 请求方式:

  • GET

# 请求 Header:

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

# 请求参数:

字段 可选值 类型 是否必选 说明
nodeId - String 节点ID
start - Number 开始的 UNIX 时间戳,其单位为秒,默认值为当前之前一个小时
end - Number 结束的 UNIX 时间戳,其单位为秒,默认值为当前时间
step - Number 采样的间隔,单位秒,默认值为 60

# 请求示例

GET http://host:port/heycloud/api/monitor/node/xxxxx/history?start=xxx&end=xxx&step=xxx

# 正确响应示例:

{
  "result": [
    {
      "id": "4f8d9d31-2f96-4d7d-97bf-c8c7ccd3aa2a",
      "title": "All-In-One",
      "host": "heycloud-all-in-one",
      "createdAt": "2021-02-01T02:20:36.735Z",
      "metrics": {
        "uname": [
          {
            "time": 1612162941.416,
            "value": {
              "os": "Linux",
              "release": "4.19.121-linuxkit",
              "version": "#1 SMP Tue Dec 1 17:50:32 UTC 2020"
            }
          }
        ],
        "cpuSeconds": {
          "0": {
            "idle": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "iowait": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "irq": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "nice": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "softirq": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "steal": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "system": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "user": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ]
          }
        },
        "memMegabytes": {
          "avail": [
            {
              "time": 1612162941.416,
              "value": 88903.31
            }
          ],
          "total": [
            {
              "time": 1612162941.416,
              "value": 88903.31
            }
          ]
        },
        "diskMegabytes": {
          "/dev/vda1": {
            "mountpoint": "/etc/hostname",
            "avail": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ],
            "size": [
              {
                "time": 1612162941.416,
                "value": 88903.31
              }
            ]
          }
        }
      }
    }
  ]
}

# 错误响应示例:

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