diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 8653f407..67cc45e2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -1,7 +1,7 @@ name: 错误报告 description: File a bug report. title: "[错误报告]: " -labels: [""] +labels: [ "" ] body: - type: markdown attributes: @@ -42,7 +42,6 @@ body: - 其他 validations: required: true - - type: textarea id: what-happened attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 9d9892be..59730be8 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -1,7 +1,7 @@ name: 功能改进 description: 提出新功能建议 (请提交到需求收集帖) title: "[功能建议]: " -labels: [""] +labels: [ "" ] body: - type: markdown attributes: diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index 93eb54d1..be3a9c77 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -41,7 +41,7 @@ jobs: pnpm install pnpm build - - name: 📦️ Download instant-agent + - name: 📦️ Download instance-agent working-directory: ./docker/service run: wget https://github.com/lijiahangmax/orion-visor-agent/releases/latest/download/instance-agent-release.tar.gz -O instance-agent-release.tar.gz diff --git a/README.md b/README.md index 289002d2..9c0b084c 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ * **文件管理**:支持远程主机 SFTP 大文件的批量上传、下载和在线编辑等操作。 * **批量操作**:支持批量执行主机命令、多主机文件分发等功能。 * **计划任务**:支持配置 cron 表达式,定时执行主机命令。 -* **系统监控**:(开发中)。 +* **系统监控**:支持对主机 CPU、内存、磁盘、网络等系统指标的监控和告警。 * **安全可靠**:动态配置权限,记录用户操作日志,提供简单的审计功能。 ## 演示环境 @@ -88,6 +88,7 @@ docker compose up -d * SpringBoot 2.7+ * Mysql 8.0+ * Redis 6.0+ +* InfluxDB 2.7+ * Vue 3.5+ * Arco Design 2.56+ @@ -155,6 +156,10 @@ QQ群: 755242157 本项目遵循 [Apache-2.0](https://github.com/dromara/orion-visor/blob/main/LICENSE) 开源许可证。 +## 贡献者 + +[![Contributors](https://contri.buzz/api/wall?repo=dromara/orion-visor)](https://github.com/dromara/orion-visor, "Contributors") + ## Gitee 最有价值的开源项目 GVP ![GVP](docs/assets/gvp.jpg?time=20250627 "GVP") diff --git a/docker/service/Dockerfile b/docker/service/Dockerfile index 15b3866a..b04ef717 100644 --- a/docker/service/Dockerfile +++ b/docker/service/Dockerfile @@ -24,7 +24,7 @@ RUN chmod +x /app/entrypoint.sh # 复制 jar 包 COPY ./service/orion-visor-launch.jar /app/app.jar # 复制探针包 -ADD ./service/instant-agent-release.tar.gz /app/instant-agent-release +ADD ./service/instance-agent-release.tar.gz /app/instance-agent-release # 启动检测 HEALTHCHECK --interval=15s --timeout=5s --retries=5 --start-period=10s \ diff --git a/docker/service/entrypoint.sh b/docker/service/entrypoint.sh index dac1d10f..d163a824 100644 --- a/docker/service/entrypoint.sh +++ b/docker/service/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh -AGENT_RELEASE_DIR="/root/orion/orion-visor/instant-agent-release" -DEFAULT_AGENT_DIR="/app/instant-agent-release" +AGENT_RELEASE_DIR="/root/orion/orion-visor/instance-agent-release" +DEFAULT_AGENT_DIR="/app/instance-agent-release" # 确保父目录存在 mkdir -p "$(dirname "$AGENT_RELEASE_DIR")" diff --git a/orion-visor-common/src/main/java/org/dromara/visor/common/constant/FileConst.java b/orion-visor-common/src/main/java/org/dromara/visor/common/constant/FileConst.java index 1bc002fb..1a68275a 100644 --- a/orion-visor-common/src/main/java/org/dromara/visor/common/constant/FileConst.java +++ b/orion-visor-common/src/main/java/org/dromara/visor/common/constant/FileConst.java @@ -37,15 +37,17 @@ public interface FileConst { String SCRIPT = "script"; - String INSTANT_AGENT_PATH = "instant-agent"; + String INSTANCE_AGENT_PATH = "instance-agent"; - String INSTANT_AGENT_NAME = "instant_agent"; + String INSTANCE_AGENT_NAME = "instance_agent"; - String INSTANT_AGENT_RELEASE = "instant-agent-release"; + String INSTANCE_AGENT_FILE_FORMAT = "instance_agent_{}_{}{}"; - String INSTANT_AGENT_RELEASE_TEMP = "instant-agent-release-temp"; + String INSTANCE_AGENT_RELEASE = "instance-agent-release"; - String INSTANT_AGENT_RELEASE_TAR_GZ = "instant-agent-release.tar.gz"; + String INSTANCE_AGENT_RELEASE_TEMP = "instance-agent-release-temp"; + + String INSTANCE_AGENT_RELEASE_TAR_GZ = "instance-agent-release.tar.gz"; String VERSION = ".version"; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/api/impl/HostAgentApiImpl.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/api/impl/HostAgentApiImpl.java index 84a13b0c..e5d31a5c 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/api/impl/HostAgentApiImpl.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/api/impl/HostAgentApiImpl.java @@ -83,6 +83,9 @@ public class HostAgentApiImpl implements HostAgentApi { .filter(Strings::isNotBlank) .map(Long::parseLong) .collect(Collectors.toList()); + if (logIdList.isEmpty()) { + return Lists.empty(); + } // 查询数据库 return hostAgentLogDAO.selectBatchIds(logIdList) .stream() diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/HostVO.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/HostVO.java index fed4d555..623155ca 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/HostVO.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/entity/vo/HostVO.java @@ -72,12 +72,21 @@ public class HostVO implements Serializable { @Schema(description = "主机地址") private String address; - @Schema(description = "主机端口") - private Integer port; - @Schema(description = "主机状态") private String status; + @Schema(description = "agentKey") + private String agentKey; + + @Schema(description = "探针版本") + private String agentVersion; + + @Schema(description = "探针安装状态") + private Integer agentInstallStatus; + + @Schema(description = "探针在线状态") + private Integer agentOnlineStatus; + @Schema(description = "描述") private String description; diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/agent/intstall/AbstractAgentInstaller.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/agent/intstall/AbstractAgentInstaller.java index d4a3ef64..38c8a3db 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/agent/intstall/AbstractAgentInstaller.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/handler/agent/intstall/AbstractAgentInstaller.java @@ -86,7 +86,7 @@ public abstract class AbstractAgentInstaller implements AgentInstaller { this.params = params; this.logId = params.getLogId(); this.startScriptName = Const.START + HostOsTypeEnum.of(params.getOsType()).getScriptSuffix(); - this.uploadAgentName = FileConst.INSTANT_AGENT_NAME + HostOsTypeEnum.of(params.getOsType()).getBinarySuffix(); + this.uploadAgentName = FileConst.INSTANCE_AGENT_NAME + HostOsTypeEnum.of(params.getOsType()).getBinarySuffix(); } @Override @@ -154,7 +154,7 @@ public abstract class AbstractAgentInstaller implements AgentInstaller { protected String getAgentHomePath() { return PathUtils.buildAppPath(HostOsTypeEnum.WINDOWS.name().equals(params.getOsType()), sshConfig.getUsername(), - FileConst.INSTANT_AGENT_PATH) + Const.SLASH; + FileConst.INSTANCE_AGENT_PATH) + Const.SLASH; } /** diff --git a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/HostAgentServiceImpl.java b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/HostAgentServiceImpl.java index d22d15d4..5b45b621 100644 --- a/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/HostAgentServiceImpl.java +++ b/orion-visor-modules/orion-visor-module-asset/orion-visor-module-asset-service/src/main/java/org/dromara/visor/module/asset/service/impl/HostAgentServiceImpl.java @@ -75,8 +75,6 @@ import java.util.stream.Collectors; @Service public class HostAgentServiceImpl implements HostAgentService { - private static final String AGENT_FILE_FORMAT = "agent_{}_{}{}"; - private String localVersion; @Value("${orion.api.expose.token}") @@ -95,7 +93,7 @@ public class HostAgentServiceImpl implements HostAgentService { public void readLocalAgentVersion() { log.info("HostAgentService-readLocalAgentVersion start"); // 文件路径 - String path = PathUtils.getOrionPath(FileConst.INSTANT_AGENT_RELEASE + Const.SLASH + FileConst.VERSION); + String path = PathUtils.getOrionPath(FileConst.INSTANCE_AGENT_RELEASE + Const.SLASH + FileConst.VERSION); log.info("HostAgentService-readLocalAgentVersion path: {}", path); try { if (!Files1.isFile(path)) { @@ -191,9 +189,9 @@ public class HostAgentServiceImpl implements HostAgentService { Valid.notBlank(fileName, ErrorMessage.FILE_EXTENSION_TYPE); Valid.isTrue(fileName.endsWith(Const.SUFFIX_TAR_GZ), ErrorMessage.FILE_EXTENSION_TYPE); // 保存文件 - String releaseDir = PathUtils.getOrionPath(FileConst.INSTANT_AGENT_RELEASE); - String releaseTempDir = PathUtils.getOrionPath(FileConst.INSTANT_AGENT_RELEASE_TEMP); - File releaseTempFile = new File(releaseTempDir + Const.SLASH + FileConst.INSTANT_AGENT_RELEASE_TAR_GZ); + String releaseDir = PathUtils.getOrionPath(FileConst.INSTANCE_AGENT_RELEASE); + String releaseTempDir = PathUtils.getOrionPath(FileConst.INSTANCE_AGENT_RELEASE_TEMP); + File releaseTempFile = new File(releaseTempDir + Const.SLASH + FileConst.INSTANCE_AGENT_RELEASE_TAR_GZ); log.info("HostAgentService.installAgent start releaseTempDir: {}, releaseTempFile: {}", releaseTempDir, releaseTempFile.getAbsolutePath()); try { // 创建目录 @@ -269,7 +267,7 @@ public class HostAgentServiceImpl implements HostAgentService { Valid.isTrue(supportSsh, ErrorMessage.PLEASE_CHECK_HOST_SSH, host.getName()); // 文件名称 HostOsTypeEnum os = HostOsTypeEnum.of(host.getOsType()); - String agentFileName = Strings.format(AGENT_FILE_FORMAT, + String agentFileName = Strings.format(FileConst.INSTANCE_AGENT_FILE_FORMAT, os.name().toLowerCase(), host.getArchType().toLowerCase(), os.getBinarySuffix()); @@ -278,9 +276,9 @@ public class HostAgentServiceImpl implements HostAgentService { .hostId(host.getId()) .osType(host.getOsType()) .agentKey(host.getAgentKey()) - .agentFilePath(PathUtils.getOrionPath(FileConst.INSTANT_AGENT_RELEASE + Const.SLASH + agentFileName)) - .configFilePath(PathUtils.getOrionPath(FileConst.INSTANT_AGENT_RELEASE + Const.SLASH + FileConst.CONFIG_YAML)) - .startScriptPath(PathUtils.getOrionPath(FileConst.INSTANT_AGENT_RELEASE + Const.SLASH + Const.START + os.getScriptSuffix())) + .agentFilePath(PathUtils.getOrionPath(FileConst.INSTANCE_AGENT_RELEASE + Const.SLASH + agentFileName)) + .configFilePath(PathUtils.getOrionPath(FileConst.INSTANCE_AGENT_RELEASE + Const.SLASH + FileConst.CONFIG_YAML)) + .startScriptPath(PathUtils.getOrionPath(FileConst.INSTANCE_AGENT_RELEASE + Const.SLASH + Const.START + os.getScriptSuffix())) .build(); taskParams.add(params); // 添加待检查文件 diff --git a/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue b/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue index 0b6fdd94..e93ce296 100644 --- a/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue +++ b/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue @@ -287,14 +287,14 @@ @click="setInstallSuccess(record.installLog)"> 安装成功 - + - {{ toggleDictValue(AlarmSwitchKey, record.alarmSwitch, 'label') + '报警' }} + {{ toggleDictValue(AlarmSwitchKey, record.alarmSwitch, 'label') + '告警' }} diff --git a/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-table.vue b/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-table.vue index fe224806..2d65c7f1 100644 --- a/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-table.vue +++ b/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-table.vue @@ -317,14 +317,14 @@ @click="setInstallSuccess(record.installLog)"> 安装成功 - + - {{ toggleDictValue(AlarmSwitchKey, record.alarmSwitch, 'label') + '报警' }} + {{ toggleDictValue(AlarmSwitchKey, record.alarmSwitch, 'label') + '告警' }} diff --git a/orion-visor-ui/src/views/monitor/monitor-host/types/use-monitor-host-list.ts b/orion-visor-ui/src/views/monitor/monitor-host/types/use-monitor-host-list.ts index 6e072b3e..3fe83588 100644 --- a/orion-visor-ui/src/views/monitor/monitor-host/types/use-monitor-host-list.ts +++ b/orion-visor-ui/src/views/monitor/monitor-host/types/use-monitor-host-list.ts @@ -107,13 +107,13 @@ export default function useMonitorHostList(options: UseMonitorHostListOptions) { }); }; - // 更新报警开关 + // 更新告警开关 const toggleAlarmSwitch = async (record: MonitorHostQueryResponse) => { const dict = toggleDict(AlarmSwitchKey, record.alarmSwitch); Modal.confirm({ title: `${dict.label}确认`, titleAlign: 'start', - content: `确定要${dict.label}报警功能吗?`, + content: `确定要${dict.label}告警功能吗?`, okText: '确定', onOk: async () => { try { diff --git a/sql/init-4-data.sql b/sql/init-4-data.sql index 18bf65d3..1ce094b5 100644 --- a/sql/init-4-data.sql +++ b/sql/init-4-data.sql @@ -664,6 +664,6 @@ INSERT INTO `system_menu` VALUES (287, 283, '删除监控指标', 'monitor:monit INSERT INTO `system_menu` VALUES (288, 282, '主机监控', NULL, 2, 10, 1, 1, 1, 0, 'IconComputer', NULL, 'monitorHost', '2025-08-23 17:02:02', '2025-08-24 22:47:03', 'admin', 'admin', 0); INSERT INTO `system_menu` VALUES (289, 288, '查询监控主机', 'monitor:monitor-host:query', 3, 10, 1, 1, 1, 0, NULL, NULL, NULL, '2025-08-23 17:02:02', '2025-08-23 17:02:02', 'admin', 'admin', 0); INSERT INTO `system_menu` VALUES (290, 288, '修改监控主机', 'monitor:monitor-host:update', 3, 20, 1, 1, 1, 0, NULL, NULL, NULL, '2025-08-23 17:02:02', '2025-08-23 17:03:56', 'admin', 'admin', 0); -INSERT INTO `system_menu` VALUES (292, 288, '修改报警开关', 'monitor:monitor-host:update-switch', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2025-08-23 17:02:02', '2025-08-23 17:04:31', 'admin', 'admin', 0); +INSERT INTO `system_menu` VALUES (292, 288, '修改告警开关', 'monitor:monitor-host:update-switch', 3, 30, 1, 1, 1, 0, NULL, NULL, NULL, '2025-08-23 17:02:02', '2025-08-23 17:04:31', 'admin', 'admin', 0); INSERT INTO `system_menu` VALUES (293, 64, '安装探针', 'asset:host:install-agent', 3, 110, 1, 1, 1, 0, NULL, NULL, NULL, '2025-08-31 20:18:14', '2025-08-31 20:18:14', 'admin', 'admin', 0); INSERT INTO `system_menu` VALUES (294, 282, '主机监控详情', NULL, 2, 20, 0, 1, 1, 0, 'IconComputer', '', 'monitorDetail', '2025-09-03 23:03:20', '2025-09-03 23:03:55', 'admin', 'admin', 0);