dstat和glances用法总结

多功能系统资源统计工具——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常用选项

12
-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/

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值