优化:中英文Agent安装文档、新增:常见问题-如何自定义Agent监控项目

This commit is contained in:
“hhhkkk520” 2022-08-02 14:59:17 +02:00
parent 40ebc9a52d
commit 41d717b038
5 changed files with 67 additions and 64 deletions

View File

@ -106,7 +106,8 @@ function getGuideSidebarZhCN() {
{ text: '如何反向代理 gRPC 端口', link: '/guide/q3' },
{ text: '实时通道断开/在线终端连接失败', link: '/guide/q4' },
{ text: '如何进行数据迁移、备份恢复?', link: '/guide/q5' },
{ text: '如何每月重置流量统计?', link: '/guide/q6' }
{ text: '如何每月重置流量统计?', link: '/guide/q6' },
{ text: '如何自定义 Agent 监控项目?', link: '/guide/q7' }
]
},
{
@ -173,7 +174,8 @@ function getGuideSidebarEnUS() {
{ text: 'Reverse Proxy gRPC Port (support Cloudflare CDN)', link: '/en_US/guide/q3' },
{ text: 'Real-time channel disconnection/online terminal connection failure', link: '/en_US/guide/q4' },
{ text: 'How do I migrate my data to the new server and restore my backups?', link: '/en_US/guide/q5' },
{ text: 'How to set up a monthly reset of data statistics?', link: '/en_US/guide/q6' }
{ text: 'How to set up a monthly reset of data statistics?', link: '/en_US/guide/q6' },
{ text: 'How to customize Agent monitoring?', link: '/en_US/guide/q7' }
]
},
{

View File

@ -8,7 +8,7 @@ First of all, you need to set up the communication domain name in the settings p
Enter the administration panel, go to the "Settings" page, in the item "CDN Bypassed Domain/IP
", fill in the communication domain name, and then click "Save"
<br/>
### One-click installation on Linux
### One-click installation on Linux (Ubuntu, Debian, CentOS)
* 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
* 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.
@ -24,7 +24,7 @@ Enter the administration panel, go to the "Settings" page, in the item "CDN Bypa
## Other ways to install Agent
<br/>
### Installing Agent on Linux
### Installing Agent on Linux (Ubuntu, Debian, CentOS)
* First add a server in the admin panel
* In the monitored server, run the script:
```bash
@ -41,16 +41,17 @@ curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.s
* Wait for the installation to complete and return to the Dashboard home page to see if the server is online
<br/>
### Installing Agent on other Linux (such as alpine use oprec not systemd)
### Installing Agent on other Linux (such as alpine use oprec not systemd)
Contributed by [unknown0054](https://github.com/unknwon0054)
* edit SERVER,SECRET,TLS then run in shell
* Edit SERVER,SECRET,TLS then run it in Shell
```shell
cat >/etc/init.d/nezha-agent<< EOF
#!/sbin/openrc-run
SERVER="" #dashboard address ip:port
SERVER="" #Dashboard address ip:port
SECRET="" #SECRET
TLS="" # enable tls? yes:"--tls" no:""
TLS="" # Enable tls? yes:"--tls" no:""
NZ_BASE_PATH="/opt/nezha"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
pidfile="/run/${RC_SVCNAME}.pid"
@ -84,14 +85,14 @@ checkconfig() {
version=$(curl -m 10 -sL "https://gcore.jsdelivr.net/gh/naiba/nezha/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/naiba\/nezha@/v/g')
fi
if [ ! -n "$version" ]; then
echo -e "version get to failed, please check if the network can link https://api.github.com/repos/naiba/nezha/releases/latest"
echo -e "Failed to get the version number, please check if the network can connect to https://api.github.com/repos/naiba/nezha/releases/latest"
return 0
else
echo -e "The current latest version is: ${version}"
fi
wget -t 2 -T 10 -O nezha-agent_linux_${os_arch}.zip https://${GITHUB_URL}/naiba/nezha/releases/download/${version}/nezha-agent_linux_${os_arch}.zip >/dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "Release download failed, please check if the network can link ${GITHUB_URL}${plain}"
echo -e "Release download failed, please check if the network can connect to ${GITHUB_URL}${plain}"
return 0
fi
mkdir -p $NZ_AGENT_PATH
@ -110,19 +111,19 @@ start_pre() {
EOF
```
* add execute permission
* Add execute permission
```shell
chmod +x /etc/init.d/nezha-agent
```
* run nezha-agent
* Run Nezha-Agent
```shell
rc-service nezha-agent-hy start
```
* auto start on boot
* Set self-start after boot
```shell
rc-update add nezha-agent
@ -229,24 +230,6 @@ restart() {
* Start the service `/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start`
<br/>
## Customize Agent
#### Customize the NIC and hard drive partitions to be monitored
* Run `/opt/nezha/agent/nezha-agent --edit-agent-config` to select a custom NIC and partition, and then restart Agent
#### Other Flags
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:
- `--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)
- `--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
- `--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 WebShell (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)
## FAQ
### Is there a Docker image for Agent?
**There is currently no Docker image for Agent.**

17
docs/en_US/guide/q7.md Normal file
View File

@ -0,0 +1,17 @@
## Customize Agent
#### Customize the NIC and hard drive partitions to be monitored
* Run `/opt/nezha/agent/nezha-agent --edit-agent-config` to select a custom NIC and partition, and then restart Agent
#### Other Flags
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:
- `--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)
- `--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
- `--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 WebShell (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,6 +1,6 @@
**哪吒监控的被控端服务被称为Agent本文档将介绍如何在被控端服务器上安装Agent并与Dashboard连接**
**哪吒监控的被控端服务被称为 Agent本文档将介绍如何在被控端服务器上安装 Agent并与 Dashboard 连接**
<br/>
## 一键安装Agent
## 一键安装 Agent
目前哪吒监控已支持在Windows和Linux上一键安装Agent遵循本文档的步骤你可以很轻松的在服务器上部署它
<br/>
@ -9,25 +9,25 @@
你需要提前在管理面板中设置好通信域名此域名不可以接入CDN这里以前面提到过的示例通信域名 “data.example.com” 来做演示
进入后台管理面板转到“设置”页在“未接入CDN的面板服务器域名/IP”项中填入通信域名然后点击"保存"
<br/>
### 在 Linux 中一键安装
### 在 Linux 中一键安装 (Ubuntu、Debian、CentOS)
* 首先在管理面板中添加一台服务器
* 点击新添加的服务器旁绿色的Linux图标按钮复制一键安装命令
* 在被控端服务器中运行复制的一键安装命令等待安装完成后返回到Dashboard主页查看服务器是否上线
* 点击新添加的服务器旁,绿色的 Linux 图标按钮,复制一键安装命令
* 在被控端服务器中运行复制的一键安装命令,等待安装完成后返回到 Dashboard 主页查看服务器是否上线
<br/>
### 在 Windows 中一键安装
* 首先在管理面板中添加一台服务器
* 点击新添加的服务器旁绿色的Windows图标按钮复制一键安装命令
* 进入Windows服务器运行PowerShell在PowerShell中运行复制的安装命令
* 点击新添加的服务器旁,绿色的 Windows 图标按钮,复制一键安装命令
* 进入 Windows 服务器,运行 PowerShell PowerShell 中运行复制的安装命令
* 如遇到确认「执行策略变更」请选择 Y
* 等待安装完成后返回Dashboard主页查看服务器是否上线
* 等待安装完成后返回 Dashboard 主页查看服务器是否上线
<br/>
<br/>
## 其他方式安装Agent
## 其他方式安装 Agent
### 在 Linux 中安装Agent
### 在 Linux 中安装Agent (Ubuntu、Debian、CentOS)
* 首先在管理面板中添加一台服务器
* 在被控服务器中,运行脚本(位于中国大陆的服务器请使用镜像):
@ -41,18 +41,19 @@ curl -L https://jihulab.com/nezha/nezha/-/raw/master/script/install.sh -o nezha.
* 选择“安装监控Agent”
* 输入通信域名”data.example.com“
* 输入面板通信端口RPC端口默认为5555
* 输入Agent密钥Agent密钥在管理面板中添加服务器时生成可以在管理面板中的“主机”页中找到
* 等待安装完成后返回Dashboard主页查看服务器是否上线
* 输入 Agent 密钥Agent 密钥在管理面板中添加服务器时生成,可以在管理面板中的“主机”页中找到
* 等待安装完成后返回 Dashboard 主页查看服务器是否上线
<br/>
### 在 其他Linux 如 alpine 使用 openrc 的发行版 安装 Agent
### 在 其他 Linux 如 Alpine 使用 Openrc 的发行版 安装 Agent
本节内容由 [unknown0054](https://github.com/unknwon0054) 贡献
* 修改 SERVER、SECRET、TLS 然后在 shell 中 执行
* 修改 SERVER、SECRET、TLS 然后在 shell 中执行
```shell
cat >/etc/init.d/nezha-agent<< EOF
#!/sbin/openrc-run
SERVER="" #dashboard 地址 ip:port
SERVER="" #Dashboard 地址 ip:port
SECRET="" #SECRET
TLS="" # 是否启用 tls 是 "--tls" 否留空
NZ_BASE_PATH="/opt/nezha"
@ -120,7 +121,7 @@ EOF
chmod +x /etc/init.d/nezha-agent
```
* 运行 nezha-agent
* 运行 Nezha-Agent
```shell
rc-service nezha-agent-hy start
@ -235,23 +236,6 @@ restart() {
* 启动服务: `/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start`
<br/>
<br/>
## 自定义Agent监控项目
#### 自定义监控的网卡和硬盘分区
* 执行 `/opt/nezha/agent/nezha-agent --edit-agent-config` 来选择自定义的网卡和分区,然后重启 Agent 即可生效
#### 其他运行参数
通过执行 `./nezha-agent --help` 查看支持的参数如果你使用了一键脚本安装Agent可以编辑 `/etc/systemd/system/nezha-agent.service`,在 `ExecStart=` 这一行的末尾加上以下参数
- `--report-delay` 控制系统信息上报的间隔,默认为 1 秒,可以设置为 3 来进一步降低 agent 端系统资源占用(配置区间 1-4
- `--skip-conn` 不监控连接数,推荐 机场/连接密集型服务器或CPU占用较高的服务器设置
- `--skip-procs` 不监控进程数,也可以降低 agent 占用
- `--disable-auto-update` 禁止 **自动更新** Agent安全特性
- `--disable-force-update` 禁止 **强制更新** Agent安全特性
- `--disable-command-execute` 禁止在 Agent 上执行定时任务、打开在线终端(安全特性)
- `--tls` 启用 SSL/TLS 加密(使用 nginx 反向代理 Agent 的 grpc 连接,并且 nginx 开启 SSL/TLS 时,需要启用该项配置)
## FAQ
### Agent 有 Docker 镜像吗?

17
docs/guide/q7.md Normal file
View File

@ -0,0 +1,17 @@
## 自定义 Agent 监控项目
#### 自定义监控的网卡和硬盘分区
* 执行 `/opt/nezha/agent/nezha-agent --edit-agent-config` 来选择自定义的网卡和分区,然后重启 Agent 即可生效
#### 其他运行参数
通过执行 `./nezha-agent --help` 查看支持的参数如果你使用了一键脚本安装Agent可以编辑 `/etc/systemd/system/nezha-agent.service`,在 `ExecStart=` 这一行的末尾加上以下参数
- `--report-delay` 控制系统信息上报的间隔,默认为 1 秒,可以设置为 3 来进一步降低 agent 端系统资源占用(配置区间 1-4
- `--skip-conn` 不监控连接数,推荐 机场/连接密集型 服务器或CPU占用较高的服务器设置
- `--skip-procs` 不监控进程数,也可以降低 Agent 占用
- `--disable-auto-update` 禁止 **自动更新** Agent安全特性
- `--disable-force-update` 禁止 **强制更新** Agent安全特性
- `--disable-command-execute` 禁止在 Agent 上执行定时任务、打开在线终端(安全特性)
- `--tls` 启用 SSL/TLS 加密(使用 nginx 反向代理 Agent 的 grpc 连接,并且 nginx 开启 SSL/TLS 时,需要启用该项配置)