nezhahq.github.io/assets/guide_q7.md.D9qxsgnw.js

2 lines
5.7 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,c as a,o as s,a4 as i}from"./chunks/framework.BmdFiWrL.js";const u=JSON.parse('{"title":"自定义 Agent 监控项目","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"guide/q7.md","filePath":"guide/q7.md","lastUpdated":1728186808000}'),t={name:"guide/q7.md"},d=i('<h1 id="自定义-agent-监控项目" tabindex="-1">自定义 Agent 监控项目 <a class="header-anchor" href="#自定义-agent-监控项目" aria-label="Permalink to &quot;自定义 Agent 监控项目&quot;"></a></h1><h2 id="自定义监控的网卡和硬盘分区" tabindex="-1">自定义监控的网卡和硬盘分区 <a class="header-anchor" href="#自定义监控的网卡和硬盘分区" aria-label="Permalink to &quot;自定义监控的网卡和硬盘分区&quot;"></a></h2><p>执行以下命令来选择网卡和分区,然后重启 Agent 即可生效:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">/opt/nezha/agent/nezha-agent</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> edit</span></span></code></pre></div><h2 id="其他运行参数" tabindex="-1">其他运行参数 <a class="header-anchor" href="#其他运行参数" aria-label="Permalink to &quot;其他运行参数&quot;"></a></h2><h3 id="查看支持的参数" tabindex="-1">查看支持的参数 <a class="header-anchor" href="#查看支持的参数" aria-label="Permalink to &quot;查看支持的参数&quot;"></a></h3><p>要查看支持的运行参数,请执行以下命令:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./nezha-agent</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --help</span></span></code></pre></div><h3 id="配置参数" tabindex="-1">配置参数 <a class="header-anchor" href="#配置参数" aria-label="Permalink to &quot;配置参数&quot;"></a></h3><p>如果您通过一键脚本安装了 Agent可以通过编辑系统服务配置来添加或修改参数。编辑文件 <code>/etc/systemd/system/nezha-agent.service</code>,并在 <code>ExecStart=</code> 行的末尾添加您需要的参数:</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>如果您需要批量添加参数,可以利用 Dashboard 的计划任务功能。以禁用 Agent 自动更新功能为例,您可以设置一个计划任务。添加以下命令以修改系统服务配置,并触发该任务执行:</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sed</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -i</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &#39;/^ExecStart=/ s/$/ --disable-auto-update/&#39;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /etc/systemd/system/nezha-agent.service</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> &amp;&amp; </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">systemctl</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> daemon-reload</span></span></code></pre></div></div><ul><li><code>--report-delay</code>:设置系统信息上报的间隔时间。默认为 1 秒。为了降低系统资源占用,可以设置为 3有效范围1-4 秒)。</li><li><code>--skip-conn</code>:不监控网络连接数。建议在连接数较多或 CPU 资源占用较高的服务器上使用此参数。</li><li><code>--skip-procs</code>:不监控进程数,有助于降低 Agent 的资源占用。</li><li><code>--disable-auto-update</code>:禁用 Agent 的<strong>自动更新</strong>功能,增强安全性。</li><li><code>--disable-force-update</code>:禁用 Agent 的<strong>强制更新</strong>功能,增强安全性。</li><li><code>--disable-command-execute</code>:禁止在 Agent 上执行任何定时任务或使用在线终端,增强安全性。</li><li><code>--tls</code>:启用 SSL/TLS 加密。当您使用 nginx 反向代理 Agent 的 gRPC 连接且 nginx 配置了 SSL/TLS 时,应启用此配置。</li><li><code>--use-ipv6-countrycode</code>:强制使用 IPv6 地址查询国家代码。默认情况下Agent 使用 IPv4 地址查询国家代码,如果服务器支持 IPv6 且与 IPv4 地址的国家代码不同,可以使用此参数。</li><li><code>--gpu</code>:启用 GPU 监控。注意GPU 使用率监控可能需要安装额外的依赖包,详细信息可以参考文档:<a href="/guide/q9.html">启用 GPU 监控</a>。</li><li><code>--temperature</code>:启用硬件温度监控。仅支持的硬件有效,部分 VPS 可能无法获取温度信息。</li><li><code>-d</code> <code>--debug</code>:启用调试模式。</li><li><code>-u</code> <code>--ip-report-period</code>本地IP更新间隔, 如果这个值小于 <code>--report-delay</code> 设置的值,那么以 <code>--report-delay</code> 的值为准。默认为1800秒30分钟。</li><li><code>-k</code> <code>--insecure</code>:禁用证书检查,适用于使用自签证书的场景。</li></ul>',12),o=[d];function l(n,c,h,p,r,g){return s(),a("div",null,o)}const b=e(t,[["render",l]]);export{u as __pageData,b as default};