15 lines
7.8 KiB
JavaScript
15 lines
7.8 KiB
JavaScript
import{_ as i,c as a,o as s,a4 as e}from"./chunks/framework.BmdFiWrL.js";const u=JSON.parse('{"title":"Enable GPU monitoring","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"en_US/guide/q9.md","filePath":"en_US/guide/q9.md","lastUpdated":1723329100000}'),n={name:"en_US/guide/q9.md"},t=e(`<h1 id="enable-gpu-monitoring" tabindex="-1">Enable GPU monitoring <a class="header-anchor" href="#enable-gpu-monitoring" aria-label="Permalink to "Enable GPU monitoring""></a></h1><p>GPU monitoring is a new feature implemented in Nezha Monitoring v0.17.x. Before using the feature, please ensure your Dashboard version is higher than v0.17.2 and Agent version is higher than v0.17.0.</p><h2 id="enable" tabindex="-1">Enable <a class="header-anchor" href="#enable" aria-label="Permalink to "Enable""></a></h2><h3 id="from-command-line-flag" tabindex="-1">From Command-Line Flag <a class="header-anchor" href="#from-command-line-flag" aria-label="Permalink to "From Command-Line Flag""></a></h3><p>Append the <code>--gpu</code> flag to the Agent argument. For example:</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:#005CC5;--shiki-dark:#79B8FF;"> -s</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> example.com:5555</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -p</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> example</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --gpu</span></span></code></pre></div><h3 id="from-configuration-file" tabindex="-1">From configuration file <a class="header-anchor" href="#from-configuration-file" aria-label="Permalink to "From configuration file""></a></h3><p>Execute the following command to modify Agent configuration to enable GPU monitoring.</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><p>In the interactive menu returned, choose to enable GPU monitoring.</p><h2 id="enable-gpu-utilization-monitoring" tabindex="-1">Enable GPU utilization monitoring <a class="header-anchor" href="#enable-gpu-utilization-monitoring" aria-label="Permalink to "Enable GPU utilization monitoring""></a></h2><p>GPU model and GPU utilization are two different monitor items, which uses different approaches to obtain their value.</p><p>Windows and macOS supports getting GPU utilization without extra dependencies, and support multiple graphics card brands.</p><p>Linux distros support only NVIDIA and AMD cards and need to install extra dependencies.</p><p>Below are the instructions on how to enable GPU utilization monitoring on Linux for NVIDIA / AMD graphics cards.</p><h3 id="nvidia" tabindex="-1">NVIDIA <a class="header-anchor" href="#nvidia" aria-label="Permalink to "NVIDIA""></a></h3><p>NVIDIA cards need the <code>nvidia-smi</code> utility to get GPU utilization. This utility is included in the official driver by default.</p><p>If you use unofficial drivers like <code>nouveau</code>, then it's not possible to get GPU utilization.</p><h3 id="amd" tabindex="-1">AMD <a class="header-anchor" href="#amd" aria-label="Permalink to "AMD""></a></h3><p>AMD cards need to install the open source <code>amdgpu</code> driver and the <code>rocm-smi</code> utility.</p><p>Mainstream distros have already packaged <code>rocm-smi</code>, below are commands to install the utility on these distros:</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:#6A737D;--shiki-dark:#6A737D;"># Arch Linux</span></span>
|
||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">pacman</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -Sy</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> rocm-smi-lib</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Debian / Ubuntu</span></span>
|
||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">apt</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> rocm-smi</span></span>
|
||
<span class="line"></span>
|
||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Fedora / RHEL 8+</span></span>
|
||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">dnf</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> rocm-smi</span></span></code></pre></div><p>If your distro doesn't have the package, then you will need to compile <code>rocm_smi_lib</code> manually.</p><p>Required dependencies:<code>git</code> <code>cmake</code> <code>gcc</code></p><p>First, clone the git repository of <code>rocm_smi_lib</code>:</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;">git</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> clone</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://github.com/ROCm/rocm_smi_lib</span></span></code></pre></div><p>Then compile the libraries and install them on your system.</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:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> rocm_smi_lib</span></span>
|
||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">mkdir</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -p</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span></span>
|
||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span></span>
|
||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">cmake</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ..</span></span>
|
||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">make</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -j</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> $(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">nproc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
|
||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Install library file and header; default location is /opt/rocm</span></span>
|
||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">make</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span></span></code></pre></div>`,28),l=[t];function o(h,p,d,r,c,k){return s(),a("div",null,l)}const m=i(n,[["render",o]]);export{u as __pageData,m as default};
|