为了高效的管理服务器,实时监测服务器的数据是必要的。
这里我们使用哪吒面板来检测服务器的运行状态。
使用了美化主题后的哪吒面板
项目地址:https://github.com/naiba/nezha
准备两个子域名
- 一个解析服务端面板,可接入CDN安全加速访问
- 一个解析到服务端面板的域名,不可接入CDN(非必要,但非常建议,后期备份迁移方便)
登录GitHub账号(如果没有先注册)
-
Register application创建
安装服务端(监控机)
-
安装前需要先放行
8008
和5555
默认端口,如果修改为了其他端口请先放行 -
这里使用脚本安装
#国外服务 curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh sudo ./nezha.sh
国内服务器 curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh CN=true sudo ./nezha.sh
输入
1
安装面板端依次填入
GitHub用户名
Client ID
Client secret
按提示填写即可访问http://你的IP/域名:8008 就可以访问面板了 管理后台使用GitHub账号登录
配置反向代理+域名证书
-
这里我用Nginx
location / { proxy_pass http://127.0.0.1:8008; proxy_set_header Host $host; } location /ws { proxy_pass http://127.0.0.1:8008; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; } location /terminal { proxy_pass http://127.0.0.1:8008; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; }
Http同理
去掉 ssl段
监听80端口
去掉 最后一个server
-
配置完成成功访问域名后回到GitHub修改
OAuth Apps
将Http修改为https 以及去掉8008端口Update application更新
安装客户端(被监控)
-
登录你的面板后台
GitHub账号
登录在后台
主机
选项点击添加主机
填写对应表单后点击添加
按钮复制
密钥
到客户端服务器(被监控端)执行脚本命令-
A
#国外服务器 curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh ./nezha.sh
#国内服务器 curl -L https://raw.sevencdn.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh CN=true ./nezha.sh
输入
8
安装客户端监控依次输入 解析到
面板域名
的域名
(域名可以不填直接填IP也可以,不建议)端口
密钥
-
B
也可以在面板后台主机管理中复制一键安装脚本
-
-
如果没报错基本就完成了
常见问题
-
国内服务器出现curl: (7) Failed to connect to raw.githubusercontent.com
echo 199.232.68.133 raw.githubusercontent.com >> /etc/hosts
-
修改服务器备注后变成"离线"久不恢复
在安装客户端(被监控)的服务器上执行
systemctl restart nezha-agent
重启程序 -
启动nezha-agent还是一直显示离线
检查配置有没有写对
cat /etc/systemd/system/nezha-agent.service | grep ExecStart
美化主题
- 可以在设置中修改主题
- 可以在后台设置中自定义
css
script
- 哪吒监控透明主题: https://ii.do/43.html
Q.E.D.