|
|
楼主 |
发表于 2018-6-21 17:55:59
|
显示全部楼层
如想监控swap,process,sockets,filesystem并显示监控的时间:0 I" [8 N# y5 h: g
; `# v* e, s$ a5 X[root@iZ23uulau1tZ ~]# dstat -tsp --socket --fs
8 n; c2 l) W* r& H( n! K/ L! `----system---- ----swap--- ---procs--- ------sockets------ --filesystem-
7 n- `# w0 F0 d3 h# z9 ? date/time | used free|run blk new|tot tcp udp raw frg|files inodes# W- J& q2 x4 y: @) Q
26-07 09:23:48| 0 0 | 0 0 0.0|104 8 5 0 0| 704 6488% a$ X* i! n4 }) Z5 w) b: Y
26-07 09:23:49| 0 0 | 0 0 0|104 8 5 0 0| 704 6488
) N6 O( u4 i1 u6 {8 `1 Y2 E% u% M6 Q26-07 09:23:50| 0 0 | 0 0 0|104 8 5 0 0| 704 6489( S* }/ T1 O! V
26-07 09:23:51| 0 0 | 0 0 0|104 8 5 0 0| 704 6489
2 Y7 l' ^! o @" @2 r) s% N26-07 09:23:52| 0 0 | 0 0 0|104 8 5 0 0| 704 6489
! H6 F9 L' x! I26-07 09:23:53| 0 0 | 0 0 0|104 8 5 0 0| 704 6489; v' B3 b' Z7 _
若要将结果输出到文件可以加--output filename:
8 m: {& q" l& z* _3 _" v+ p
0 R/ q4 J6 e3 l* {2 y4 I[root@iZ23uulau1tZ ~]# dstat -tsp --socket --fs --output /tmp/ds.csv S. s: a c! Q
----system---- ----swap--- ---procs--- ------sockets------ --filesystem-7 d9 B" k9 ?" P8 f7 t
date/time | used free|run blk new|tot tcp udp raw frg|files inodes
* D* n. a' [0 c26-07 09:25:31| 0 0 | 0 0 0.0|104 8 5 0 0| 736 6493/ \ N! z3 h i L
26-07 09:25:32| 0 0 | 0 0 0|104 8 5 0 0| 736 64931 z% t7 a E7 k, S: H
26-07 09:25:33| 0 0 | 0 0 0|104 8 5 0 0| 736 6493* S1 D s1 V# {: y$ P
26-07 09:25:34| 0 0 | 0 0 0|104 8 5 0 0| 736 6493& z4 J: [% |0 ~
26-07 09:25:35| 0 0 | 0 0 0|104 8 5 0 0| 736 6494! x7 B$ F' t6 P' j* \( U7 i2 C
26-07 09:25:36| 0 0 | 0 0 0|104 8 5 0 0| 736 6494! B9 J0 s, O2 C+ A Y: K
这样生成的csv文件可以用excel打开,然后生成图表。
$ _1 R: Z( D+ M0 b6 X+ Y1 v) Q1 l. U. \$ y/ t, W% F3 x: {" H
通过dstat --list可以查看dstat能使用的所有参数,其中上面internal是dstat本身自带的一些监控参数,下面/usr/share/dstat中是dstat的插件,这些插件可以扩展dstat的功能,如可以监控电源(battery)、mysql等。
& @7 N7 L& m" l% E7 f0 L3 o* ^
) Y/ I( ]5 O p/ K( o7 Z0 O下面这些插件并不是都可以直接使用的,有的还依赖其他包,如想监控mysql,必须要装python连接mysql的一些包。
, O$ x7 ~2 [* ?( h- {! g" G8 @4 w" i# }/ F3 T
[root@iZ23uulau1tZ ~]# dstat --list
4 w- S: b. b2 |" ^- o2 x+ `: Jinternal:
( I3 R( I! ]; C 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
/ N& }9 B# E* j2 P/usr/share/dstat:
- y- D+ b9 g, p0 Z% h 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,4 U h1 k# L! t
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,# F; P' M* N) _$ w+ [
vm-memctl, vmk-hba, vmk-int, vmk-nic, vz-cpu, vz-io, vz-ubc, wifi |
|