This commit is contained in:
naiba committed 2022-08-02 08:15:36 +00:00
1 parent 8fc155de20
commit 15ceb06aac
158 files changed
+568 -308

No files matched your search

+69 -4
View File
@@ -8,14 +8,79 @@
<link rel="stylesheet" href="/assets/style.0b9f658b.css">
<link rel="modulepreload" href="/assets/chunks/AlgoliaSearchBox.2b248d1a.js">
<link rel="modulepreload" href="/assets/app.4f7c959e.js">
<link rel="modulepreload" href="/assets/en_US_guide_agent.md.f3a0c1a0.lean.js">
<link rel="modulepreload" href="/assets/en_US_guide_agent.md.8a0d8548.lean.js">
<meta name="twitter:title" content="Install Agent using one-click script | Nezha Monitoring">
<meta property="og:title" content="Install Agent using one-click script | Nezha Monitoring">
</head>
<body>
<div id="app"><!--[--><div class="theme"><header class="nav-bar" data-v-675d8756><div class="sidebar-button" data-v-675d8756><svg class="icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z" class></path></svg></div><a class="nav-bar-title" href="/en_US/" aria-label="Nezha Monitoring, back to home" data-v-675d8756 data-v-cc01ef16><!----> Nezha Monitoring</a><div class="flex-grow" data-v-675d8756></div><div class="nav" data-v-675d8756><nav class="nav-links" data-v-675d8756 data-v-eab3edfe><!--[--><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item active" href="/en_US/" data-v-b8818f8c>User Guide <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/case/index" data-v-b8818f8c>Community Projects <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/developer/index" data-v-b8818f8c>Development Manual <!----></a></div></div><!--]--><div class="item" data-v-eab3edfe><div class="nav-dropdown-link" data-v-eab3edfe data-v-56bf3a3f><button class="button" data-v-56bf3a3f><span class="button-text" data-v-56bf3a3f>Languages</span><span class="right button-arrow" data-v-56bf3a3f></span></button><ul class="dialog" data-v-56bf3a3f><!--[--><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item" href="/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>简体中文</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item active" href="/en_US/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>English</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><!--]--></ul></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item isExternal" href="https://github.com/nezhahq/nezhahq.github.io" target="_blank" rel="noopener noreferrer" data-v-b8818f8c>GitHub <svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15" data-v-b8818f8c><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></div></nav></div><!--[--><!--[--><div class="algolia-search-box" id="docsearch"></div><!--]--><!--]--></header><aside class="sidebar" data-v-83e92a68><nav class="nav-links nav" data-v-83e92a68 data-v-eab3edfe><!--[--><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item active" href="/en_US/" data-v-b8818f8c>User Guide <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/case/index" data-v-b8818f8c>Community Projects <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/developer/index" data-v-b8818f8c>Development Manual <!----></a></div></div><!--]--><div class="item" data-v-eab3edfe><div class="nav-dropdown-link" data-v-eab3edfe data-v-56bf3a3f><button class="button" data-v-56bf3a3f><span class="button-text" data-v-56bf3a3f>Languages</span><span class="right button-arrow" data-v-56bf3a3f></span></button><ul class="dialog" data-v-56bf3a3f><!--[--><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item" href="/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>简体中文</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item active" href="/en_US/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>English</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><!--]--></ul></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eaLine truncated
</code></pre></div><ul><li>Select “Install_agent”</li><li>Input the communication domain name, e.g. &quot;<a href="http://data.example.com" target="_blank" rel="noopener noreferrer">data.example.com</a>&quot;</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 &quot; Servers &quot; 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">哪吒探针 - Windows 客户端安装</a>(Chinese)<br><br></li></ul><h3 id="installing-agent-on-macos" tabindex="-1">Installing Agent on MacOS <a class="header-anchor" href="#installing-agent-on-macos" aria-hidden="true">#</a></h3><p><em><strong>This section is adapted from <a href="https://blog.mitsea.com/e796f93db38d49e4b18df234c6ee75f5" target="_blank" rel="noopener noreferrer">Mitsea Blog</a>, with permission from the original author</strong></em><br><br></p><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>If you are prompted with &quot;macOS cannot verify this app&quot; during installation, please go to system settings to allow the app to run.</p></div><ul><li>First add a server in the admin panel</li><li>Go to the <a href="https://github.com/naiba/nezha/releases" target="_blank" rel="noopener noreferrer">Release</a> page to download the Agent binary and choose whether to download the darwin amd64 or arm64 Agent depending on the CPU architecture<br> For example, download the amd64 version for Intel CPU and the arm64 version for Apple Silicon. After downloading, extract the Agent binary file, e.g. to the Download folder</li><li>Create a new file named <code>nezha_agent.plist</code> and save it, edit the contents of the file:</li></ul><div class="language-xml"><pre><code><span class="token prolog">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<div id="app"><!--[--><div class="theme"><header class="nav-bar" data-v-675d8756><div class="sidebar-button" data-v-675d8756><svg class="icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z" class></path></svg></div><a class="nav-bar-title" href="/en_US/" aria-label="Nezha Monitoring, back to home" data-v-675d8756 data-v-cc01ef16><!----> Nezha Monitoring</a><div class="flex-grow" data-v-675d8756></div><div class="nav" data-v-675d8756><nav class="nav-links" data-v-675d8756 data-v-eab3edfe><!--[--><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item active" href="/en_US/" data-v-b8818f8c>User Guide <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/case/index" data-v-b8818f8c>Community Projects <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/developer/index" data-v-b8818f8c>Development Manual <!----></a></div></div><!--]--><div class="item" data-v-eab3edfe><div class="nav-dropdown-link" data-v-eab3edfe data-v-56bf3a3f><button class="button" data-v-56bf3a3f><span class="button-text" data-v-56bf3a3f>Languages</span><span class="right button-arrow" data-v-56bf3a3f></span></button><ul class="dialog" data-v-56bf3a3f><!--[--><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item" href="/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>简体中文</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item active" href="/en_US/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>English</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><!--]--></ul></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item isExternal" href="https://github.com/nezhahq/nezhahq.github.io" target="_blank" rel="noopener noreferrer" data-v-b8818f8c>GitHub <svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15" data-v-b8818f8c><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></div></nav></div><!--[--><!--[--><div class="algolia-search-box" id="docsearch"></div><!--]--><!--]--></header><aside class="sidebar" data-v-83e92a68><nav class="nav-links nav" data-v-83e92a68 data-v-eab3edfe><!--[--><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item active" href="/en_US/" data-v-b8818f8c>User Guide <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/case/index" data-v-b8818f8c>Community Projects <!----></a></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eab3edfe data-v-b8818f8c><a class="item" href="/en_US/developer/index" data-v-b8818f8c>Development Manual <!----></a></div></div><!--]--><div class="item" data-v-eab3edfe><div class="nav-dropdown-link" data-v-eab3edfe data-v-56bf3a3f><button class="button" data-v-56bf3a3f><span class="button-text" data-v-56bf3a3f>Languages</span><span class="right button-arrow" data-v-56bf3a3f></span></button><ul class="dialog" data-v-56bf3a3f><!--[--><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item" href="/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>简体中文</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><li class="dialog-item" data-v-56bf3a3f><div class="nav-dropdown-link-item" data-v-56bf3a3f data-v-bbc27490><a class="item active" href="/en_US/guide/agent.html" data-v-bbc27490><span class="arrow" data-v-bbc27490></span><span class="text" data-v-bbc27490>English</span><span class="icon" data-v-bbc27490><!----></span></a></div></li><!--]--></ul></div></div><div class="item" data-v-eab3edfe><div class="nav-link" data-v-eaLine truncated
</code></pre></div><ul><li><p>Select “Install_agent”</p></li><li><p>Input the communication domain name, e.g. &quot;<a href="http://data.example.com" target="_blank" rel="noopener noreferrer">data.example.com</a>&quot;</p></li><li><p>Input RPC port, default is 5555</p></li><li><p>Input the Agent Secret, which is generated when adding a server in the administration panel and can be found in the &quot; Servers &quot; page of the administration panel</p></li><li><p>Wait for the installation to complete and return to the Dashboard home page to see if the server is online<br><br></p></li></ul><h3 id="installing-agent-on-other-linux-such-as-alpine-use-oprec-not-systemd" tabindex="-1">Installing Agent on other Linux (such as alpine use oprec not systemd) <a class="header-anchor" href="#installing-agent-on-other-linux-such-as-alpine-use-oprec-not-systemd" aria-hidden="true">#</a></h3><ul><li>edit SERVER,SECRET,TLS then run in shell</li></ul><div class="language-shell"><pre><code><span class="token function">cat</span> <span class="token operator">&gt;</span>/etc/init.d/nezha-agent<span class="token operator">&lt;&lt;</span> <span class="token string">EOF
#!/sbin/openrc-run
SERVER=&quot;&quot; #dashboard address ip:port
SECRET=&quot;&quot; #SECRET
TLS=&quot;&quot; # enable tls? yes:&quot;--tls&quot; no:&quot;&quot;
NZ_BASE_PATH=&quot;/opt/nezha&quot;
NZ_AGENT_PATH=&quot;<span class="token variable">${NZ_BASE_PATH}</span>/agent&quot;
pidfile=&quot;/run/<span class="token variable">${RC_SVCNAME}</span>.pid&quot;
command=&quot;/opt/nezha/agent/nezha-agent&quot;
command_args=&quot;-s <span class="token variable">${SERVER}</span> -p <span class="token variable">${SECRET}</span> <span class="token variable">${TLS}</span>&quot;
command_background=true
depend() {
need net
}
checkconfig() {
GITHUB_URL=&quot;github.com&quot;
if [ ! -f &quot;<span class="token variable">${NZ_AGENT_PATH}</span>/nezha-agent&quot; ]; then
if [[ <span class="token variable"><span class="token variable">$(</span><span class="token function">uname</span> -m <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&#39;x86_64&#39;</span><span class="token variable">)</span></span> != &quot;&quot; ]]; then
os_arch=&quot;amd64&quot;
elif [[ <span class="token variable"><span class="token variable">$(</span><span class="token function">uname</span> -m <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&#39;i386\|i686&#39;</span><span class="token variable">)</span></span> != &quot;&quot; ]]; then
os_arch=&quot;386&quot;
elif [[ <span class="token variable"><span class="token variable">$(</span><span class="token function">uname</span> -m <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&#39;aarch64\|armv8b\|armv8l&#39;</span><span class="token variable">)</span></span> != &quot;&quot; ]]; then
os_arch=&quot;arm64&quot;
elif [[ <span class="token variable"><span class="token variable">$(</span><span class="token function">uname</span> -m <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&#39;arm&#39;</span><span class="token variable">)</span></span> != &quot;&quot; ]]; then
os_arch=&quot;arm&quot;
elif [[ <span class="token variable"><span class="token variable">$(</span><span class="token function">uname</span> -m <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&#39;s390x&#39;</span><span class="token variable">)</span></span> != &quot;&quot; ]]; then
os_arch=&quot;s390x&quot;
elif [[ <span class="token variable"><span class="token variable">$(</span><span class="token function">uname</span> -m <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&#39;riscv64&#39;</span><span class="token variable">)</span></span> != &quot;&quot; ]]; then
os_arch=&quot;riscv64&quot;
fi
local version=<span class="token variable"><span class="token variable">$(</span><span class="token function">curl</span> -m <span class="token number">10</span> -sL <span class="token string">&quot;https://api.github.com/repos/naiba/nezha/releases/latest&quot;</span> <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&quot;tag_name&quot;</span> <span class="token operator">|</span> <span class="token function">head</span> -n <span class="token number">1</span> <span class="token operator">|</span> <span class="token function">awk</span> -F <span class="token string">&quot;:&quot;</span> <span class="token string">&#39;{print $2}&#39;</span> <span class="token operator">|</span> <span class="token function">sed</span> <span class="token string">&#39;s/\&quot;//g;s/,//g;s/ //g&#39;</span><span class="token variable">)</span></span>
if [ ! -n &quot;<span class="token variable">$version</span>&quot; ]; then
version=<span class="token variable"><span class="token variable">$(</span><span class="token function">curl</span> -m <span class="token number">10</span> -sL <span class="token string">&quot;https://fastly.jsdelivr.net/gh/naiba/nezha/&quot;</span> <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&quot;option\.value&quot;</span> <span class="token operator">|</span> <span class="token function">awk</span> -F <span class="token string">&quot;&#39;&quot;</span> <span class="token string">&#39;{print $2}&#39;</span> <span class="token operator">|</span> <span class="token function">sed</span> <span class="token string">&#39;s/naiba\/nezha@/v/g&#39;</span><span class="token variable">)</span></span>
fi
if [ ! -n &quot;<span class="token variable">$version</span>&quot; ]; then
version=<span class="token variable"><span class="token variable">$(</span><span class="token function">curl</span> -m <span class="token number">10</span> -sL <span class="token string">&quot;https://gcore.jsdelivr.net/gh/naiba/nezha/&quot;</span> <span class="token operator">|</span> <span class="token function">grep</span> <span class="token string">&quot;option\.value&quot;</span> <span class="token operator">|</span> <span class="token function">awk</span> -F <span class="token string">&quot;&#39;&quot;</span> <span class="token string">&#39;{print $2}&#39;</span> <span class="token operator">|</span> <span class="token function">sed</span> <span class="token string">&#39;s/naiba\/nezha@/v/g&#39;</span><span class="token variable">)</span></span>
fi
if [ ! -n &quot;<span class="token variable">$version</span>&quot; ]; then
echo -e &quot;version get to failed, please check if the network can link https://api.github.com/repos/naiba/nezha/releases/latest&quot;
return 0
else
echo -e &quot;The current latest version is: <span class="token variable">${version}</span>&quot;
fi
wget -t 2 -T 10 -O nezha-agent_linux_<span class="token variable">${os_arch}</span>.zip https://<span class="token variable">${GITHUB_URL}</span>/naiba/nezha/releases/download/<span class="token variable">${version}</span>/nezha-agent_linux_<span class="token variable">${os_arch}</span>.zip &gt;/dev/null 2&gt;&amp;1
if [[ <span class="token variable">$?</span> != 0 ]]; then
echo -e &quot;Release download failed, please check if the network can link <span class="token variable">${GITHUB_URL}</span><span class="token variable">${plain}</span>&quot;
return 0
fi
mkdir -p <span class="token variable">$NZ_AGENT_PATH</span>
chmod 755 -R <span class="token variable">$NZ_AGENT_PATH</span>
unzip -qo nezha-agent_linux_<span class="token variable">${os_arch}</span>.zip &amp;&amp; mv nezha-agent <span class="token variable">$NZ_AGENT_PATH</span> &amp;&amp; rm -rf nezha-agent_linux_<span class="token variable">${os_arch}</span>.zip README.md
fi
if [ ! -x &quot;<span class="token variable">${NZ_AGENT_PATH}</span>/nezha-agent&quot; ]; then
chmod +x <span class="token variable">${NZ_AGENT_PATH}</span>/nezha-agent
fi
}
start_pre() {
if [ &quot;<span class="token variable">${RC_CMD}</span>&quot; != &quot;restart&quot; ]; then
checkconfig || return <span class="token variable">$?</span>
fi
}
EOF</span>
</code></pre></div><ul><li><p>add execute permission</p><div class="language-shell"><pre><code><span class="token function">chmod</span> +x /etc/init.d/nezha-agent
</code></pre></div></li><li><p>run nezha-agent</p><div class="language-shell"><pre><code>rc-service nezha-agent-hy start
</code></pre></div></li><li><p>auto start on boot</p><div class="language-shell"><pre><code>rc-update <span class="token function">add</span> nezha-agent
</code></pre></div></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">哪吒探针 - Windows 客户端安装</a>(Chinese)<br><br></li></ul><h3 id="installing-agent-on-macos" tabindex="-1">Installing Agent on MacOS <a class="header-anchor" href="#installing-agent-on-macos" aria-hidden="true">#</a></h3><p><em><strong>This section is adapted from <a href="https://blog.mitsea.com/e796f93db38d49e4b18df234c6ee75f5" target="_blank" rel="noopener noreferrer">Mitsea Blog</a>, with permission from the original author</strong></em><br><br></p><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>If you are prompted with &quot;macOS cannot verify this app&quot; during installation, please go to system settings to allow the app to run.</p></div><ul><li>First add a server in the admin panel</li><li>Go to the <a href="https://github.com/naiba/nezha/releases" target="_blank" rel="noopener noreferrer">Release</a> page to download the Agent binary and choose whether to download the darwin amd64 or arm64 Agent depending on the CPU architecture<br> For example, download the amd64 version for Intel CPU and the arm64 version for Apple Silicon. After downloading, extract the Agent binary file, e.g. to the Download folder</li><li>Create a new file named <code>nezha_agent.plist</code> and save it, edit the contents of the file:</li></ul><div class="language-xml"><pre><code><span class="token prolog">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span class="token doctype"><span class="token punctuation">&lt;!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">plist</span> <span class="token name">PUBLIC</span> <span class="token string">&quot;-//Apple//DTD PLIST 1.0//EN&quot;</span> <span class="token string">&quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>plist</span> <span class="token attr-name">version</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>1.0<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dict</span><span class="token punctuation">&gt;</span></span>
@@ -64,7 +129,7 @@
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 &amp;&amp; /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,if you are already using the one-click script, you can edit <code>/etc/systemd/system/nezha-agent.service</code>,at 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 WebShell (security feature)</li><li><code>--tls</code> 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)</li></ul><h2 id="faq" tabindex="-1">FAQ <a class="header-anchor" href="#faq" aria-hidden="true">#</a></h2><h3 id="is-there-a-docker-image-for-agent" tabindex="-1">Is there a Docker image for Agent? <a class="header-anchor" href="#is-there-a-docker-image-for-agent" aria-hidden="true">#</a></h3><p><strong>There is currently no Docker image for Agent.</strong><br> The Agent is designed to be the opposite of the Dashboard, in that the Dashboard is designed to work without affecting the server as much as possible, while the Agent needs to execute monitoring services and run commands in the server.<br> Putting the Agent in a container does continue to execute monitoring services, but features such as WebShell do not work, so we do not provide Docker image of the Agent.</p></div></div><footer class="page-footer" data-v-7eddb2c4 data-v-07c132fc><div class="edit" data-v-07c132fc><div class="edit-link" data-v-07c132fc data-v-1ed99556><a class="link" href="https://github.com/nezhahq/nezhahq.github.io/edit/main/docs/en_US/guide/agent.md" target="_blank" rel="noopener noreferrer" data-v-1ed99556>Edit this page on GitHub <svg class="icon outbound icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15" data-v-1ed99556><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div></div><div class="updated" data-v-07c132fc><p class="last-updated" data-v-07c132fc data-v-abce3432><span class="prefix" data-v-abce3432>Last Updated:</span><span class="datetime" data-v-abce3432></span></p></div></footer><div class="next-and-prev-link" data-v-7eddb2c4 data-v-38ede35f><div class="container" data-v-38ede35f><div class="prev" data-v-38ede35f><a class="link" href="/en_US/guide/dashboard" data-v-38ede35f><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="icon icon-prev" data-v-38ede35f><path d="M19,11H7.4l5.3-5.3c0.4-0.4,0.4-1,0-1.4s-1-0.4-1.4,0l-7,7c-0.1,0.1-0.2,0.2-0.2,0.3c-0.1,0.2-0.1,0.5,0,0.8c0.1,0.1,0.1,0.2,0.2,0.3l7,7c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3c0.4-0.4,0.4-1,0-1.4L7.4,13H19c0.6,0,1-0.4,1-1S19.6,11,19,11z"></path></svg><span class="text" data-v-38ede35f>Install Dashboard</span></a></div><div class="next" data-v-38ede35f><a class="link" href="/en_US/guide/servers" data-v-38ede35f><span class="text" data-v-38ede35f>Servers</span><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="icon icon-next" data-v-38ede35f><path d="M19.9,12.4c0.1-0.2,0.1-0.5,0-0.8c-0.1-0.1-0.1-0.2-0.2-0.3l-7-7c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4l5.3,5.3H5c-0.6,0-1,0.4-1Line truncated
<script>__VP_HASH_MAP__ = JSON.parse("{\"case_case1.md\":\"6f7e6069\",\"case_case2.md\":\"cca93a97\",\"case_case3.md\":\"1f00aa7a\",\"case_case4.md\":\"24a6a53d\",\"case_index.md\":\"af904abd\",\"developer_index.md\":\"cd97e075\",\"developer_l10n.md\":\"6720e182\",\"developer_theme.md\":\"3935aec4\",\"en_us_case_case1.md\":\"6c1892ce\",\"en_us_case_case2.md\":\"3228474d\",\"en_us_case_case3.md\":\"ae3159aa\",\"en_us_case_case4.md\":\"cd3f1565\",\"en_us_case_index.md\":\"2e3a3d9f\",\"en_us_developer_index.md\":\"d16fa60e\",\"en_us_developer_l10n.md\":\"9fac1129\",\"en_us_developer_theme.md\":\"6b130c0d\",\"en_us_guide_agent.md\":\"f3a0c1a0\",\"en_us_guide_agentq.md\":\"604eab70\",\"en_us_guide_api.md\":\"9af6e288\",\"en_us_guide_dashboard.md\":\"596e5912\",\"en_us_guide_dashboardq.md\":\"c6755629\",\"en_us_guide_loginq.md\":\"5d82fa94\",\"en_us_guide_notifications.md\":\"8b453af1\",\"en_us_guide_q2.md\":\"dbed2065\",\"en_us_guide_q3.md\":\"875ada63\",\"en_us_guide_q4.md\":\"883b2ac7\",\"en_us_guide_q5.md\":\"2b3071b0\",\"en_us_guide_q6.md\":\"92123128\",\"en_us_guide_servers.md\":\"c6195784\",\"en_us_guide_services.md\":\"52b2c10c\",\"en_us_guide_settings.md\":\"57cae1da\",\"en_us_guide_tasks.md\":\"61bf5dbe\",\"en_us_index.md\":\"6c644b12\",\"guide_agent.md\":\"1fe0bf05\",\"guide_agentq.md\":\"86eace6c\",\"guide_api.md\":\"8823a7c0\",\"guide_dashboard.md\":\"8872d788\",\"guide_dashboardq.md\":\"997b1c25\",\"guide_loginq.md\":\"b108a6ec\",\"guide_notifications.md\":\"1e02df00\",\"guide_q1.md\":\"a3aae6ee\",\"guide_q2.md\":\"3d0dcc8a\",\"guide_q3.md\":\"b3160c5d\",\"guide_q4.md\":\"2de2a085\",\"guide_q5.md\":\"f4d0fa50\",\"guide_q6.md\":\"01141912\",\"guide_servers.md\":\"cec4a3b4\",\"guide_services.md\":\"c5ea8d07\",\"guide_settings.md\":\"586f244e\",\"guide_tasks.md\":\"d538622f\",\"index.md\":\"8a564e81\"}")</script>
<script>__VP_HASH_MAP__ = JSON.parse("{\"case_case1.md\":\"c09e4b0c\",\"case_case2.md\":\"abcb056d\",\"case_case3.md\":\"eba6f44d\",\"case_case4.md\":\"a6091cab\",\"case_index.md\":\"b9a2f2a3\",\"developer_index.md\":\"1075f4bf\",\"developer_l10n.md\":\"80ff5d0f\",\"developer_theme.md\":\"2f9a08a0\",\"en_us_case_case1.md\":\"44f4d3f2\",\"en_us_case_case2.md\":\"ecbe83e1\",\"en_us_case_case3.md\":\"b63e1754\",\"en_us_case_case4.md\":\"6b10d5c1\",\"en_us_case_index.md\":\"1d6196a6\",\"en_us_developer_index.md\":\"3680d623\",\"en_us_developer_l10n.md\":\"c75d30ce\",\"en_us_developer_theme.md\":\"72c8d925\",\"en_us_guide_agent.md\":\"8a0d8548\",\"en_us_guide_agentq.md\":\"0c0351af\",\"en_us_guide_api.md\":\"79b6188a\",\"en_us_guide_dashboard.md\":\"eb99ef39\",\"en_us_guide_dashboardq.md\":\"cbd5cf4c\",\"en_us_guide_loginq.md\":\"8e7c8a14\",\"en_us_guide_notifications.md\":\"ead8f912\",\"en_us_guide_q2.md\":\"8323ac4b\",\"en_us_guide_q3.md\":\"ef24c58e\",\"en_us_guide_q4.md\":\"414e3c69\",\"en_us_guide_q5.md\":\"583fa2c8\",\"en_us_guide_q6.md\":\"f61dac5f\",\"en_us_guide_servers.md\":\"02a9e02b\",\"en_us_guide_services.md\":\"772dbb29\",\"en_us_guide_settings.md\":\"2d9dfb43\",\"en_us_guide_tasks.md\":\"3eebcd2a\",\"en_us_index.md\":\"d699e8ab\",\"guide_agent.md\":\"f3f39baf\",\"guide_agentq.md\":\"20d39a69\",\"guide_api.md\":\"f50dd0eb\",\"guide_dashboard.md\":\"c477b3f9\",\"guide_dashboardq.md\":\"16db81d1\",\"guide_loginq.md\":\"7a122b0a\",\"guide_notifications.md\":\"825d41b0\",\"guide_q1.md\":\"370cf8e8\",\"guide_q2.md\":\"12b78101\",\"guide_q3.md\":\"9ed43395\",\"guide_q4.md\":\"f8391813\",\"guide_q5.md\":\"4b2106e2\",\"guide_q6.md\":\"df9c3083\",\"guide_servers.md\":\"6fb16960\",\"guide_services.md\":\"8d7a784d\",\"guide_settings.md\":\"68b4c8b0\",\"guide_tasks.md\":\"79fcc93d\",\"index.md\":\"777deff1\"}")</script>
<script type="module" async src="/assets/app.4f7c959e.js"></script>
</body>