Skip to content

Commit 4360d6a

Browse files
author
root
committed
rebuild platform metrics
1 parent f6bcad1 commit 4360d6a

60 files changed

Lines changed: 2805 additions & 989 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Note.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,8 @@ ports tab 不稳定,经常打开显示 somethins wrong
150150
addons 的 netdata restart 报错
151151
Server Terminal 退出连接后再重连,就会失败
152152

153-
crontab list 保存不住
153+
crontab list 保存不住
154+
155+
去掉所有与 docker.sock 的强依赖与硬编码
156+
157+
平台metrics 的读取查询与对服务器 metrics 的查询,是不是后端代码应该分离

backend/docs/openapi/api.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,25 @@ components:
331331
message:
332332
type: string
333333
type: object
334+
MonitorMetricLatestResponse:
335+
properties:
336+
availableNetworkInterfaces:
337+
items:
338+
type: string
339+
type: array
340+
cadenceSeconds:
341+
type: integer
342+
selectedNetworkInterface:
343+
type: string
344+
series:
345+
items:
346+
$ref: '#/components/schemas/MonitorMetricSeries'
347+
type: array
348+
targetId:
349+
type: string
350+
targetType:
351+
type: string
352+
type: object
334353
MonitorMetricSeriesResponse:
335354
properties:
336355
availableNetworkInterfaces:
@@ -5958,6 +5977,71 @@ paths:
59585977
summary: Get monitor target status
59595978
tags:
59605979
- Monitoring
5980+
/api/monitor/targets/{targetType}/{targetId}/latest:
5981+
get:
5982+
description: Returns the most recent observed metric point for a monitor target at the managed-agent collection cadence. targetType accepts server, app, container, or platform. series accepts cpu, memory, disk, disk_usage, network, or network_traffic depending on target type.
5983+
operationId: get_api_monitor_targets_targettype_targetid_latest
5984+
parameters:
5985+
- description: monitor target type
5986+
in: path
5987+
name: targetType
5988+
required: true
5989+
schema:
5990+
enum:
5991+
- server
5992+
- app
5993+
- container
5994+
- platform
5995+
type: string
5996+
- description: monitor target ID; platform uses appos-core for AppOS host metrics
5997+
in: path
5998+
name: targetId
5999+
required: true
6000+
schema:
6001+
type: string
6002+
- description: network interface for network series; use all or omit for aggregate
6003+
in: query
6004+
name: networkInterface
6005+
required: false
6006+
schema:
6007+
type: string
6008+
- description: metric series alias
6009+
in: query
6010+
name: series
6011+
required: false
6012+
schema:
6013+
enum:
6014+
- cpu
6015+
- memory
6016+
- disk
6017+
- disk_usage
6018+
- network
6019+
- network_traffic
6020+
type: string
6021+
responses:
6022+
"200":
6023+
content:
6024+
application/json:
6025+
schema:
6026+
$ref: '#/components/schemas/MonitorMetricLatestResponse'
6027+
description: OK
6028+
"400":
6029+
content:
6030+
application/json:
6031+
schema:
6032+
$ref: '#/components/schemas/MonitorErrorResponse'
6033+
description: Bad Request
6034+
"401":
6035+
content:
6036+
application/json:
6037+
schema:
6038+
$ref: '#/components/schemas/MonitorErrorResponse'
6039+
description: Unauthorized
6040+
security:
6041+
- bearerAuth: []
6042+
summary: Get latest monitor target metrics
6043+
tags:
6044+
- Monitoring
59616045
/api/monitor/targets/{targetType}/{targetId}/series:
59626046
get:
59636047
description: Returns metric series for a monitor target. targetType accepts server, app, container, or platform. series accepts cpu, memory, disk, disk_usage, network, or network_traffic depending on target type. Use startAt and endAt together for a custom RFC3339 range.

backend/docs/openapi/ext-api.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,25 @@ components:
127127
type: string
128128
maxBytes:
129129
type: integer
130+
MonitorMetricLatestResponse:
131+
type: object
132+
properties:
133+
targetType:
134+
type: string
135+
targetId:
136+
type: string
137+
cadenceSeconds:
138+
type: integer
139+
series:
140+
type: array
141+
items:
142+
$ref: '#/components/schemas/MonitorMetricSeries'
143+
availableNetworkInterfaces:
144+
type: array
145+
items:
146+
type: string
147+
selectedNetworkInterface:
148+
type: string
130149
MonitorMetricSeriesResponse:
131150
type: object
132151
properties:
@@ -4440,6 +4459,70 @@ paths:
44404459
application/json:
44414460
schema:
44424461
$ref: '#/components/schemas/MonitorErrorResponse'
4462+
/api/monitor/targets/{targetType}/{targetId}/latest:
4463+
get:
4464+
tags: [Monitoring]
4465+
summary: Get latest monitor target metrics
4466+
description: "Returns the most recent observed metric point for a monitor target at the managed-agent collection cadence. targetType accepts server, app, container, or platform. series accepts cpu, memory, disk, disk_usage, network, or network_traffic depending on target type."
4467+
operationId: get_api_monitor_targets_targettype_targetid_latest
4468+
parameters:
4469+
- name: targetType
4470+
in: path
4471+
description: "monitor target type"
4472+
required: true
4473+
schema:
4474+
type: string
4475+
enum:
4476+
- "server"
4477+
- "app"
4478+
- "container"
4479+
- "platform"
4480+
- name: targetId
4481+
in: path
4482+
description: "monitor target ID; platform uses appos-core for AppOS host metrics"
4483+
required: true
4484+
schema:
4485+
type: string
4486+
- name: networkInterface
4487+
in: query
4488+
description: "network interface for network series; use all or omit for aggregate"
4489+
required: false
4490+
schema:
4491+
type: string
4492+
- name: series
4493+
in: query
4494+
description: "metric series alias"
4495+
required: false
4496+
schema:
4497+
type: string
4498+
enum:
4499+
- "cpu"
4500+
- "memory"
4501+
- "disk"
4502+
- "disk_usage"
4503+
- "network"
4504+
- "network_traffic"
4505+
security:
4506+
- bearerAuth: []
4507+
responses:
4508+
"200":
4509+
description: OK
4510+
content:
4511+
application/json:
4512+
schema:
4513+
$ref: '#/components/schemas/MonitorMetricLatestResponse'
4514+
"401":
4515+
description: Unauthorized
4516+
content:
4517+
application/json:
4518+
schema:
4519+
$ref: '#/components/schemas/MonitorErrorResponse'
4520+
"400":
4521+
description: Bad Request
4522+
content:
4523+
application/json:
4524+
schema:
4525+
$ref: '#/components/schemas/MonitorErrorResponse'
44434526
/api/monitor/targets/{targetType}/{targetId}/series:
44444527
get:
44454528
tags: [Monitoring]

backend/docs/openapi/group-matrix.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ groups:
410410
- GET /api/monitor/overview
411411
- GET /api/monitor/servers/{id}/container-telemetry
412412
- GET /api/monitor/targets/{targetType}/{targetId}
413+
- GET /api/monitor/targets/{targetType}/{targetId}/latest
413414
- GET /api/monitor/targets/{targetType}/{targetId}/series
414415
nativeSurface: []
415416
sources:

0 commit comments

Comments
 (0)