From f6e0dc5f9d53cff54d4cc95384d3cd1ccf6bda3c Mon Sep 17 00:00:00 2001 From: naiba Date: Wed, 2 Dec 2020 10:04:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20#5=20update=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 97f1d25..b7d76ec 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,43 @@ 服务期状态监控,被动接收(非 node-exporter 那种主动拉取的方式。) +## 一键脚本 + +```shell +curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh +sudo ./nezha.sh +``` +## 反代配置 + +使用反向代理时需要针对 `/ws` 路径的 WebSocket 进行特别配置以支持实时更新服务器状态。 + +- [Nginx(宝塔)](https://www.google.com/search?q=nginx+%E5%8F%8D%E4%BB%A3+websocket):在你的 nginx 配置文件中加入以下代码 + + ```nginx + server{ + + #server_name blablabla... + + location /ws { + proxy_pass http://ip:8008; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + } + + #其他的 location blablabla... + } + ``` + +- CaddyServer v1(v2无需特别配置) + + ```Caddyfile + proxy /ws http://ip:8008 { + websocket + } + ``` + ## 系统设计 C/S 采用 gRPC 通信,客户端通过添加主机生成的单独 Token 上报监控信息。因为不会做成多用户的,上报信息会储存到内存中,暂不提供历史数据统计。 @@ -11,16 +48,6 @@ C/S 采用 gRPC 通信,客户端通过添加主机生成的单独 Token 上报 - 首次连接:上报基本信息(系统、CPU基本信息),后面管理员可从客户端主动拉取更新。 - 监控上报:每隔 3s 向服务器上报系统信息 -## 一键脚本 - -```shell -curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh -sudo ./nezha.sh -``` -## FAQ - -- 反代后 **实时通道断开**:[Nginx 反代 WebSocket](https://www.google.com/search?q=nginx+%E5%8F%8D%E4%BB%A3+websocket) - ## 社区文章 - [哪吒面板:小鸡们的最佳探针](https://www.zhujizixun.com/2843.html) *(已过时)*