diff --git a/furniture-3d-system/docs/workflow/脚本监控Agent逐台接入操作手册.md b/furniture-3d-system/docs/workflow/脚本监控Agent逐台接入操作手册.md index 8f232f70..731efc24 100644 --- a/furniture-3d-system/docs/workflow/脚本监控Agent逐台接入操作手册.md +++ b/furniture-3d-system/docs/workflow/脚本监控Agent逐台接入操作手册.md @@ -61,9 +61,79 @@ https://cp.jiansun.vip 已知机器长期只处于一种网络时,优先选择固定的 `intranet` 或 `internet`,避免 `auto` 每次先等待不可达地址超时。 -## 5. 每台机器需要的文件 +## 5. 下载每台机器需要的文件 -从产品平台项目的 `agents/script-monitor/` 目录取得以下文件: +平台页面目前没有 Agent 安装包下载按钮。安装人员不需要取得整个产品平台项目,也不需要登录代码仓库;请从下面固定版本地址下载 4 个文件。 + +当前受支持版本:`Agent 1.0.0`,对应生产发布提交 `dc16d2b75c41a5009354ba56caf4c1517d77ccce`。 + +| 文件 | 固定下载地址 | +| --- | --- | +| `agent.mjs` | `http://git.1080p.hk/WuYongJie/furniture-3d-system-Wu/raw/commit/dc16d2b75c41a5009354ba56caf4c1517d77ccce/furniture-3d-system/agents/script-monitor/agent.mjs` | +| `run-script.mjs` | `http://git.1080p.hk/WuYongJie/furniture-3d-system-Wu/raw/commit/dc16d2b75c41a5009354ba56caf4c1517d77ccce/furniture-3d-system/agents/script-monitor/run-script.mjs` | +| `ecosystem.config.cjs` | `http://git.1080p.hk/WuYongJie/furniture-3d-system-Wu/raw/commit/dc16d2b75c41a5009354ba56caf4c1517d77ccce/furniture-3d-system/agents/script-monitor/ecosystem.config.cjs` | +| `config.example.json` | `http://git.1080p.hk/WuYongJie/furniture-3d-system-Wu/raw/commit/dc16d2b75c41a5009354ba56caf4c1517d77ccce/furniture-3d-system/agents/script-monitor/config.example.json` | + +这些是固定提交地址,不会因为主线后续修改而改变内容。下载服务当前只提供 HTTP,因此必须按下面的命令自动核对 SHA256;校验不通过时禁止运行文件。 + +### 5.1 Windows PowerShell 一次下载并校验 + +以 PowerShell 打开目标机器,完整执行: + +```powershell +$agentDir = 'C:\furniture-script-monitor' +$baseUrl = 'http://git.1080p.hk/WuYongJie/furniture-3d-system-Wu/raw/commit/dc16d2b75c41a5009354ba56caf4c1517d77ccce/furniture-3d-system/agents/script-monitor' +$expectedHashes = @{ + 'agent.mjs' = '2C67D765F0BCFFE64B4BD1838A046D12DCCAFECDD51FAE7C92379C9DC19E0889' + 'run-script.mjs' = '7168F227ED63E5EC6B05EF4D849709F3CB6BC6B89B9CB2186439F92ACE333207' + 'ecosystem.config.cjs' = '1D03D8D15C39B358E5BF819B7C124FB9804FEFFB9CB239AB73561607E339F6D7' + 'config.example.json' = '689D6A36180DACF5E63059B6FFE7BBD5F7CAF53AC3E8954776FA67B0F5410B5C' +} + +New-Item -ItemType Directory -Path $agentDir -Force | Out-Null +foreach ($fileName in $expectedHashes.Keys) { + $targetPath = Join-Path $agentDir $fileName + Invoke-WebRequest -Uri "$baseUrl/$fileName" -OutFile $targetPath + $actualHash = (Get-FileHash -Algorithm SHA256 -LiteralPath $targetPath).Hash + if ($actualHash -ne $expectedHashes[$fileName]) { + Remove-Item -LiteralPath $targetPath -Force + throw "$fileName 下载校验失败,已删除,请停止安装并联系平台负责人" + } +} + +Copy-Item -LiteralPath "$agentDir\config.example.json" -Destination "$agentDir\config.json" -Force +Get-ChildItem -LiteralPath $agentDir +``` + +看到 5 个文件(包括复制出来的 `config.json`)且没有红色报错,才可以继续第 7 节填写配置。 + +### 5.2 Linux 一次下载并校验 + +```bash +sudo mkdir -p /opt/furniture-script-monitor +sudo chown -R "$(id -un):$(id -gn)" /opt/furniture-script-monitor +cd /opt/furniture-script-monitor + +base_url='http://git.1080p.hk/WuYongJie/furniture-3d-system-Wu/raw/commit/dc16d2b75c41a5009354ba56caf4c1517d77ccce/furniture-3d-system/agents/script-monitor' +curl -fL "$base_url/agent.mjs" -o agent.mjs +curl -fL "$base_url/run-script.mjs" -o run-script.mjs +curl -fL "$base_url/ecosystem.config.cjs" -o ecosystem.config.cjs +curl -fL "$base_url/config.example.json" -o config.example.json + +sha256sum -c <<'EOF' +2c67d765f0bcffe64b4bd1838a046d12dccafecdd51fae7c92379c9dc19e0889 agent.mjs +7168f227ed63e5ec6b05ef4d849709f3cb6bc6b89b9cb2186439f92ace333207 run-script.mjs +1d03d8d15c39b358e5bf819b7c124fb9804feffb9cb239ab73561607e339f6d7 ecosystem.config.cjs +689d6a36180dacf5e63059b6ffe7bbd5f7caf53ac3e8954776fa67b0f5410b5c config.example.json +EOF + +cp config.example.json config.json +chmod 600 config.json +``` + +四行都显示 `OK` 才能继续安装。若目标机器不能访问 `git.1080p.hk`,由平台负责人从产品项目的 `furniture-3d-system/agents/script-monitor/` 目录取得同一版本的以下 4 个文件,打包后通过公司文件传输渠道发送;压缩包中不得包含任何机器的 `config.json`。 + +需要的文件清单: ```text agent.mjs