mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-27 19:41:11 +01:00
feat(proxmox): add node-level stats endpoint with streaming support
Add new `/proxmox/stats/{node}` API endpoint for retrieving Proxmox node
statistics in JSON format. The endpoint returns kernel version, CPU
usage/model, memory usage, rootfs usage, uptime, and load averages.
The existing `/proxmox/stats/{node}/{vmid}` endpoint has been corrected `VMStats` to return`text/plain` instead of `application/json`.
Both endpoints support WebSocket streaming for real-time stats updates
with a 1-second poll interval.
This commit is contained in:
@@ -2452,12 +2452,9 @@
|
||||
"operationId": "lxcStop"
|
||||
}
|
||||
},
|
||||
"/proxmox/stats/{node}/{vmid}": {
|
||||
"/proxmox/stats/{node}": {
|
||||
"get": {
|
||||
"description": "Get proxmox stats in format of \"STATUS|CPU%%|MEM USAGE/LIMIT|MEM%%|NET I/O|BLOCK I/O\"",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "Get proxmox node stats in json",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -2465,7 +2462,63 @@
|
||||
"proxmox",
|
||||
"websocket"
|
||||
],
|
||||
"summary": "Get proxmox stats",
|
||||
"summary": "Get proxmox node stats",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
"name": "node",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Stats output",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/proxmox.NodeStats"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Node not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-id": "nodeStats",
|
||||
"operationId": "nodeStats"
|
||||
}
|
||||
},
|
||||
"/proxmox/stats/{node}/{vmid}": {
|
||||
"get": {
|
||||
"description": "Get proxmox VM stats in format of \"STATUS|CPU%%|MEM USAGE/LIMIT|MEM%%|NET I/O|BLOCK I/O\"",
|
||||
"produces": [
|
||||
"text/plain"
|
||||
],
|
||||
"tags": [
|
||||
"proxmox",
|
||||
"websocket"
|
||||
],
|
||||
"summary": "Get proxmox VM stats",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@@ -2512,8 +2565,8 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-id": "stats",
|
||||
"operationId": "stats"
|
||||
"x-id": "vmStats",
|
||||
"operationId": "vmStats"
|
||||
}
|
||||
},
|
||||
"/reload": {
|
||||
@@ -6331,6 +6384,83 @@
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"proxmox.NodeStats": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cpu_model": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"cpu_usage": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"kernel_version": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"load_avg_15m": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"load_avg_1m": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"load_avg_5m": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"mem_pct": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"mem_total": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"mem_usage": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"pve_version": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"rootfs_pct": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"rootfs_total": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"rootfs_usage": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"uptime": {
|
||||
"type": "string",
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
}
|
||||
},
|
||||
"x-nullable": false,
|
||||
"x-omitempty": false
|
||||
},
|
||||
"route.Route": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -1784,6 +1784,37 @@ definitions:
|
||||
type: object
|
||||
netip.Addr:
|
||||
type: object
|
||||
proxmox.NodeStats:
|
||||
properties:
|
||||
cpu_model:
|
||||
type: string
|
||||
cpu_usage:
|
||||
type: string
|
||||
kernel_version:
|
||||
type: string
|
||||
load_avg_15m:
|
||||
type: string
|
||||
load_avg_1m:
|
||||
type: string
|
||||
load_avg_5m:
|
||||
type: string
|
||||
mem_pct:
|
||||
type: string
|
||||
mem_total:
|
||||
type: string
|
||||
mem_usage:
|
||||
type: string
|
||||
pve_version:
|
||||
type: string
|
||||
rootfs_pct:
|
||||
type: string
|
||||
rootfs_total:
|
||||
type: string
|
||||
rootfs_usage:
|
||||
type: string
|
||||
uptime:
|
||||
type: string
|
||||
type: object
|
||||
route.Route:
|
||||
properties:
|
||||
access_log:
|
||||
@@ -3611,11 +3642,46 @@ paths:
|
||||
tags:
|
||||
- proxmox
|
||||
x-id: lxcStop
|
||||
/proxmox/stats/{node}:
|
||||
get:
|
||||
description: Get proxmox node stats in json
|
||||
parameters:
|
||||
- description: Node name
|
||||
in: path
|
||||
name: node
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Stats output
|
||||
schema:
|
||||
$ref: '#/definitions/proxmox.NodeStats'
|
||||
"400":
|
||||
description: Invalid request
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
"403":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
"404":
|
||||
description: Node not found
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
summary: Get proxmox node stats
|
||||
tags:
|
||||
- proxmox
|
||||
- websocket
|
||||
x-id: nodeStats
|
||||
/proxmox/stats/{node}/{vmid}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get proxmox stats in format of "STATUS|CPU%%|MEM USAGE/LIMIT|MEM%%|NET
|
||||
description: Get proxmox VM stats in format of "STATUS|CPU%%|MEM USAGE/LIMIT|MEM%%|NET
|
||||
I/O|BLOCK I/O"
|
||||
parameters:
|
||||
- in: path
|
||||
@@ -3627,7 +3693,7 @@ paths:
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
- text/plain
|
||||
responses:
|
||||
"200":
|
||||
description: Stats output
|
||||
@@ -3649,11 +3715,11 @@ paths:
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
summary: Get proxmox stats
|
||||
summary: Get proxmox VM stats
|
||||
tags:
|
||||
- proxmox
|
||||
- websocket
|
||||
x-id: stats
|
||||
x-id: vmStats
|
||||
/reload:
|
||||
post:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user