在网上搜索很久没看到具体的教程,自己摸索汇总了搜索到的资源
ps:我是主控端分别装在两台机器,按官方教程装V1版,手搓V0
1.安装主控端V0版
主控端安装
Bash/Shell
curl -L https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/v0/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha注意:端口不要冲突
dashboard参数设置可参考此贴老哥备份整理的v0文档
2.安装被控端agent
官网下载v0版本agent(以AMD的最后一版v0.20.5为例,如需特定版本请将链接改为v0.xx.x)
Bash/Shell
wget https://github.com/nezhahq/agent/releases/download/v0.20.5/nezha-agent_linux_amd64.zip- 创建并解压文件
Bash/Shell
mkdir -p /opt/nezha/agent-v0
unzip nezha-agent_linux_amd64.zip -d /opt/nezha/agent-v0- 创建v0的service文件
Bash/Shell
vim /etc/systemd/system/nezha-agent-v0.service- 复制以下代码
注意ExecStart后面一定要加上"--disable-auto-update" "--disable-command-execute"禁止自动更新,否则运行后agent会直接升级到最新版,导致不兼容报错
Bash/Shell
[Unit]
Description=哪吒探针监控端v0
ConditionFileIsExecutable=/opt/nezha/agent-v0/nezha-agent
[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/opt/nezha/agent-v0/nezha-agent "-s" "example.com:port" "-p" "密钥" "--disable-auto-update" "--disable-command-execute"
WorkingDirectory=/opt/nezha/agent-v0
Restart=always
RestartSec=120
EnvironmentFile=-/etc/sysconfig/nezha-agent-v0
[Install]
WantedBy=multi-user.target- 保存,退出
Bash/Shell
systemctl daemon-reload- 重启agent
Bash/Shell
systemctl restart nezha-agent-v0
暂无评论