diff --git a/apps/glance-agent/0.1.0/data.yml b/apps/glance-agent/0.1.0/data.yml new file mode 100644 index 0000000..8fb0724 --- /dev/null +++ b/apps/glance-agent/0.1.0/data.yml @@ -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: [] diff --git a/apps/glance-agent/0.1.0/docker-compose.yml b/apps/glance-agent/0.1.0/docker-compose.yml new file mode 100644 index 0000000..cab605d --- /dev/null +++ b/apps/glance-agent/0.1.0/docker-compose.yml @@ -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 diff --git a/apps/glance-agent/README.md b/apps/glance-agent/README.md index cd1f1da..226535e 100644 --- a/apps/glance-agent/README.md +++ b/apps/glance-agent/README.md @@ -1,8 +1,20 @@ -# Glance Python 远程服务器监控 Agent +# Glance 远程服务器监控 Agent ## 项目简介 本项目为 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 负载/温度、内存、磁盘等信息 - 提供 `/api/sysinfo/all` HTTP API,返回 Glance 兼容 JSON @@ -10,6 +22,18 @@ - 可多实例部署,适配多服务器场景 - **主机名自动识别**:容器内自动优先读取宿主机 `/etc/hostname`,无需手动配置 +## 配置方法 + +在配置文件中添加以下内容: + +- type: server-stats + servers: + - type: remote + name: Custom Server Name + url: http://:27973 + token: + + ## API 说明 - 路径:`/api/sysinfo/all` - 方法:GET @@ -212,5 +236,6 @@ ``` ## 参考 +- [Glance-Agent](https://github.com/glanceapp/agent) - [Glance-Monitor](https://github.com/arch3rPro/Glance-Monitor) - [Document文档](https://github.com/arch3rPro/Glance-Monitor/blob/main/server-status-agent/README.md) diff --git a/apps/glance-agent/custom/data.yml b/apps/glance-agent/custom/data.yml new file mode 100644 index 0000000..e4858c9 --- /dev/null +++ b/apps/glance-agent/custom/data.yml @@ -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 diff --git a/apps/glance-agent/custom/docker-compose.yml b/apps/glance-agent/custom/docker-compose.yml new file mode 100644 index 0000000..1acffa2 --- /dev/null +++ b/apps/glance-agent/custom/docker-compose.yml @@ -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 diff --git a/apps/glance-agent/latest/data.yml b/apps/glance-agent/latest/data.yml index e4858c9..8fb0724 100644 --- a/apps/glance-agent/latest/data.yml +++ b/apps/glance-agent/latest/data.yml @@ -1,10 +1,21 @@ additionalProperties: - formFields: - - default: "12080" - edit: true - envKey: PANEL_APP_PORT_HTTP - labelEn: Service Port 8000 - labelZh: 服务端口 8000 - required: true - rule: paramPort - type: number + 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: [] diff --git a/apps/glance-agent/latest/docker-compose.yml b/apps/glance-agent/latest/docker-compose.yml index 1acffa2..586209b 100644 --- a/apps/glance-agent/latest/docker-compose.yml +++ b/apps/glance-agent/latest/docker-compose.yml @@ -1,18 +1,17 @@ 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 + glance-agent: + container_name: ${CONTAINER_NAME} + image: glanceapp/agent:latest + environment: + TOKEN: ${AGENT_TOKEN} + volumes: + - /storage:/storage:ro + ports: + - ${AGENT_PORT}:27973 + networks: + - 1panel-network + labels: + createdBy: Apps networks: - 1panel-network: - external: true + 1panel-network: + external: true