更新英文文档:Dashboard安装文档、Agent安装文档

This commit is contained in:
hhhkkk520 2022-05-20 17:28:15 +02:00
parent 41cf48e5a5
commit a5aa54d483
3 changed files with 98 additions and 113 deletions

View File

@ -1,63 +1,57 @@
**哪吒监控的被控端服务被称为Agent本文档将介绍如何在被控端服务器上安装Agent并与Dashboard连接** **The service in the monitored server is called Agent. This document will describe how to install the Agent on the monitored server and connect it with Dashboard**
<br/> <br/>
## Install Agent using one-click script ## Install Agent using one-click script
目前哪吒监控已支持在WIndows和Linux上一键安装Agent遵循本文档的步骤你可以很轻松的在服务器上部署它 Nezha Monitoring now supports one-click installation of the Agent on Windows and Linux. Follow the steps in this document and you can easily deploy it on your server
<br/> <br/>
### 准备工作 ### Preparation
--- First of all, you need to set up the communication domain name in the settings page of the admin panel, this domain name can not connect to the CDN, here is the sample communication domain name "data.example.com" mentioned earlier for demonstration
你需要提前在管理面板中设置好通信域名此域名不可以接入CDN这里以前面提到过的示例通信域名 “data.example.com” 来做演示 Enter the administration panel, go to the "Settings" page, in the item "CDN Bypassed Domain/IP
进入后台管理面板转到“设置”页在“未接入CDN的面板服务器域名/IP”项中填入通信域名然后点击"保存" ", fill in the communication domain name, and then click "Save"
<br/> <br/>
### Linux一键安装 ### One-click installation on Linux
--- * First add a server in the admin panel
* 首先在管理面板中添加一台服务器 * Click on the green Linux icon button next to the newly added server and copy the one-click installation command
* 点击新添加的服务器旁绿色的Linux图标按钮复制一键安装命令 * Run the copied one-click installation command on the monitored server, wait for the installation to complete, and then return to the Dashboard home page to see if the server is online.
* 在被控端服务器中运行复制的一键安装命令等待安装完成后返回到Dashboard主页查看服务器是否上线
<br/> <br/>
### Windows一键安装 ### One-click installation on Windows
--- * First add a server in the admin panel
* 首先在管理面板中添加一台服务器 * Click on the green Linux icon button next to the newly added server and copy the one-click installation command
* 点击新添加的服务器旁绿色的Windows图标按钮复制一键安装命令 * Login to Windows Server, open PowerShell, and run the copied installation command in PowerShell
* 进入Windows服务器运行PowerShell在PowerShell中运行复制的安装命令 * If you encounter the prompt "Implement Policy Change" please select Y
* 如遇到确认「执行策略变更」请选择 Y * Wait for the installation to complete and return to the Dashboard home page to see if the server is online
* 等待安装完成后返回Dashboard主页查看服务器是否上线
<br/> <br/>
<br/> <br/>
## 其他方式安装Agent ## Other ways to install Agent
---
<br/> <br/>
### Linux安装Agent ### Installing Agent on Linux
--- * First add a server in the admin panel
* 首先在管理面板中添加一台服务器 * In the monitored server, run the script:
* 在被控服务器中,运行脚本(位于中国大陆的服务器请使用镜像):
```bash ```bash
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://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
``` ```
* 选择“安装监控Agent” * Select “Install_agent”
* 输入通信域名”data.example.com“ * Input the communication domain name, e.g. "data.example.com"
* 输入面板通信端口默认为5555 * Input RPC port, default is 5555
* 输入Agent密钥Agent密钥在管理面板中添加服务器时生成可以在管理面板中的“主机”页中找到 * Input the Agent Secret, which is generated when adding a server in the administration panel and can be found in the " Servers " page of the administration panel
* 等待安装完成后返回Dashboard主页查看服务器是否上线 * Wait for the installation to complete and return to the Dashboard home page to see if the server is online
<br/> <br/>
### Windows安装Agent ### Installing Agent on Windows
--- - Please refer to the community article:
- 请参考社区文章: [哪吒探针 - Windows 客户端安装](https://nyko.me/2020/12/13/nezha-windows-client.html)(Chinese)
[哪吒探针 - Windows 客户端安装](https://nyko.me/2020/12/13/nezha-windows-client.html)
<br/> <br/>
### OpenWRT安装Agent ### Installing Agent on OpenWRT
---
**如何使 旧版OpenWRT/LEDE 自启动** **How to make the old version of OpenWRT/LEDE self-boot?**
- 请参考项目: - Please refer to the project:
[哪吒监控 For OpenWRT](https://github.com/Erope/openwrt_nezha) [哪吒监控 For OpenWRT](https://github.com/Erope/openwrt_nezha) (Chinese)
<br/> <br/>
**如何使 新版OpenWRT 自启动?来自 @艾斯德斯** **How to make the new version of OpenWRT self-boot? By @艾斯德斯**
* 首先在 release 下载对应的二进制解压 zip 包后放置到 `/root` * First download the corresponding binary from the release, unzip the zip package and place it in `/root`
* 运行 `chmod +x /root/nezha-agent` 赋予执行权限,然后创建 `/etc/init.d/nezha-service` * Then run `chmod +x /root/nezha-agent` to give it execute access, create file `/etc/init.d/nezha-service`
```shell ```shell
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
@ -67,7 +61,7 @@ USE_PROCD=1
start_service() { start_service() {
procd_open_instance procd_open_instance
procd_set_param command /root/nezha-agent -s 面板通信地址:端口 -p 秘钥 -d procd_set_param command /root/nezha-agent -s data.example.com:5555 -p secreat -d
procd_set_param respawn procd_set_param respawn
procd_close_instance procd_close_instance
} }
@ -83,24 +77,24 @@ restart() {
} }
``` ```
* 运行 `chmod +x /etc/init.d/nezha-service` 赋予执行权限 * Give it permission to execute: `chmod +x /etc/init.d/nezha-service`
* 启动服务: `/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start` * Start the service `/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start`
<br/> <br/>
<br/>
## 自定义Agent监控项目
---
#### 自定义监控的网卡和硬盘分区
* 执行 `/opt/nezha/agent/nezha-agent --edit-agent-config` 来选择自定义的网卡和分区,然后重启 Agent 即可生效 ## Customize Agent
#### 其他运行参数 #### Customize the NIC and hard drive partitions to be monitored
通过执行 `./nezha-agent --help` 查看支持的参数如果你使用了一键脚本安装Agent可以编辑 `/etc/systemd/system/nezha-agent.service`,在 `ExecStart=` 这一行的末尾加上以下参数 * Run `/opt/nezha/agent/nezha-agent --edit-agent-config` to select a custom NIC and partition, and then restart Agent
- `--report-delay` 控制系统信息上报的间隔,默认为 1 秒,可以设置为 3 来进一步降低 agent 端系统资源占用(配置区间 1-4 #### Other Flags
- `--skip-conn` 不监控连接数,推荐 机场/连接密集型服务器或CPU占用较高的服务器设置
- `--skip-procs` 不监控进程数,也可以降低 agent 占用 Run `./nezha-agent --help` to view supported flagsif you are already using the one-click script, you can edit `/etc/systemd/system/nezha-agent.service`at the end of this line `ExecStart=` add:
- `--disable-auto-update` 禁止 **自动更新** Agent安全特性
- `--disable-force-update` 禁止 **强制更新** Agent安全特性 - `--report-delay` System information reporting interval, default is 1 second, can be set to 3 to reduce the system resource usage on the agent side (configuration range 1-4)
- `--disable-command-execute` 禁止在 Agent 上执行定时任务、打开在线终端(安全特性) - `--skip-conn` Not monitoring the number of connections, if it is a server with a large number of connections, the CPU usage will be high. It is recommended to set this to reduce CPU usage
- `--tls` 启用 SSL/TLS 加密(使用 nginx 反向代理 Agent 的 grpc 连接,并且 nginx 开启 SSL/TLS 时,需要启用该项配置) - `--skip-procs` Disable monitoring the number of processes can also reduce CPU and memory usage
- `--disable-auto-update` Disable **Automatic Update** Agent (security feature)
- `--disable-force-update` Disable **Forced Update** Agent (security feature)
- `--disable-command-execute` Disable execution of scheduled tasks, disallow open online terminals on the Agent side (security feature)
- `--tls` Enable SSL/TLS encryption (If you are using nginx to reverse proxy Agent´s grpc connections, and if nginx has SSL/TLS enabled, you need to enable this configuration)

View File

@ -1,65 +1,57 @@
### Preparations ## Preparations
---- To setup a Nezha monitorning Dashboard, you need these things:
搭建一个哪吒监控,你需要: 1. A VPS that can connect to the Internet, firewall and security policies need to open ports 8008 and 5555, otherwise it will be inaccessible and unable to receive data. A 1 core 512MB RAM server is sufficient for most usage scenarios
1. 一台可以连接公网的VPS防火墙和安全策略需要放行8008和5555端口否则会无法访问和无法接收数据。单核512MB内存的服务器配置就足以满足大多数使用场景 2. A domain name that has been set up with an A record that resolves to the Dashboard server IP
2. 一个已经设置好A记录指向Dashboard服务器ip的域名
::: tip ::: tip
如果你想使用CDN请准备两个域名一个配置好CDN用作公开访问CDN需要支持WebSocket协议另一个域名不要使用CDN用作Agent端与Dashboard的通信 If you want to use CDN, please prepare two domains, one connect to CDN for public access, CDN needs to support WebSocket protocol; the other domain should not connect to CDN, use it as Agent to send data to Dashboard.
本文档分别以 "cdn.example.com" 和 "data.example.com" 两个域名来演示 This document uses "cdn.example.com" and "data.example.com" domains to demonstrate respectively
::: :::
3. 一个Github/Gitee账号 3. A Github account
**本文档将以宝塔面板反代面板的过程作为范例,随着未来版本的变化,部分功能的入口可能会发生改变,本文档仅供参考** **This document will use the aaPanel as an example, with future versions of the changes, some of the features may change, this document is for reference only**
<br/> <br/>
<br/> <br/>
### 获取Github的Client ID和密钥 ## Get the Client ID and Client Secret on Github
---- Nezha Monitor uses a Github account as the login account for the admin panel
哪吒监控接入Github和Gitee作为后台管理员账号 + First we need to create a new authentication application, after logging into Github, open https://github.com/settings/developers and select "OAuth Apps" - "New OAuth App "
+ 首先我们需要新建一个验证应用以Github为例登陆Github后打开 https://github.com/settings/developers 依次选择“OAuth Apps” - “New OAuth App” `Application name` - Fill in as you like
`Application name` - 随意填写 `Homepage URL` - Fill in the panel's access domain name, such as: "http://cdn.example.com"
`Homepage URL` - 填写面板的访问域名,如:"http://cdn.example.com" `Authorization callback URL` - Fill in the callback address, e.g., "http://cdn.example.com/oauth2/callback"
`Authorization callback URL` - 填写回调地址,如:"http://cdn.example.com/oauth2/callback" + Click on "Registration Application"
+ 点击“Register application” + Remember the Client ID in the page, then click "Generate a new client secret" to create a new Client Secret, the new secret will be displayed only once, please save it properly
+ 保存页面中的Client ID然后点击 “Generate a new client secret“创建一个新的Client Secret新建的密钥仅会显示一次请妥善保存
<br/> <br/>
<br/> <br/>
### 在服务器中安装Dashboard ## Installing Dashboard on the server
--- * In the panel server, run the installation script:
* 在面板服务器中,运行安装脚本:
```bash ```bash
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://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
``` ```
如果你的面板服务器位于中国大陆,可以使用镜像:
````bash
curl -L https://fastly.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
````
* 等待Docker安装完毕后分别输入以下值 * After waiting for the Docker installation to complete, input the following settings:
`OAuth提供商` - Github或Gitee `OAuth2 provider` - Github
`Client ID` - 之前保存的Client ID `Client ID` - Previously saved Client ID
`Client Secret` - 之前保存的密钥 `Client Secret` - Previously saved secret
`用户名` - Github或Gitee的用户名 `GitHub/Gitee login name` - Github username
`站点标题` - 自定义站点标题 `Site title` - Custom site title
`访问端口` - 公开访问端口,可自定义,默认8008 `Site access port` - Public access port, customizable, default 8008
`Agent的通信端口` - Agent与Dashboard的通信端口默认5555 `RPC port` - The communication port between Agent and Dashboard, default 5555
* 输入完成后,等待拉取镜像 * After the input is complete, wait to pull the mirror
安装结束后,如果一切正常,此时你可以访问域名+端口号,如 “http://cdn.example.com:8008” 来查看面板 After the installation, if everything is fine, you can visit the domain + port number, such as "http://cdn.example.com:8008" to view the Dashboard
* 将来如果需要再次运行脚本,可以运行: * In the future, if you need to run the script again, you can run:
```bash ```bash
./nezha.sh ./nezha.sh
``` ```
来打开管理脚本 to open the management script
<br/> <br/>
<br/> <br/>
### 配置反向代理 ## Configure reverse proxy
--- * Create a new site in the aaPanel, fill in the public access domain name, such as "http://cdn.example.com", then click "Settings" to enter the site settings option, select " Reverse proxy" - "New reverse proxy"
* 在宝塔面板中新建一个站点,域名填写公开访问域名,如 “http://cdn.example.com“ ,然后点击“设置”进入站点设置选项,选择“反向代理” - “新建反向代理”
* 自定义一个代理名称在下方“目标URL”中填入 `http://127.0.0.1` 然后点击“保存” * Customize a proxy name, fill in `http://127.0.0.1` in the "Target URL" and click "Save"
* 打开刚刚新建的反向代理右边的“配置文件”,将配置文件替换为以下内容: * Open the " configuration" to the right of the new reverse proxy you just created and replace the configuration file with the following:
````nginx ````nginx
#PROXY-START/ #PROXY-START/
location / { location / {
@ -76,13 +68,13 @@ location ~ ^/(ws|terminal/.+)$ {
} }
#PROXY-END/ #PROXY-END/
```` ````
* 点击“保存” * Click "Save"
现在你应该可以直接使用域名“http://cdn.example.com“ 来访问面板了 Now, you should be able to access the panel directly using a domain name such as: "http://cdn.example.com"
<br/> <br/>
#### 扩展内容: #### Other:
* CaddyServer v1v2 无需特别配置) * CaddyServer v1v2 no special configuration required
``` ```
proxy /ws http://ip:8008 { proxy /ws http://ip:8008 {
@ -96,8 +88,7 @@ location ~ ^/(ws|terminal/.+)$ {
<br/> <br/>
<br/> <br/>
### 在宝塔面板中配置SSL ## Configuring SSL in the aaPanel
--- First, temporarily disable the reverse proxy
首先,先暂时关闭反向代理 As with other websites, you can choose to automatically apply for a Let´s Encrypt certificate or manually configure an existing certificate by going to "SSL" in the site settings
正如在其他网站中配置SSL证书一样进入站点设置中的“SSL”你可以选择自动申请 Let´s Encrypt 证书或手动配置已有的证书 After you finish setting up SSL, you need to go back to https://github.com/settings/developers and edit the authentication application you created before, change all the domain names in the "Homepage URL" and "Authorization callback URL" you filled in before from `http` to `https`, such as: "https://cdn.example.com" and "https://cdn.example.com/oauth2/callback", **If you don't change these links, you may not be able to log into the admin panel**
完成SSL的设置后你需要回到 https://github.com/settings/developers ,编辑之前创建的验证应用程序,将之前我们填入的"Homepage URL"和"Authorization callback URL"中的域名全部从`http`改为`https`,如:"https://cdn.example.com" 和 "https://cdn.example.com/oauth2/callback" **不更改此项可能会导致你无法登陆面板后台**

View File

@ -2,7 +2,7 @@
<br/> <br/>
## 一键安装Agent ## 一键安装Agent
目前哪吒监控已支持在WIndows和Linux上一键安装Agent遵循本文档的步骤你可以很轻松的在服务器上部署它 目前哪吒监控已支持在Windows和Linux上一键安装Agent遵循本文档的步骤你可以很轻松的在服务器上部署它
<br/> <br/>
### 准备工作 ### 准备工作