mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-18 05:01:21 +08:00
doc: update docs/glances.md #659 #575 a0480a90dd
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
<title>Glances 备忘清单
|
||||
& glances cheatsheet & Quick Reference</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta description="Glances 是一个开源的系统监控工具,可以帮助用户监视系统的各种性能指标。它以终端界面的形式展示信息,包括CPU、内存、磁盘、网络等方面的数据。此 Glances 备忘清单包含 Glances 命令
|
||||
<meta description="这是开始使用 Glances 系统监控工具的快速参考备忘单,可以帮助用户监视系统的各种性能指标
|
||||
|
||||
入门,为开发人员分享快速参考备忘单。">
|
||||
<meta keywords="glances,reference,Quick,Reference,cheatsheet,cheat,sheet">
|
||||
@ -29,188 +29,376 @@
|
||||
</button><script src="../js/dark.js?v=1.5.3"></script><a href="https://github.com/jaywcjlove/reference" class="" target="__blank"><svg viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a></div></div></nav><div class="wrap h1body-exist max-container"><header class="wrap-header h1wrap"><h1 id="glances-备忘清单"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em">
|
||||
<path d="M107.946667 838.4l57.173333 23.893333v-385.28l-103.68 250.026667c-17.493333 43.52 3.413333 93.44 46.506667 111.36z m832-157.866667L728.32 169.813333a85.888 85.888 0 0 0-77.226667-52.48c-11.093333 0-22.613333 1.706667-33.706666 6.4L302.933333 253.866667a85.290667 85.290667 0 0 0-46.08 110.933333l211.626667 510.72a85.248 85.248 0 0 0 110.933333 46.08l314.026667-130.133333a85.077333 85.077333 0 0 0 46.506667-110.933334zM336.213333 373.333333c-23.466667 0-42.666667-19.2-42.666666-42.666666s19.2-42.666667 42.666666-42.666667 42.666667 19.2 42.666667 42.666667-19.2 42.666667-42.666667 42.666666z m-85.333333 469.333334c0 46.933333 38.4 85.333333 85.333333 85.333333h61.866667l-147.2-355.84v270.506667z"></path>
|
||||
</svg><a aria-hidden="true" tabindex="-1" href="#glances-备忘清单"><span class="icon icon-link"></span></a>Glances 备忘清单</h1><div class="wrap-body">
|
||||
<p><a href="https://glances.readthedocs.io/en/latest/">Glances</a> 是一个开源的系统监控工具,可以帮助用户监视系统的各种性能指标。它以终端界面的形式展示信息,包括CPU、内存、磁盘、网络等方面的数据。此 Glances 备忘清单包含 Glances 命令</p>
|
||||
<p>这是开始使用 <a href="https://glances.readthedocs.io/en/latest/">Glances</a> 系统监控工具的快速参考备忘单,可以帮助用户监视系统的各种性能指标</p>
|
||||
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
|
||||
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
|
||||
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#功能特点">功能特点</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#安装">安装</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#使用方法">使用方法</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#键盘快捷键">键盘快捷键</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#配置文件">配置文件</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#例子配置文件">例子配置文件</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#高级">高级</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#高级用法">高级用法</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="功能特点"><a aria-hidden="true" tabindex="-1" href="#功能特点"><span class="icon icon-link"></span></a>功能特点</h3><div class="wrap-body">
|
||||
<ol>
|
||||
<li>
|
||||
<p><strong>跨平台支持</strong>:</p>
|
||||
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#功能特点">功能特点</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#跨平台支持">跨平台支持</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#多种输出方式">多种输出方式</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#详细的系统监控">详细的系统监控</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#扩展功能">扩展功能</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#安装">安装</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#通过-pip-安装">通过 pip 安装</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#通过包管理器安装">通过包管理器安装</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#配置文件">配置文件</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#例子配置文件">例子配置文件</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#web-访问">Web 访问</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#使用方法">使用方法</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#启动命令行界面">启动命令行界面</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#启动-web-界面">启动 Web 界面</a><a aria-hidden="true" class="leve4 tocs-link" data-num="4" href="#启动以特定模式输出">启动以特定模式输出</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#键盘快捷键">键盘快捷键</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#快捷键">快捷键</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#快捷键-1">快捷键</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#快捷键-2">快捷键</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="功能特点"><a aria-hidden="true" tabindex="-1" href="#功能特点"><span class="icon icon-link"></span></a>功能特点</h3><div class="wrap-body">
|
||||
<!--rehype:wrap-class=row-span-2-->
|
||||
<h4 id="跨平台支持"><a aria-hidden="true" tabindex="-1" href="#跨平台支持"><span class="icon icon-link"></span></a>跨平台支持</h4>
|
||||
<ul>
|
||||
<li>Glances 支持多种操作系统,包括 Linux、Windows、macOS 和 FreeBSD。</li>
|
||||
<li><code>Glances</code> 支持多种操作系统,包括 Linux、Windows、macOS 和 FreeBSD。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>多种输出方式</strong>:</p>
|
||||
<h4 id="多种输出方式"><a aria-hidden="true" tabindex="-1" href="#多种输出方式"><span class="icon icon-link"></span></a>多种输出方式</h4>
|
||||
<ul>
|
||||
<li>命令行界面(CLI):通过终端查看系统监控数据。</li>
|
||||
<li>Web 界面:通过浏览器访问并查看系统性能指标。</li>
|
||||
<li>API 输出:可以将数据通过 REST API 或者 MQTT 传输到其他系统或服务。</li>
|
||||
<li><code>命令行界面(CLI)</code>:通过终端查看系统监控数据。</li>
|
||||
<li><code>Web 界面</code>:通过浏览器访问并查看系统性能指标。</li>
|
||||
<li><code>API 输出</code>:可以将数据通过 REST API 或者 MQTT 传输到其他系统或服务。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>详细的系统监控</strong>:</p>
|
||||
<h4 id="详细的系统监控"><a aria-hidden="true" tabindex="-1" href="#详细的系统监控"><span class="icon icon-link"></span></a>详细的系统监控</h4>
|
||||
<ul>
|
||||
<li><strong>CPU</strong>:实时显示 CPU 的使用率、每个核心的负载情况。</li>
|
||||
<li><strong>内存</strong>:显示总内存、已用内存、缓存和交换分区的使用情况。</li>
|
||||
<li><strong>磁盘 I/O</strong>:显示磁盘的读写速度和 I/O 操作数。</li>
|
||||
<li><strong>网络带宽</strong>:显示网络接口的上传和下载速度。</li>
|
||||
<li><strong>文件系统</strong>:显示各个挂载点的使用情况。</li>
|
||||
<li><strong>传感器</strong>:显示系统温度、风扇速度等传感器数据(需要支持的硬件和驱动)。</li>
|
||||
<li><code>CPU</code>:实时显示 CPU 的使用率、每个核心的负载情况。</li>
|
||||
<li><code>内存</code>:显示总内存、已用内存、缓存和交换分区的使用情况。</li>
|
||||
<li><code>磁盘 I/O</code>:显示磁盘的读写速度和 I/O 操作数。</li>
|
||||
<li><code>网络带宽</code>:显示网络接口的上传和下载速度。</li>
|
||||
<li><code>文件系统</code>:显示各个挂载点的使用情况。</li>
|
||||
<li><code>传感器</code>:显示系统温度、风扇速度等传感器数据(需要支持的硬件和驱动)。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>扩展功能</strong>:</p>
|
||||
<h4 id="扩展功能"><a aria-hidden="true" tabindex="-1" href="#扩展功能"><span class="icon icon-link"></span></a>扩展功能</h4>
|
||||
<ul>
|
||||
<li><strong>插件系统</strong>:支持通过插件扩展功能,可以自定义监控指标。</li>
|
||||
<li><strong>导出数据</strong>:支持将监控数据导出为 CSV、JSON 等格式。</li>
|
||||
<li><strong>报警系统</strong>:可以设置报警,当某些指标超过设定阈值时触发通知。</li>
|
||||
<li><code>插件系统</code>:支持通过插件扩展功能,可以自定义监控指标。</li>
|
||||
<li><code>导出数据</code>:支持将监控数据导出为 CSV、JSON 等格式。</li>
|
||||
<li><code>报警系统</code>:可以设置报警,当某些指标超过设定阈值时触发通知。</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h3><div class="wrap-body">
|
||||
<ol>
|
||||
<li>
|
||||
<p><strong>通过 pip 安装</strong>:</p>
|
||||
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h3><div class="wrap-body">
|
||||
<h4 id="通过-pip-安装"><a aria-hidden="true" tabindex="-1" href="#通过-pip-安装"><span class="icon icon-link"></span></a><strong>通过 pip 安装</strong></h4>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">pip <span class="token function">install</span> glances
|
||||
</span></code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>通过包管理器安装</strong>:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<h4 id="通过包管理器安装"><a aria-hidden="true" tabindex="-1" href="#通过包管理器安装"><span class="icon icon-link"></span></a><strong>通过包管理器安装</strong></h4>
|
||||
<p><strong>Debian/Ubuntu</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line"><span class="token function">sudo</span> <span class="token function">apt-get</span> <span class="token function">install</span> glances
|
||||
</span></code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Fedora</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line"><span class="token function">sudo</span> dnf <span class="token function">install</span> glances
|
||||
</span></code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>macOS (使用 Homebrew)</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">brew <span class="token function">install</span> glances
|
||||
</span></code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="使用方法"><a aria-hidden="true" tabindex="-1" href="#使用方法"><span class="icon icon-link"></span></a>使用方法</h3><div class="wrap-body">
|
||||
<ol>
|
||||
<li>
|
||||
<p><strong>启动命令行界面</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">glances
|
||||
</span></code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>启动 Web 界面</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">glances <span class="token parameter variable">-w</span>
|
||||
</span></code></pre>
|
||||
<p>启动后,可以通过浏览器访问 <code>http://<your_ip>:61208</code> 查看系统监控数据。</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>启动以特定模式输出</strong>:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>JSON 输出</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">glances <span class="token parameter variable">--export</span> json
|
||||
</span></code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>CSV 输出</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">glances <span class="token parameter variable">--export</span> csv
|
||||
</span></code></pre>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="键盘快捷键"><a aria-hidden="true" tabindex="-1" href="#键盘快捷键"><span class="icon icon-link"></span></a>键盘快捷键</h3><div class="wrap-body">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table><thead><tr><th>快捷键</th><th>功能</th></tr></thead><tbody><tr><td>a</td><td>切换自动刷新模式</td></tr><tr><td>c</td><td>显示 CPU 相关信息</td></tr><tr><td>m</td><td>显示内存使用情况</td></tr><tr><td>d</td><td>显示磁盘 I/O 信息</td></tr><tr><td>n</td><td>显示网络信息</td></tr><tr><td>f</td><td>显示文件系统信息</td></tr><tr><td>s</td><td>显示传感器信息(如系统温度)</td></tr><tr><td>q</td><td>退出 Glances</td></tr></tbody></table>
|
||||
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="配置文件"><a aria-hidden="true" tabindex="-1" href="#配置文件"><span class="icon icon-link"></span></a>配置文件</h3><div class="wrap-body">
|
||||
<p>Glances 的配置文件位于 <code>~/.config/glances/glances.conf</code>。通过编辑这个文件,可以自定义 Glances 的显示和行为。</p>
|
||||
<h4 id="例子配置文件"><a aria-hidden="true" tabindex="-1" href="#例子配置文件"><span class="icon icon-link"></span></a>例子配置文件</h4>
|
||||
<pre class="language-ini"><code class="language-ini code-highlight"><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">global</span><span class="token punctuation">]</span></span>
|
||||
</span><span class="code-line"><span class="token comment"># 设置刷新间隔(以秒为单位)</span>
|
||||
</span><span class="code-line"><span class="token key attr-name">refresh</span><span class="token punctuation">=</span><span class="token value attr-value">2</span>
|
||||
</span><span class="code-line">
|
||||
</span><span class="code-line"><span class="token key attr-name">refresh</span><span class="token punctuation">=</span><span class="token value attr-value">2 # 设置刷新间隔(以秒为单位)</span>
|
||||
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">cpu</span><span class="token punctuation">]</span></span>
|
||||
</span><span class="code-line"><span class="token comment"># 显示 CPU 负载平均值</span>
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true</span>
|
||||
</span><span class="code-line">
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true # 显示 CPU 负载平均值</span>
|
||||
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">mem</span><span class="token punctuation">]</span></span>
|
||||
</span><span class="code-line"><span class="token comment"># 显示内存使用情况</span>
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true</span>
|
||||
</span><span class="code-line">
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true # 显示内存使用情况</span>
|
||||
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">disk</span><span class="token punctuation">]</span></span>
|
||||
</span><span class="code-line"><span class="token comment"># 显示磁盘 I/O 信息</span>
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true</span>
|
||||
</span><span class="code-line">
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true # 显示磁盘 I/O 信息</span>
|
||||
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">network</span><span class="token punctuation">]</span></span>
|
||||
</span><span class="code-line"><span class="token comment"># 显示网络带宽使用情况</span>
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true</span>
|
||||
</span><span class="code-line"><span class="token key attr-name">enable</span><span class="token punctuation">=</span><span class="token value attr-value">true # 显示网络带宽使用情况</span>
|
||||
</span></code></pre>
|
||||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="高级"><a aria-hidden="true" tabindex="-1" href="#高级"><span class="icon icon-link"></span></a>高级</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="高级用法"><a aria-hidden="true" tabindex="-1" href="#高级用法"><span class="icon icon-link"></span></a>高级用法</h3><div class="wrap-body">
|
||||
<ol>
|
||||
<li>
|
||||
<p><strong>使用 Glances 的 API</strong>:</p>
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="web-访问"><a aria-hidden="true" tabindex="-1" href="#web-访问"><span class="icon icon-link"></span></a>Web 访问</h3><div class="wrap-body">
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line"><span class="token comment"># 使用 Glances 的 API:</span>
|
||||
</span><span class="code-line">glances <span class="token parameter variable">-w</span>
|
||||
</span><span class="code-line"><span class="token comment"># 访问 API:</span>
|
||||
</span><span class="code-line"><span class="token function">curl</span> http://<span class="token operator"><</span>your_ip<span class="token operator">></span>:61208/api/3/all
|
||||
</span></code></pre>
|
||||
<p><strong>使用 Docker 部署 Glances</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line"><span class="token function">docker</span> run <span class="token parameter variable">--rm</span> <span class="token punctuation">\</span>
|
||||
</span><span class="code-line"> <span class="token parameter variable">-v</span> /var/run/docker.sock:/var/run/docker.sock:ro <span class="token punctuation">\</span>
|
||||
</span><span class="code-line"> <span class="token parameter variable">-v</span> /glances/conf:/glances/conf:ro <span class="token punctuation">\</span>
|
||||
</span><span class="code-line"> <span class="token parameter variable">-v</span> /glances/data:/glances/data:rw <span class="token punctuation">\</span>
|
||||
</span><span class="code-line"> <span class="token parameter variable">-p</span> <span class="token number">61208</span>-61209:61208-61209 <span class="token punctuation">\</span>
|
||||
</span><span class="code-line"> <span class="token parameter variable">--name</span> glances nicolargo/glances
|
||||
</span></code></pre>
|
||||
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="使用方法"><a aria-hidden="true" tabindex="-1" href="#使用方法"><span class="icon icon-link"></span></a>使用方法</h3><div class="wrap-body">
|
||||
<h4 id="启动命令行界面"><a aria-hidden="true" tabindex="-1" href="#启动命令行界面"><span class="icon icon-link"></span></a><strong>启动命令行界面</strong></h4>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">glances
|
||||
</span></code></pre>
|
||||
<h4 id="启动-web-界面"><a aria-hidden="true" tabindex="-1" href="#启动-web-界面"><span class="icon icon-link"></span></a><strong>启动 Web 界面</strong></h4>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">glances <span class="token parameter variable">-w</span>
|
||||
</span></code></pre>
|
||||
<p>访问 API:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line"><span class="token function">curl</span> http://<span class="token operator"><</span>your_ip<span class="token operator">></span>:61208/api/3/all
|
||||
<p>启动后,通过浏览器访问 <code>http://<your_ip>:61208</code> 查看系统监控数据。</p>
|
||||
<h4 id="启动以特定模式输出"><a aria-hidden="true" tabindex="-1" href="#启动以特定模式输出"><span class="icon icon-link"></span></a><strong>启动以特定模式输出</strong></h4>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line">glances <span class="token parameter variable">--export</span> json <span class="token comment"># JSON 输出</span>
|
||||
</span><span class="code-line">glances <span class="token parameter variable">--export</span> csv <span class="token comment"># CSV 输出</span>
|
||||
</span></code></pre>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>使用 Docker 部署 Glances</strong>:</p>
|
||||
<pre class="language-sh"><code class="language-sh code-highlight"><span class="code-line"><span class="token function">docker</span> run <span class="token parameter variable">--rm</span> <span class="token parameter variable">-v</span> /var/run/docker.sock:/var/run/docker.sock:ro <span class="token parameter variable">-v</span> /glances/conf:/glances/conf:ro <span class="token parameter variable">-v</span> /glances/data:/glances/data:rw <span class="token parameter variable">-p</span> <span class="token number">61208</span>-61209:61208-61209 <span class="token parameter variable">--name</span> glances nicolargo/glances
|
||||
</span></code></pre>
|
||||
</li>
|
||||
</ol>
|
||||
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="键盘快捷键"><a aria-hidden="true" tabindex="-1" href="#键盘快捷键"><span class="icon icon-link"></span></a>键盘快捷键</h2><div class="wrap-body">
|
||||
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="快捷键"><a aria-hidden="true" tabindex="-1" href="#快捷键"><span class="icon icon-link"></span></a>快捷键</h3><div class="wrap-body">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="shortcuts left-align"><thead><tr><th>快捷键</th><th>功能</th></tr></thead><tbody><tr><td><code>ENTER</code></td><td>设置进程过滤器</td></tr><tr><td><code>a</code></td><td>自动排序进程列表</td></tr><tr><td><code>A</code></td><td>启用/禁用应用程序监控进程</td></tr><tr><td><code>b</code></td><td>在网络I/O中切换比特/秒或字节/秒</td></tr><tr><td><code>B</code></td><td>查看每秒磁盘I/O计数器</td></tr><tr><td><code>c</code></td><td>按CPU使用率排序进程</td></tr><tr><td><code>C</code></td><td>启用/禁用云统计</td></tr><tr><td><code>d</code></td><td>显示/隐藏磁盘I/O统计</td></tr><tr><td><code>D</code></td><td>启用/禁用Docker统计</td></tr><tr><td><code>e</code></td><td>启用/禁用顶级扩展统计</td></tr><tr><td><code>E</code></td><td>清除当前进程过滤器</td></tr><tr><td><code>f</code></td><td>显示/隐藏文件系统和文件夹监控统计</td></tr><tr><td><code>F</code></td><td>在文件系统使用和可用空间之间切换</td></tr><tr><td><code>g</code></td><td>为当前历史生成图表</td></tr><tr><td><code>G</code></td><td>启用/禁用GPU统计</td></tr><tr><td><code>h</code></td><td>显示/隐藏帮助屏幕</td></tr><tr><td><code>i</code></td><td>按I/O速率排序进程</td></tr><tr><td><code>I</code></td><td>显示/隐藏IP模块</td></tr><tr><td><code>+</code></td><td>增加选定进程的nice值/降低优先级(需要权限)- 仅在独立模式下</td></tr><tr><td><code>-</code></td><td>减少选定进程的nice值/提高优先级(需要权限)- 仅在独立模式下</td></tr><tr><td><code>k</code></td><td>终止选定进程(需要权限)- 仅在独立模式下</td></tr></tbody></table>
|
||||
<!--rehype:className=shortcuts left-align-->
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="快捷键-1"><a aria-hidden="true" tabindex="-1" href="#快捷键-1"><span class="icon icon-link"></span></a>快捷键</h3><div class="wrap-body">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="shortcuts left-align"><thead><tr><th>快捷键</th><th>功能</th></tr></thead><tbody><tr><td><code>K</code></td><td>显示/隐藏TCP连接</td></tr><tr><td><code>l</code></td><td>显示/隐藏日志消息</td></tr><tr><td><code>m</code></td><td>按内存使用率排序进程</td></tr><tr><td><code>M</code></td><td>重置进程摘要的最小/最大值</td></tr><tr><td><code>n</code></td><td>显示/隐藏网络统计</td></tr><tr><td><code>N</code></td><td>显示/隐藏当前时间</td></tr><tr><td><code>p</code></td><td>按名称排序进程</td></tr><tr><td><code>P</code></td><td>启用/禁用端口统计</td></tr><tr><td><code>q|ESC|CTRL-C</code></td><td>退出当前Glances会话</td></tr><tr><td><code>Q</code></td><td>显示/隐藏IRQ模块</td></tr><tr><td><code>r</code></td><td>重置历史记录</td></tr><tr><td><code>R</code></td><td>显示/隐藏RAID插件</td></tr><tr><td><code>s</code></td><td>显示/隐藏传感器统计</td></tr><tr><td><code>S</code></td><td>启用/禁用微小曲线图</td></tr><tr><td><code>t</code></td><td>按CPU时间排序进程(TIME+)</td></tr><tr><td><code>T</code></td><td>以组合方式查看网络I/O</td></tr><tr><td><code>u</code></td><td>按用户排序进程</td></tr><tr><td><code>U</code></td><td>查看累积网络I/O</td></tr><tr><td><code>w</code></td><td>删除已完成的警告日志消息</td></tr><tr><td><code>W</code></td><td>显示/隐藏Wifi模块</td></tr><tr><td><code>x</code></td><td>删除已完成的警告和严重日志消息</td></tr><tr><td><code>z</code></td><td>显示/隐藏进程统计</td></tr></tbody></table>
|
||||
<!--rehype:className=shortcuts left-align-->
|
||||
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="快捷键-2"><a aria-hidden="true" tabindex="-1" href="#快捷键-2"><span class="icon icon-link"></span></a>快捷键</h3><div class="wrap-body">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="shortcuts left-align"><thead><tr><th>快捷键</th><th>功能</th></tr></thead><tbody><tr><td><code>0</code></td><td>启用/禁用Irix/Solaris模式。任务的CPU使用率将按CPU总数进行划分</td></tr><tr><td><code>1</code></td><td>在全局CPU和每个CPU统计之间切换</td></tr><tr><td><code>2</code></td><td>启用/禁用左侧边栏</td></tr><tr><td><code>3</code></td><td>启用/禁用快速查看模块</td></tr><tr><td><code>4</code></td><td>启用/禁用除快速查看和负载模块外的所有模块</td></tr><tr><td><code>5</code></td><td>启用/禁用顶部菜单(快速查看、CPU、内存、交换区和负载)</td></tr><tr><td><code>6</code></td><td>启用/禁用平均GPU模式</td></tr><tr><td><code>9</code></td><td>在黑白主题之间切换UI主题</td></tr><tr><td><code>/</code></td><td>在进程命令行或命令名称之间切换</td></tr><tr><td><code>F5</code></td><td>刷新curses用户界面的统计数据</td></tr><tr><td><code>LEFT</code></td><td>向左导航进程排序</td></tr><tr><td><code>RIGHT</code></td><td>向右导航进程排序</td></tr><tr><td><code>UP</code></td><td>在进程列表中向上</td></tr><tr><td><code>DOWN</code></td><td>在进程列表中向下。在Glances客户端浏览器中(通过<code>--browser</code>命令行参数访问):</td></tr><tr><td><code>ENTER</code></td><td>运行选定的服务器</td></tr><tr><td><code>UP</code></td><td>在服务器列表中向上</td></tr><tr><td><code>DOWN</code></td><td>在服务器列表中向下</td></tr><tr><td><code>q|ESC</code></td><td>退出Glances</td></tr></tbody></table>
|
||||
<!--rehype:className=shortcuts left-align-->
|
||||
</div></div></div></div></div><div class="wrap h2body-not-exist"><div class="wrap-header h2wrap"><h2 id="另见"><a aria-hidden="true" tabindex="-1" href="#另见"><span class="icon icon-link"></span></a>另见</h2><div class="wrap-body">
|
||||
<p>Glances 是一个功能强大且灵活的系统监控工具,可以满足不同场景下的系统监控需求。如果你有更多具体需求,可以参考 <a href="https://nicolargo.github.io/glances/">Glances 官方文档</a>。</p>
|
||||
<ul>
|
||||
<li><a href="https://nicolargo.github.io/glances/">Glances 官方文档</a> <em>nicolargo.github.io</em></li>
|
||||
</ul>
|
||||
</div></div><div class="h2wrap-body"></div></div></div><script src="https://giscus.app/client.js" data-repo="jaywcjlove/reference" data-repo-id="R_kgDOID2-Mw" data-category="Q&A" data-category-id="DIC_kwDOID2-M84CS5wo" data-mapping="pathname" data-strict="0" data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="dark" data-lang="zh-CN" crossorigin="anonymous" async></script><div class="giscus"></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 <a href="https://wangchujiang.com/#/app" target="_blank">Kenny Wang</a>.</footer></footer><script src="../data.js?v=1.5.3" defer></script><script src="../js/fuse.min.js?v=1.5.3" defer></script><script src="../js/main.js?v=1.5.3" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
|
||||
<path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
|
||||
</svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body>
|
||||
|
Reference in New Issue
Block a user