Linux 下使用性能监控工具 gtop 和 htop

文章
林里克斯

Linux 下使用性能监控工具 gtop 和 htop


实验平台:CentOS Linux release 7.9.2009 (Core)

htop Version:1.0.2

gtop Version:3.0.5


一、gtop


1.安装

https://github.com/aksakalli/gtop
#GitHub

gtop 依赖于 nodejs,所以需要 node 命令,没有的可参考此篇文章进行安装 --> Linux 上安装 node 和 npm 命令

2.使用国内阿里源

$ sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
/usr/local/node/bin/cnpm -> /usr/local/node/lib/node_modules/cnpm/bin/cnpm
+ cnpm@6.1.1
added 694 packages from 973 contributors in 44.068s

3.安装命令

$ sudo cnpm install gtop -g
Downloading gtop to /usr/local/node/lib/node_modules/gtop_tmp
Copying /usr/local/node/lib/node_modules/gtop_tmp/_gtop@1.0.2@gtop to /usr/local/node/lib/node_modules/gtop
Installing gtop's dependencies to /usr/local/node/lib/node_modules/gtop/node_modules
[1/3] blessed@^0.1.81 installed at node_modules/_blessed@0.1.81@blessed
[2/3] systeminformation@^4.22.1 installed at node_modules/_systeminformation@4.34.19@systeminformation
[3/3] blessed-contrib@^4.8.17 installed at node_modules/_blessed-contrib@4.8.21@blessed-contrib
peerDependencies WARNING blessed-contrib@4.8.21 › marked-terminal@^4.0.0 requires a peer of marked@^1.0.0 || ^2.0.0 but marked@0.7.0 was installed
Recently updated (since 2021-03-15): 2 packages (detail see file /usr/local/node/lib/node_modules/gtop/node_modules/.recently_updates.txt)
  2021-03-16
    → systeminformation@^4.22.1(4.34.19) (19:04:05)
  2021-03-15
    → blessed-contrib@4.8.21 › marked-terminal@4.1.1 › cli-table@^0.3.1(0.3.6) (22:54:28)
All packages installed (60 packages installed from npm registry, used 5s(network 5s), speed 874.79kB/s, json 56(128.88kB), tarball 4.09MB)
[gtop@1.0.2] link /usr/local/node/bin/gtop@ -> /usr/local/node/lib/node_modules/gtop/bin/gtop
#这样是当前用户安装

4.映射命令

# which gtop
/usr/local/node/bin/gtop
# ln -s /usr/local/node/bin/gtop /usr/bin/gtop
#这样所有的用户都可以使用此命令了

5.使用

$ gtop

Linux 下使用性能监控工具 gtop 和 htop


二、htop


1.官网

https://htop.dev/

https://github.com/htop-dev/htop/releases
#GitHub 下载地址

2.yum 安装

$ sudo yum -y install htop
#需要有 epel 源

3.安装准备

$ sudo yum -y install autoconf automake gcc gcc-c++ ncurses-devel
#安装依赖 (生成编译文件 需要 autoconf , autoconf 依赖 automake)
$ wget https://github.com/htop-dev/htop/archive/refs/tags/3.0.5.tar.gz
$ tar xf 3.0.5.tar.gz
$ cd htop-3.0.5

4.编译安装

$ ./autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=all 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force --warnings=all
autoreconf: running: /usr/bin/autoheader --force --warnings=all
autoreconf: running: automake --add-missing --copy --force-missing --warnings=all
configure.ac:19: installing './compile'
configure.ac:12: installing './config.guess'
configure.ac:12: installing './config.sub'
configure.ac:14: installing './install-sh'
configure.ac:14: installing './missing'
Makefile.am: installing './INSTALL'
Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'

$ ./configure
···
  htop 3.0.5

  platform:                  linux
  (Linux) proc directory:    /proc
  (Linux) openvz:            no
  (Linux) vserver:           no
  (Linux) ancient vserver:   no
  (Linux) affinity:          yes
  (Linux) delay accounting:  no
  (Linux) sensors:           no
  unicode:                   yes
  hwloc:                     no
  setuid:                    no
  debug:                     no

$ sudo make && make install

5.使用

$ htop

Linux 下使用性能监控工具 gtop 和 htop

6.htop 扩展

F1 或者h      #查看帮助文档
F2 或者S      #设置htop
/ 或者F3      #搜索进程
\ 或者F4      #增量进程过滤器
t 或者F5      #显示树形结构,雷士 tree 命令
F6 +,-          #按照某个指标进行排序
] 或者F7      #可提高nice值可以提高对应进程的优先级
[ 或者F8      #可减少nice值可以提高对应进程的优先级
k 或者 F9     #杀掉进程
q 或者F10     #结束htop
u               #只显示一个给定的用户的进程
H               #显示或隐藏用户线程
K               #显示或隐藏内核线程
F               #跟踪进程
P               #按CPU 使用排序
M               #按内存使用排序
T               #按Time+ 使用排序

Over~

版权协议须知!

本篇文章来源于 Uambiguous ,如本文章侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意

821 0 2021-03-22


分享:
icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif
博主卡片
林里克斯 博主大人
一个致力于Linux的运维平台
运维时间
搭建这个平台,只为分享及记载自己所遇之事和难题。

现在时间 2024-04-27

今日天气
站点统计
  • 文章总数:240篇
  • 分类总数:29个
  • 评论总数:10条
  • 本站总访问量 216552 次

@奥奥

@Wong arrhenius 牛比

@MakerFace 厉害了!