更新时间:2024-03-22 GMT+08:00

资源池监控

功能介绍

获取资源池的监控信息。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v2/{project_id}/pools/{pool_name}/monitor

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

用户项目ID。获取方法请参见获取项目ID和名称

pool_name

String

系统生成的资源池名称。

表2 Query参数

参数

是否必选

参数类型

描述

time_range

String

查询时间范围,默认值“-1.-1.60”。格式为startTimeInMillis.endTimeInMillis.durationInMinutes,参数解释:

  • startTimeInMillis: 查询的开始时间,格式为UTC毫秒,如果指定为-1,服务端将按(endTimeInMillis - durationInMinutes * 60 * 1000)计算开始时间

  • endTimeInMillis: 查询的结束时间,格式为UTC毫秒,如果指定为-1,服务端将按(startTimeInMillis + durationInMinutes * 60 * 1000)计算结束时间,如果计算出的结束时间大于当前系统时间,则使用当前系统时间

  • durationInMinutes:查询时间的跨度分钟数。 取值范围大于0并且大于等于(endTimeInMillis - startTimeInMillis) / (60 * 1000) - 1 当开始时间与结束时间都设置为-1时,系统会将结束时间设置为当前时间UTC毫秒值,并按(endTimeInMillis - durationInMinutes * 60 * 1000)计算开始时间。如:-1.-1.60(表示最近60分钟)约束:单次请求中,查询时长与周期需要满足以下条件: durationInMinutes * 60 / period <= 1440。

statistics

String

统计方式。可选值如下:

  • maximum:最大值统计,默认值

  • minimun:最小值统计

  • sum:求和统计

  • average:平均值统计

  • sampleCount:采样统计

period

String

监控数据粒度,单位为秒。可选值如下:

  • 60:粒度为1分钟,默认值

  • 300:粒度为5分钟

  • 900:粒度为15分钟

  • 3600:粒度为1小时

请求参数

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

metrics

Array of metrics objects

指标对象列表。 取值范围 JSON数组大小不超过20。

表4 metrics

参数

参数类型

描述

metric

metric object

指标参数集合。

dataPoints

Array of dataPoints objects

重点指标。

表5 metric

参数

参数类型

描述

dimensions

Array of dimensions objects

指标维度列表。

metricName

String

指标名称。

namespace

String

指标命名空间。可选值如下:

  • PAAS.CONTAINER:组件指标、实例指标、进程指标和容器指标的命名空间

  • PAAS.NODE: 主机指标、网络指标、磁盘指标和文件系统指标的命名空间

  • PAAS.SLA:SLA指标的命名空间

  • PAAS.AGGR:集群指标的命名空间

  • CUSTOMMETRICS:默认的自定义指标的命名空间

表6 dimensions

参数

参数类型

描述

name

String

指标维度名称。

value

String

指标维度取值。

表7 dataPoints

参数

参数类型

描述

timestamp

Integer

时间戳。

unit

String

时间序列单位。

statistics

Array of statistics objects

统计值列表。

表8 statistics

参数

参数类型

描述

statistic

String

统计方式。

value

Float

统计结果。

状态码: 404

表9 响应Body参数

参数

参数类型

描述

error_code

String

ModelArts错误码

error_msg

String

具体错误信息

请求示例

查询资源池监控信息。

GET https://{endpoint}/v2/{project_id}/pools/{pool_name}/monitor

{ }

响应示例

状态码: 200

OK。

{
  "metrics" : [ {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "cpuUsage",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 7.944
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 7.88
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "memUsedRate",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 13.83
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 13.836
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "gpuUtil",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "gpuMemUsage",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "npuUtil",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "npuMemUsage",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "",
      "statistics" : [ {
        "statistic" : "average",
        "value" : -1
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "diskAvailableCapacity",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "Megabytes",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 834383.4
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "Megabytes",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 834379.2
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "diskCapacity",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "Megabytes",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 1105920
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "Megabytes",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 1105920
      } ]
    } ]
  }, {
    "metric" : {
      "dimensions" : [ {
        "name" : "clusterId",
        "value" : "83df17f1-d74c-11ec-a070-0255ac1000c3"
      } ],
      "metricName" : "diskUsedRate",
      "namespace" : "PAAS.AGGR"
    },
    "dataPoints" : [ {
      "timestamp" : 1655193600000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 24.553
      } ]
    }, {
      "timestamp" : 1655197200000,
      "unit" : "Percent",
      "statistics" : [ {
        "statistic" : "average",
        "value" : 24.553
      } ]
    } ]
  } ]
}

状态码: 404

Not Found。

{
  "error_code" : "ModelArts.50015001",
  "error_msg" : "pool not found"
}

状态码

状态码

描述

200

OK。

404

Not Found。

错误码

请参见错误码