Linux系统之dool命令行工具的基本使用

简介: Linux系统之dool命令行工具的基本使用

一、dool命令行工具介绍

Dool 是一个命令行工具,用于监控系统的许多方面:CPU、内存、网络、平均负载等。它还包括一个强大的插件架构,可以监控其他系统指标。

二、本地系统环境检查

1.检查系统版本

[root@jeven ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

2.检查系统内核版本

[root@jeven ~]# uname -r 
6.1.8-1.el7.elrepo.x86_64

三、下载dool软件包

1.创建下载目录

[root@jeven ~]# mkdir -p /data/dool
[root@jeven ~]# cd /data/dool
[root@jeven dool]#

2.下载dool

https://github.com/scottchiefbaker/dool.git

四、安装dool

1.安装python3

yum -y install python3

2.安装dool

[root@jeven dool]# cd dool/
[root@jeven dool]# ls
AUTHORS  ChangeLog  COPYING  docs  dool  examples  install.py  Makefile  packaging  plugins  README.md
[root@jeven dool]# python3 install.py 
You are root, doing a local install

Installing binaries to /usr/bin/
Installing plugins  to /usr/share/dool/
Installing manpages to /usr/share/man/man1/

Install complete. Dool installed to /usr/bin/dool

五、dool的命令帮助

[root@jeven dool]# dool --help
Usage: dool [options] [delay] [count]

Versatile tool for generating system resource statistics

Dool options:
  -c, --cpu                enable cpu stats
     -C 0,3,total             include cpu0, cpu3 and total
  -d, --disk               enable disk stats
     -D total,hda             include hda and total
  -g, --page               enable page stats
  -i, --int                enable interrupt stats
     -I 5,eth2                include int5 and interrupt used by eth2
  -l, --load               enable load stats
  -m, --mem                enable memory stats
  -n, --net                enable network stats
     -N eth1,total            include eth1 and total
  -p, --proc               enable process stats
  -r, --io                 enable io stats (I/O requests completed)
  -s, --swap               enable swap stats
     -S swap1,total           include swap1 and total
  -t, --time               enable time/date output
  -T, --epoch              enable time counter (seconds since epoch)
  -y, --sys                enable system stats

  --aio                    enable aio stats
  --fs, --filesystem       enable fs stats
  --ipc                    enable ipc stats
  --lock                   enable lock stats
  --raw                    enable raw stats
  --socket                 enable socket stats
  --tcp                    enable tcp stats
  --udp                    enable udp stats
  --unix                   enable unix stats
  --vm                     enable vm stats
  --vm-adv                 enable advanced vm stats
  --zones                  enable zoneinfo stats

  --list                   list all available plugins
  --<plugin-name>          enable external plugin by name (see --list)

  --defaults               equals -cdnlt
  --more                   equals -cdnmplt
  -a, --all                equals -cdngmyplt
  -f, --full               automatically expand -C, -D, -I, -N and -S lists
  -v, --vmstat             equals -pmgdsc -D total

  --bits                   force bits for values expressed in bytes
  --bytes                  force bytes for output measurements
  --float                  force float values on screen
  --integer                force integer values on screen

  --bw, --black-on-white   change colors for white background terminal
  --color                  force colors
  --nocolor                disable colors
  --noheaders              disable repetitive headers
  --noupdate               disable intermediate updates
  --output file            write CSV output to file
  --profile                show profiling statistics when exiting dool
  --ascii                  output table in ascii not unicode box drawing

delay is the delay in seconds between each update (default: 1)
count is the number of updates to display before exiting (default: unlimited)

六、dool的基本使用

1.直接使用dool监控系统

[root@jeven dool]# dool
Using default plugins: cpu, disk, net, load
┄┄total┄cpu┄usage┄┄┬┄dsk/total┄┬┄net/total┄┬┄┄┄load┄avg┄┄┄┬┄┄┄┄┄system┄┄┄┄
usr sys idl wai stl│ read  writ│ recv  send│ 1m   5m  15m │      time     
  0   0  99   0   0│ 373K 1639K│   0     0 │0.05 0.09 0.06│Feb-11 12:08:29
  0   0 100   0   0│   0     0 │ 960B 8816B│0.05 0.09 0.06│Feb-11 12:08:30
  0   1  99   0   0│   0     0 │ 960B 3440B│0.05 0.09 0.06│Feb-11 12:08:31
  0   0 100   0   0│   0     0 │ 480B 2960B│0.05 0.09 0.06│Feb-11 12:08:32
  0   0 100   0   0│   0     0 │ 480B 2960B│0.05 0.09 0.06│Feb-11 12:08:33
  0   0 100   0   0│   0    66K│ 480B 2960B│0.04 0.09 0.06│Feb-11 12:08:34
  0   0 100   0   0│   0     0 │ 960B 3088B│0.04 0.09 0.06│Feb-11 12:08:35
  0   0 100   0   0│   0     0 │1440B 3440B│0.04 0.09 0.06│Feb-11 12:08:36
  0   0 100   0   0│   0     0 │2016B 4016B│0.04 0.09 0.06│Feb-11 12:08:37
  0   0 100   0   0│   0     0 │5392B 2960B│0.04 0.09 0.06│Feb-11 12:08:38
  0   1  99   0   0│   0   131K│5392B 2960B│0.04 0.09 0.06│Feb-11 12:08:39
  0   0 100   0   0│   0     0 │ 960B 3088B│0.04 0.09 0.06│Feb-11 12:08:40
  0   0 100   0   0│   0     0 │  15K 7664B│0.04 0.09 0.06│Feb-11 12:08:41
  0   0 100   0   0│   0     0 │1632B 4352B│0.04 0.09 0.06│Feb-11 12:08:42
  0   0 100   0   0│   0     0 │ 960B 2960B│0.04 0.09 0.06│Feb-11 12:08:43
  0   1  99   0   0│   0    98K│ 960B 2960B│0.04 0.09 0.06│Feb-11 12:08:44
  0   0 100   0   0│   0     0 │1448B 3744B│0.04 0.09 0.06│Feb-11 12:08:45
  1   0  99   0   0│   0     0 │ 960B 3440B│0.04 0.09 0.06│Feb-11 12:08:46
  0   0 100   0   0│   0     0 │ 480B 2960B│0.04 0.09 0.06│Feb-11 12:08:47
  0   0  99   0   0│   0     0 │2488B 3680B│0.04 0.09 0.06│Feb-11 12:08:48
  1   0  99   0   0│   0     0 │ 480B 2960B│0.03 0.08 0.06│Feb-11 12:08:49
  0   1  99   0   0│   0  1860K│ 480B 3680B│0.03 0.08 0.06│Feb-11 12:08:50
  0   1  99   0   0│   0     0 │2352B 4608B│0.03 0.08 0.06│Feb-11 12:08:51
  0   0 100   0   0│   0     0 │ 480B 4000B│0.03 0.08 0.06│Feb-11 12:08:52
  0   0 100   0   0│   0     0 │ 480B 2960B│0.03 0.08 0.06│Feb-11 12:08:53
  0   1  99   0   0│   0     0 │1536B 4016B│0.03 0.08 0.06│Feb-11 12:08:54
  0   0 100   0   0│   0     0 │ 960B 2960B│0.03 0.08 0.06│Feb-11 12:08:55^

2.监控cpu和网络接口

  • 显示CPU使用情况和每个网络接口
dool --cpu --net --time --full 15

3.监控内存和磁盘

  • 显示磁盘情况和内存占用
[root@jeven dool]# dool --disk --mem 5 
┄dsk/total┄┬┄┄┄┄┄┄memory┄usage┄┄┄┄┄
 read  writ│ used  free  cach  avai
 371K 1632K│3511M  144M 3570M 4069M
   0    20K│3511M  144M 3570M 4069M
   0    26K│3511M  144M 3570M 4069M
   0    83K│3490M  165M 3570M 4090M
   0     0 │3491M  164M 3570M 4089M
   0  6554B│3490M  165M 3570M 4090M
   0     0 │3493M  162M 3570M 4087M
   0  6554B│3507M  148M 3570M 4073M
   0    26K│3507M  148M 3570M 4073M

4.监控cpu/负载/swap

  • 监控cpu/负载/swap情况
[root@jeven dool]# dool --cpu --load --swap --time 60
┄┄total┄cpu┄usage┄┄┬┄┄┄load┄avg┄┄┄┬┄┄┄┄swap┄┄┄┬┄┄┄┄┄system┄┄┄┄
usr sys idl wai stl│ 1m   5m  15m │ used  free│      time     
  0   0  99   0   0│0.02 0.05 0.05│4612K 2039M│Feb-11 12:15:48
相关文章
|
26天前
|
Ubuntu Linux
计算机基础知识:linux系统怎么安装?
在虚拟机软件中创建一个新的虚拟机,并选择相应操作系统类型和硬盘空间大小等参数。将下载的 ISO 镜像文件加载到虚拟机中。启动虚拟机,进入安装界面,并按照步骤进行安装。安装完成后,可以在虚拟机中使用 Linux 系统。
|
12天前
|
缓存 监控 Linux
Linux系统清理缓存(buff/cache)的有效方法。
总结而言,在大多数情形下你不必担心Linux中buffer与cache占用过多内存在影响到其他程序运行;因为当程序请求更多内存在没有足够可用资源时,Linux会自行调整其占有量。只有当你明确知道当前环境与需求并希望立即回收这部分资源给即将运行重负载任务之前才考虑上述方法去主动干预。
176 10
|
16天前
|
安全 Linux 数据安全/隐私保护
为Linux系统的普通账户授予sudo访问权限的过程
完成上述步骤后,你提升的用户就能够使用 `sudo`命令来执行管理员级别的操作,而无需切换到root用户。这是一种更加安全和便捷的权限管理方式,因为它能够留下完整的权限使用记录,并以最小权限的方式工作。需要注意的是,随意授予sudo权限可能会使系统暴露在风险之中,尤其是在用户不了解其所执行命令可能带来的后果的情况下。所以在配置sudo权限时,必须谨慎行事。
129 0
|
26天前
|
Ubuntu Linux 开发者
国产 Linux 发行版再添新成员,CutefishOS 系统简单体验
当然,系统生态构建过程并不简单,不过为了帮助国产操作系统优化生态圈,部分企业也开始用国产操作系统替代 Windows,我们相信肯定会有越来越多的精品软件登录 Linux 平台。
63 0
|
26天前
|
Ubuntu 安全 Linux
Linux系统入门指南:从零开始学习Linux
Shell脚本是一种强大的自动化工具,可以帮助您简化重复的任务或创建复杂的脚本程序。了解Shell脚本的基本语法和常用命令,以及编写和运行Shell脚本的步骤,将使您更高效地处理日常任务。
98 0
|
26天前
|
Ubuntu Linux 图形学
Linux学习之Linux桌面系统有哪些?
Cinnamon:与MATE类似,Cinnamon 拥有 GNOME 和 Unity 等其它桌面环境所没有的种种功能,是高度可定制的桌面环境,不需要任何外部插件、窗口组件和调整工具来定制桌面。
41 0
|
26天前
|
Ubuntu 安全 Linux
十款常用Linux系统介绍
本文不是什么大盘点。市面上有好几百款发行版,每款发行版在某个方面都与众不同。不可能在此全部罗列,本文只罗列了十款最常见的Linux发行版(世界上只有两种人,一种是懂二进制的,另一种是不懂二进制的)。请宣传Linux的魅力或威力。
|
2月前
|
监控 Linux 网络安全
Linux命令大全:从入门到精通
日常使用的linux命令整理
581 13
|
3月前
|
Linux 网络安全 数据安全/隐私保护
使用Linux系统的mount命令挂载远程服务器的文件夹。
如此一来,你就完成了一次从你的Linux发车站到远程服务器文件夹的有趣旅行。在这个技术之旅中,你既探索了新地方,也学到了如何桥接不同系统之间的距离。
346 21
|
3月前
|
JSON 自然语言处理 Linux
linux命令—tree
tree是一款强大的Linux命令行工具,用于以树状结构递归展示目录和文件,直观呈现层级关系。支持多种功能,如过滤、排序、权限显示及格式化输出等。安装方法因系统而异常用场景包括:基础用法(显示当前或指定目录结构)、核心参数应用(如层级控制-L、隐藏文件显示-a、完整路径输出-f)以及进阶操作(如磁盘空间分析--du、结合grep过滤内容、生成JSON格式列表-J等)。此外,还可生成网站目录结构图并导出为HTML文件。注意事项:使用Tab键补全路径避免错误;超大目录建议限制遍历层数;脚本中推荐禁用统计信息以优化性能。更多详情可查阅手册mantree。
linux命令—tree