feat(glance-agent): 添加对官方agent的支持并更新文档

添加官方glance-agent的0.1.0和latest版本配置
保留原有custom版本配置
更新README说明版本差异和配置方法
This commit is contained in:
arch3rPro
2025-12-14 16:29:52 +08:00
parent 10d5179914
commit e021bdcf9e
7 changed files with 127 additions and 26 deletions

View File

@@ -0,0 +1,21 @@
additionalProperties:
formFields:
- default: "27973"
envKey: AGENT_PORT
label:
en: Agent-Port
zh: Agent-端口
required: true
type: number
edit: true
rule: paramPort
- default: your_auth_token_here
envKey: AGENT_TOKEN
label:
en: Agent-Token
zh: Agent-Token
required: false
type: text
edit: true
random: true
values: []

View File

@@ -0,0 +1,17 @@
services:
glance-agent:
container_name: ${CONTAINER_NAME}
image: glanceapp/agent:v0.1.0
environment:
TOKEN: ${AGENT_TOKEN}
volumes:
- /storage:/storage:ro
ports:
- ${AGENT_PORT}:27973
networks:
- 1panel-network
labels:
createdBy: Apps
networks:
1panel-network:
external: true

View File

@@ -1,8 +1,20 @@
# Glance Python 远程服务器监控 Agent # Glance 远程服务器监控 Agent
## 项目简介 ## 项目简介
本项目为 Glance Dashboard 提供远程服务器监控数据采集,使用 Python3 + FastAPI 实现,兼容 Glance `server-stats` 组件前端展示。支持 Docker 部署,适合多服务器统一监控。 本项目为 Glance Dashboard 提供远程服务器监控数据采集,使用 Python3 + FastAPI 实现,兼容 Glance `server-stats` 组件前端展示。支持 Docker 部署,适合多服务器统一监控。
## 更新说明
Glance官方已经发布了agent项目地址[glance-agent](https://github.com/glanceapp/agent)
本次更新后,保留本人使用 Python3 + FastAPI 实现的版本,同时新增了对 Glance 官方 agent 的支持。
因为原生支持官方的agent所以更推荐使用官方版本
## 版本说明
- 0.1.0 官方稳定版本 推荐
- latest 官方最新版本
- custom 作者自己写的版本 项目保留
## 功能特性 ## 功能特性
- 采集主机名、平台、启动时间、CPU 负载/温度、内存、磁盘等信息 - 采集主机名、平台、启动时间、CPU 负载/温度、内存、磁盘等信息
- 提供 `/api/sysinfo/all` HTTP API返回 Glance 兼容 JSON - 提供 `/api/sysinfo/all` HTTP API返回 Glance 兼容 JSON
@@ -10,6 +22,18 @@
- 可多实例部署,适配多服务器场景 - 可多实例部署,适配多服务器场景
- **主机名自动识别**:容器内自动优先读取宿主机 `/etc/hostname`,无需手动配置 - **主机名自动识别**:容器内自动优先读取宿主机 `/etc/hostname`,无需手动配置
## 配置方法
在配置文件中添加以下内容:
- type: server-stats
servers:
- type: remote
name: Custom Server Name
url: http://<server IP or domain>:27973
token: <token from above, if set>
## API 说明 ## API 说明
- 路径:`/api/sysinfo/all` - 路径:`/api/sysinfo/all`
- 方法GET - 方法GET
@@ -212,5 +236,6 @@
``` ```
## 参考 ## 参考
- [Glance-Agent](https://github.com/glanceapp/agent)
- [Glance-Monitor](https://github.com/arch3rPro/Glance-Monitor) - [Glance-Monitor](https://github.com/arch3rPro/Glance-Monitor)
- [Document文档](https://github.com/arch3rPro/Glance-Monitor/blob/main/server-status-agent/README.md) - [Document文档](https://github.com/arch3rPro/Glance-Monitor/blob/main/server-status-agent/README.md)

View File

@@ -0,0 +1,10 @@
additionalProperties:
formFields:
- default: "12080"
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: Service Port 8000
labelZh: 服务端口 8000
required: true
rule: paramPort
type: number

View File

@@ -0,0 +1,18 @@
services:
agent-image:
image: vuldocker/glance-agent:latest
container_name: ${CONTAINER_NAME}
restart: unless-stopped
ports:
- ${PANEL_APP_PORT_HTTP}:8000
volumes:
- /etc/hostname:/host/etc/hostname:ro
networks:
- 1panel-network
environment:
- TZ=Asia/Shanghai
labels:
createdBy: Apps
networks:
1panel-network:
external: true

View File

@@ -1,10 +1,21 @@
additionalProperties: additionalProperties:
formFields: formFields:
- default: "12080" - default: "27973"
edit: true envKey: AGENT_PORT
envKey: PANEL_APP_PORT_HTTP label:
labelEn: Service Port 8000 en: Agent-Port
labelZh: 服务端口 8000 zh: Agent-端口
required: true required: true
rule: paramPort type: number
type: number edit: true
rule: paramPort
- default: your_auth_token_here
envKey: AGENT_TOKEN
label:
en: Agent-Token
zh: Agent-Token
required: false
type: text
edit: true
random: true
values: []

View File

@@ -1,18 +1,17 @@
services: services:
agent-image: glance-agent:
image: vuldocker/glance-agent:latest container_name: ${CONTAINER_NAME}
container_name: ${CONTAINER_NAME} image: glanceapp/agent:latest
restart: unless-stopped environment:
ports: TOKEN: ${AGENT_TOKEN}
- ${PANEL_APP_PORT_HTTP}:8000 volumes:
volumes: - /storage:/storage:ro
- /etc/hostname:/host/etc/hostname:ro ports:
networks: - ${AGENT_PORT}:27973
- 1panel-network networks:
environment: - 1panel-network
- TZ=Asia/Shanghai labels:
labels: createdBy: Apps
createdBy: Apps
networks: networks:
1panel-network: 1panel-network:
external: true external: true