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
相关文章
|
7月前
|
Ubuntu Linux Anolis
Linux系统禁用swap
本文介绍了在新版本Linux系统(如Ubuntu 20.04+、CentOS Stream、openEuler等)中禁用swap的两种方法。传统通过注释/etc/fstab中swap行的方式已失效,现需使用systemd管理swap.target服务或在/etc/fstab中添加noauto参数实现禁用。方法1通过屏蔽swap.target适用于新版系统,方法2通过修改fstab挂载选项更通用,兼容所有系统。
611 3
Linux系统禁用swap
|
7月前
|
Linux
Linux系统修改网卡名为eth0、eth1
在Linux系统中,可通过修改GRUB配置和创建Udev规则或使用systemd链接文件,将网卡名改为`eth0`、`eth1`等传统命名方式,适用于多种发行版并支持多网卡配置。
1142 3
|
Ubuntu Linux 网络安全
Linux系统初始化脚本
一款支持Rocky、CentOS、Ubuntu、Debian、openEuler等主流Linux发行版的系统初始化Shell脚本,涵盖网络配置、主机名设置、镜像源更换、安全加固等多项功能,适配单/双网卡环境,支持UEFI引导,提供多版本下载与持续更新。
713 3
Linux系统初始化脚本
|
8月前
|
运维 Linux 开发者
Linux系统中使用Python的ping3库进行网络连通性测试
以上步骤展示了如何利用 Python 的 `ping3` 库来检测网络连通性,并且提供了基本错误处理方法以确保程序能够优雅地处理各种意外情形。通过简洁明快、易读易懂、实操性强等特点使得该方法非常适合开发者或系统管理员快速集成至自动化工具链之内进行日常运维任务之需求满足。
542 18
|
7月前
|
安全 Linux Shell
Linux系统提权方式全面总结:从基础到高级攻防技术
本文全面总结Linux系统提权技术,涵盖权限体系、配置错误、漏洞利用、密码攻击等方法,帮助安全研究人员掌握攻防技术,提升系统防护能力。
812 1
|
7月前
|
监控 安全 Linux
Linux系统提权之计划任务(Cron Jobs)提权
在Linux系统中,计划任务(Cron Jobs)常用于定时执行脚本或命令。若配置不当,攻击者可利用其提权至root权限。常见漏洞包括可写的Cron脚本、目录、通配符注入及PATH变量劫持。攻击者通过修改脚本、创建恶意任务或注入命令实现提权。系统管理员应遵循最小权限原则、使用绝对路径、避免通配符、设置安全PATH并定期审计,以防范此类攻击。
1235 1
|
8月前
|
缓存 监控 Linux
Linux系统清理缓存(buff/cache)的有效方法。
总结而言,在大多数情形下你不必担心Linux中buffer与cache占用过多内存在影响到其他程序运行;因为当程序请求更多内存在没有足够可用资源时,Linux会自行调整其占有量。只有当你明确知道当前环境与需求并希望立即回收这部分资源给即将运行重负载任务之前才考虑上述方法去主动干预。
2134 10
|
缓存 Linux 测试技术
安装【银河麒麟V10】linux系统--并挂载镜像
安装【银河麒麟V10】linux系统--并挂载镜像
8220 0
|
关系型数据库 MySQL Linux
卸载、下载、安装mysql(Linux系统centos7)
卸载、下载、安装mysql(Linux系统centos7)
562 0
|
Linux
手把手教会你安装Linux系统
手把手教会你安装Linux系统
345 0

热门文章

最新文章