24 lines
9.6 KiB
JavaScript
24 lines
9.6 KiB
JavaScript
import{_ as e,c as n,o as t,d as a}from"./app.2c402e15.js";const m='{"title":"Install Agent using one-click script","description":"","frontmatter":{},"headers":[{"level":2,"title":"Install Agent using one-click script","slug":"install-agent-using-one-click-script"},{"level":3,"title":"Preparation","slug":"preparation"},{"level":3,"title":"One-click installation on Linux","slug":"one-click-installation-on-linux"},{"level":3,"title":"One-click installation on Windows","slug":"one-click-installation-on-windows"},{"level":2,"title":"Other ways to install Agent","slug":"other-ways-to-install-agent"},{"level":3,"title":"Installing Agent on Linux","slug":"installing-agent-on-linux"},{"level":3,"title":"Installing Agent on Windows","slug":"installing-agent-on-windows"},{"level":3,"title":"Installing Agent on OpenWRT","slug":"installing-agent-on-openwrt"},{"level":2,"title":"Customize Agent","slug":"customize-agent"}],"relativePath":"en_US/guide/agent.md"}',i={},o=a(`<p><strong>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</strong><br><br></p><h2 id="install-agent-using-one-click-script" tabindex="-1">Install Agent using one-click script <a class="header-anchor" href="#install-agent-using-one-click-script" aria-hidden="true">#</a></h2><p>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></p><h3 id="preparation" tabindex="-1">Preparation <a class="header-anchor" href="#preparation" aria-hidden="true">#</a></h3><p>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 "<a href="http://data.example.com" target="_blank" rel="noopener noreferrer">data.example.com</a>" mentioned earlier for demonstration<br> 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><br></p><h3 id="one-click-installation-on-linux" tabindex="-1">One-click installation on Linux <a class="header-anchor" href="#one-click-installation-on-linux" aria-hidden="true">#</a></h3><ul><li>First add a server in the admin panel</li><li>Click on the green Linux icon button next to the newly added server and copy the one-click installation command</li><li>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.<br><br></li></ul><h3 id="one-click-installation-on-windows" tabindex="-1">One-click installation on Windows <a class="header-anchor" href="#one-click-installation-on-windows" aria-hidden="true">#</a></h3><ul><li>First add a server in the admin panel</li><li>Click on the green Linux icon button next to the newly added server and copy the one-click installation command</li><li>Login to Windows Server, open PowerShell, and run the copied installation command in PowerShell</li><li>If you encounter the prompt "Implement Policy Change" please select Y</li><li>Wait for the installation to complete and return to the Dashboard home page to see if the server is online<br><br><br><br></li></ul><h2 id="other-ways-to-install-agent" tabindex="-1">Other ways to install Agent <a class="header-anchor" href="#other-ways-to-install-agent" aria-hidden="true">#</a></h2><br><h3 id="installing-agent-on-linux" tabindex="-1">Installing Agent on Linux <a class="header-anchor" href="#installing-agent-on-linux" aria-hidden="true">#</a></h3><ul><li>First add a server in the admin panel</li><li>In the monitored server, run the script:</li></ul><div class="language-bash"><pre><code><span class="token function">curl</span> -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh <span class="token operator">&&</span> <span class="token function">chmod</span> +x nezha.sh <span class="token operator">&&</span> <span class="token function">sudo</span> ./nezha.sh
|
|
</code></pre></div><ul><li>Select \u201CInstall_agent\u201D</li><li>Input the communication domain name, e.g. "<a href="http://data.example.com" target="_blank" rel="noopener noreferrer">data.example.com</a>"</li><li>Input RPC port, default is 5555</li><li>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</li><li>Wait for the installation to complete and return to the Dashboard home page to see if the server is online<br><br></li></ul><h3 id="installing-agent-on-windows" tabindex="-1">Installing Agent on Windows <a class="header-anchor" href="#installing-agent-on-windows" aria-hidden="true">#</a></h3><ul><li>Please refer to the community article: <a href="https://nyko.me/2020/12/13/nezha-windows-client.html" target="_blank" rel="noopener noreferrer">\u54EA\u5412\u63A2\u9488 - Windows \u5BA2\u6237\u7AEF\u5B89\u88C5</a>(Chinese)<br><br></li></ul><h3 id="installing-agent-on-openwrt" tabindex="-1">Installing Agent on OpenWRT <a class="header-anchor" href="#installing-agent-on-openwrt" aria-hidden="true">#</a></h3><p><strong>How to make the old version of OpenWRT/LEDE self-boot?</strong></p><ul><li>Please refer to the project:<br><a href="https://github.com/Erope/openwrt_nezha" target="_blank" rel="noopener noreferrer">\u54EA\u5412\u76D1\u63A7 For OpenWRT</a> (Chinese) <br></li></ul><p><strong>How to make the new version of OpenWRT self-boot? By @\u827E\u65AF\u5FB7\u65AF</strong></p><ul><li>First download the corresponding binary from the release, unzip the zip package and place it in <code>/root</code></li><li>Then run <code>chmod +x /root/nezha-agent</code> to give it execute access, create file <code>/etc/init.d/nezha-service</code>\uFF1A</li></ul><div class="language-shell"><pre><code><span class="token shebang important">#!/bin/sh /etc/rc.common</span>
|
|
|
|
<span class="token assign-left variable">START</span><span class="token operator">=</span><span class="token number">99</span>
|
|
<span class="token assign-left variable">USE_PROCD</span><span class="token operator">=</span><span class="token number">1</span>
|
|
|
|
<span class="token function-name function">start_service</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
|
procd_open_instance
|
|
procd_set_param <span class="token builtin class-name">command</span> /root/nezha-agent -s data.example.com:5555 -p secreat -d
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
<span class="token punctuation">}</span>
|
|
|
|
<span class="token function-name function">stop_service</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
|
<span class="token function">killall</span> nezha-agent
|
|
<span class="token punctuation">}</span>
|
|
|
|
<span class="token function-name function">restart</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
|
stop
|
|
<span class="token function">sleep</span> <span class="token number">2</span>
|
|
start
|
|
<span class="token punctuation">}</span>
|
|
</code></pre></div><ul><li>Give it permission to execute: <code>chmod +x /etc/init.d/nezha-service</code></li><li>Start the service <code>/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start</code><br><br></li></ul><h2 id="customize-agent" tabindex="-1">Customize Agent <a class="header-anchor" href="#customize-agent" aria-hidden="true">#</a></h2><h4 id="customize-the-nic-and-hard-drive-partitions-to-be-monitored" tabindex="-1">Customize the NIC and hard drive partitions to be monitored <a class="header-anchor" href="#customize-the-nic-and-hard-drive-partitions-to-be-monitored" aria-hidden="true">#</a></h4><ul><li>Run <code>/opt/nezha/agent/nezha-agent --edit-agent-config</code> to select a custom NIC and partition, and then restart Agent</li></ul><h4 id="other-flags" tabindex="-1">Other Flags <a class="header-anchor" href="#other-flags" aria-hidden="true">#</a></h4><p>Run <code>./nezha-agent --help</code> to view supported flags\uFF0Cif you are already using the one-click script, you can edit <code>/etc/systemd/system/nezha-agent.service</code>\uFF0Cat the end of this line <code>ExecStart=</code> add:</p><ul><li><code>--report-delay</code> 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)</li><li><code>--skip-conn</code> 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</li><li><code>--skip-procs</code> Disable monitoring the number of processes can also reduce CPU and memory usage</li><li><code>--disable-auto-update</code> Disable <strong>Automatic Update</strong> Agent (security feature)</li><li><code>--disable-force-update</code> Disable <strong>Forced Update</strong> Agent (security feature)</li><li><code>--disable-command-execute</code> Disable execution of scheduled tasks, disallow open online terminals on the Agent side (security feature)</li><li><code>--tls</code> Enable SSL/TLS encryption (If you are using nginx to reverse proxy Agent\xB4s grpc connections, and if nginx has SSL/TLS enabled, you need to enable this configuration)</li></ul>`,30),s=[o];function l(r,c,d,p,h,u){return t(),n("div",null,s)}var f=e(i,[["render",l]]);export{m as __pageData,f as default};
|