多功能系统资源统计工具——dstat
- 综合了vmstat,iostat,ifstat,netstat等工具的功能
- 实时显示监控数据
- 在做问题分析和故障排查的时候,可以监控最重要的计数器,也可以针对计数器进行排序。
- 模块化设计
- 使用Python语言编写,更方便拓展现有的工作任务
- 容易扩展,便于添加自定义计算器
- 包含许多的扩展插件
- 可以分组统计快设备,网络设备,并给出汇总信息
- 可以显示每台设备的中断信息
- 非常准确的时间精度
- 准确的显示单位
- 可读性强
支持CSV格式转出
yum y install dstat
dstat --version
# dstat --version
Dstat 0.7.0
Written by Dag Wieers <dag@wieers.com>
Homepage at http://dag.wieers.com/home-made/dstat/
Platform posix/linux2
Kernel 2.6.32-642.13.1.el6.x86_64
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
Terminal type: xterm (color support)
Terminal size: 33 lines, 191 columns
Processors: 1
Pagesize: 4096
Clock ticks per secs: 100
internal:
aio, cpu, cpu24, disk, disk24, disk24old, epoch, fs, int, int24, io, ipc, load, lock, mem, net, page, page24, proc, raw, socket, swap, swapold, sys, tcp, time, udp, unix, vm
/usr/share/dstat:
battery, battery-remain, cpufreq, dbus, disk-util, fan, freespace, gpfs, gpfs-ops, helloworld, innodb-buffer, innodb-io, innodb-ops, lustre, memcache-hits, mysql-io, mysql-keys,
mysql5-cmds, mysql5-conn, mysql5-io, mysql5-keys, net-packets, nfs3, nfs3-ops, nfsd3, nfsd3-ops, ntp, postfix, power, proc-count, rpc, rpcd, sendmail, snooze, thermal, top-bio,
top-cpu, top-cputime, top-cputime-avg, top-io, top-latency, top-latency-avg, top-mem, top-oom, utmp, vm-memctl, vmk-hba, vmk-int, vmk-nic, vz-cpu, vz-io, vz-ubc, wifi
dstat --help
dstat --list
dstat常用选项
1 | 2 |
---|---|
-c | 显示CPU状态,包括执行用户代码(usr)、执行系统代码(sys)、空闲(idl)、等待(wai) |
-d | 显示磁盘的读写状况,在进行性能测试的时候,观察磁盘的负载情况 |
-n | 网络设备的收发和接收的数据,这一栏显示网络收发计数的总和 |
-g | 表示换页活动,如果不为0,则表示内存不够用 |
-y | 系统统计,显示中断(int)和上下文切换(CSW) |
-t | 显示统计系统的当前时间 |
-l | 统计系统的负载情况 |
-p | 统计系统的进程信息,包括runnable,blocked,new的进程数量 |
–tcp | 显示通用的TCP统计 |
–fs | 统计文件的打开数 |
指定时间间隔和运行次数
$dstat 2 10
每两秒执行以此,执行10次后退出
导出到CSV文件
dstat -a --output dstat_output.csv
1 "Dstat 0.7.0 CSV output"
2 "Author:","Dag Wieers <dag@wieers.com>",,,,"URL:","http://dag.wieers.com/home-made/dstat/"
3 "Host:","iZtoz99sjuwqcnZ",,,,"User:","root"
4 "Cmdline:","dstat -a --output dstat_output.csv",,,,"Date:","30 Apr 2018 12:01:26 CST"
5
6 "total cpu usage",,,,,,"dsk/total",,"net/total",,"paging",,"system",
7 "usr","sys","idl","wai","hiq","siq","read","writ","recv","send","in","out","int","csw"
8 0.041,0.066,99.853,0.031,0.000,0.009,3018.097,1782.191,0.0,0.0,0.0,0.0,74.125,162.737
9 0.0,0.990,99.010,0.0,0.0,0.0,0.0,0.0,40.0,826.0,0.0,0.0,81.0,169.0
10 1.0,0.0,99.0,0.0,0.0,0.0,0.0,0.0,40.0,346.0,0.0,0.0,82.0,170.0
11 0.0,0.0,100.0,0.0,0.0,0.0,0.0,0.0,92.0,692.0,0.0,0.0,83.0,170.0
12 0.0,0.0,100.0,0.0,0.0,0.0,0.0,0.0,40.0,346.0,0.0,0.0,83.0,175.0
13 0.0,0.0,100.0,0.0,0.0,0.0,0.0,0.0,40.0,346.0,0.0,0.0,82.0,170.0
glances
glances是一个交互性的系统监视软件
它具有很强的跨平台性
如果你有安装Bottle的化,还可以使用web,来检测服务器数据
[root@iZtoz99sjuwqcnZ python]# glances -w
Glances web server started on http://0.0.0.0:61208/