feat(proxmox): add journalctl endpoint without service; add limit parameter

Added new Proxmox journalctl endpoint `/journalctl/:node/:vmid` for viewing all
journalctl output without requiring a service name. Made the service parameter
optional across both endpoints.

Introduced configurable `limit` query parameter (1-1000, default 100) to both
proxmox journalctl and docker logs APIs, replacing hardcoded 100-line tail.

Added container status check in LXCCommand to prevent command execution on
stopped containers, returning a clear status message instead.

Refactored route validation to use pre-fetched IPs and improved References()
method for proxmox routes with better alias handling.
This commit is contained in:
yusing
2026-01-25 12:03:50 +08:00
parent 568d24d746
commit c202e26559
7 changed files with 185 additions and 24 deletions

View File

@@ -165,6 +165,76 @@
"operationId": "verify"
}
},
"/api/v1/proxmox/journalctl/{node}/{vmid}": {
"get": {
"description": "Get journalctl output",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"proxmox",
"websocket"
],
"summary": "Get journalctl output",
"parameters": [
{
"type": "string",
"name": "node",
"in": "path",
"required": true
},
{
"type": "integer",
"name": "vmid",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "limit",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "Journalctl output",
"schema": {
"type": "string"
}
},
"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": "journalctl",
"operationId": "journalctl"
}
},
"/api/v1/proxmox/journalctl/{node}/{vmid}/{service}": {
"get": {
"description": "Get journalctl output",
@@ -189,14 +259,19 @@
{
"type": "string",
"name": "service",
"in": "path",
"required": true
"in": "path"
},
{
"type": "integer",
"name": "vmid",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "limit",
"name": "limit",
"in": "query"
}
],
"responses": {
@@ -703,6 +778,12 @@
"description": "levels",
"name": "levels",
"in": "query"
},
{
"type": "integer",
"description": "limit",
"name": "limit",
"in": "query"
}
],
"responses": {

View File

@@ -2088,6 +2088,52 @@ paths:
tags:
- agent
x-id: verify
/api/v1/proxmox/journalctl/{node}/{vmid}:
get:
consumes:
- application/json
description: Get journalctl output
parameters:
- in: path
name: node
required: true
type: string
- in: path
name: vmid
required: true
type: integer
- description: limit
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: Journalctl output
schema:
type: string
"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 journalctl output
tags:
- proxmox
- websocket
x-id: journalctl
/api/v1/proxmox/journalctl/{node}/{vmid}/{service}:
get:
consumes:
@@ -2100,12 +2146,15 @@ paths:
type: string
- in: path
name: service
required: true
type: string
- in: path
name: vmid
required: true
type: integer
- description: limit
in: query
name: limit
type: integer
produces:
- application/json
responses:
@@ -2438,6 +2487,10 @@ paths:
in: query
name: levels
type: string
- description: limit
in: query
name: limit
type: integer
produces:
- application/json
responses: