700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Linux监控进程的iops linux性能监控工具--Collectl

Linux监控进程的iops linux性能监控工具--Collectl

时间:2020-04-18 18:56:34

相关推荐

Linux监控进程的iops linux性能监控工具--Collectl

简介:

Collectl是一个非常好的linux性能监控工具,通过Collectl能监控的东西很多,像cpu、内存、磁盘、进程、网络、nfs、tcp、socket等。

安装:

本人的一贯想法,在安装linux的软件时能用软件包安装的尽量用软件包来安装,方便快捷。

[root@server_32 ~]# yum search collectl

使用示例:

Collectl监控的东西很多,相应的,可用的参数和选项也很多,详细可以用man colloect来看一下。

(1)什么参数都不带,则每隔一秒输出cpu、磁盘、网络的简短信息

[root@cfserver ~]# collectl

waiting for 1 second sample...

#

#cpu sys inter ctxsw KBRead Reads KBWrit Writes KBIn PktIn KBOut PktOut

25 24 1104 1061 0 0 0 0 3 22 8 21

25 24 1101 909 48 2 12 2 2 24 3 21

25 24 1144 1163 0 0 0 0 6 46 11 46

(2)监控cpu

[root@cfserver ~]# collectl -scj --top

-s表示要监控子系统,c/j表示要监控的子系统为cpu和cpu中断,在监控子系统的选项中,使用小写表输出简单信息,大写则输入详细信息。

waiting for 1 second sample...

#

#cpu sys inter ctxsw Cpu0 Cpu1 Cpu2 Cpu3

25 24 1087 910 2086 999 1000 999

26 24 1149 1265 2149 1000 1001 1000

25 24 1129 1150 2129 1001 1000 1001

[root@cfserver ~]# collectl -sCj --top #top选项,像系统top那样实时显示

### RECORD 47 >>> cfserver <<< (1326248562.002) (Wed Jan 11 10:22:42 ) ###

# SINGLE CPU STATISTICS

# Cpu User Nice Sys Wait IRQ Soft Steal Idle INTRPT

0 1 0 1 0 0 0 0 98 2068

1 4 0 1 0 0 0 0 95 1000

2 3 0 12 0 0 0 0 85 1000

3 2 0 86 0 0 0 0 11 1001

# TOP PROCESSES sorted by time (counters are /sec) 10:22:42

# PID User PR PPID THRD S VSZ RSS CP SysT UsrT Pct AccuTime MajF MinF Command

31489 daemon 25 3533 0 R 169M 14M 3 0.97 0.02 99 30149:05 0 0 /usr/local/apache/bin/httpd

9445 root 18 5421 0 R 112M 18M 2 0.02 0.04 6 0:03.04 0 0 /usr/bin/perl

13963 mysql 15 13892 11 S 1G 175M 2 0.00 0.01 1 102:17.84 0 0 /usr/local/mysql/libexec/mysqld

19673 daemon 16 3533 0 S 163M 8M 0 0.00 0.01 1 0:26.90 0 1 /usr/local/apache/bin/httpd

1 root 15 0 0 S 10M 576K 3 0.00 0.00 0 39:45.59 0 0 init

2 root RT 1 0 S 0 0 0 0.00 0.00 0 1:49.38 0 0 migration/0

3 root 34 1 0 S 0 0 0 0.00 0.00 0 4:28.79 0 0 ksoftirqd/0

4 root RT 1 0 S 0 0 0 0.00 0.00 0 0:00.00 0 0 watchdog/0

5 root RT 1 0 S 0 0 1 0.00 0.00 0 1:44.35 0 0 migration/1

6 root 34 1 0 S 0 0 1 0.00 0.00 0 0:46.23 0 0 ksoftirqd/1

7 root RT 1 0 S 0 0 1 0.00 0.00 0 0:00.00 0 0 watchdog/1

8 root RT 1 0 S 0 0 2 0.00 0.00 0 2:13.13 0 0 migration/2

9 root 34 1 0 S 0 0 2 0.00 0.00 0 0:04.87 0 0 ksoftirqd/2

10 root RT 1 0 S 0 0 2 0.00 0.00 0 0:00.00 0 0 watchdog/2

(3)监控磁盘

[root@cfserver ~]# collectl -sD

waiting for 1 second sample...

# DISK STATISTICS (/sec)

#Pct

#Name KBytes Merged IOs Size KBytes Merged IOs Size RWSize QLen Wait SvcTim Util

sda 000 0 00 0 000 0 0 0

sdb 000 000 0 000 0 0 0

hda 000 000 0 000 0 0 0

sda 000 0 1612 97 337 5480 186 2 73

可以看到主要为写操作,且全部发生在sda,我们可以过滤一下

[root@cfserver ~]# collectl -sD --dskfilt sda #可以多个,如^sd,dm包含sd开头及dm的磁盘

waiting for 1 second sample...

# DISK STATISTICS (/sec)

# Pct

#Name KBytes Merged IOs Size KBytes Merged IOs Size RWSize QLen Wait SvcTim Util

sda00 0 0 19 443 44 88 2422 97

sda00 0 0 552 103 35 1615 0 222 7

sda 00 0 0243 3 880 7 7 2

从上面看到sda有一次IOPS为443,等待wait为242,可以说磁盘IO是有一些问题的。

(4)监控内存

[root@cfserver ~]# collectl -sM

waiting for 1 second sample...

# MEMORY STATISTICS

# Node Total Used Free Slab Mapped Anon Inact Hit%

0 4023M 3422M 615488K 171212K 33980K 2539M 267728K 0

0 4023M 3422M 615488K 171212K 33984K 2539M 267728K 0

0 4023M 3422M 615488K 171212K 33984K 2539M 267732K 0

(5)监控进程

[root@cfserver data]# collectl -sZ --procfilt Cnginx --procopts c #监控nginx进程

waiting for 60 second sample...

# PROCESS SUMMARY (counters are /sec)

# PID User PR PPID THRD S VSZ RSS CP SysT UsrT Pct AccuTime MajF MinF Command

4798 root 21 1 0 S 36M 4M 2 0.00 0.00 0 132:01.89 0 0 nginx:

29298 nobody 15 4798 0 S 41M 8M 0 0.03 0.03 0 4:29.77 0 0 nginx:

29299 nobody 15 4798 0 S 41M 8M 3 0.00 0.00 0 4:28.23 0 0 nginx:

29300 nobody 15 4798 0 S 41M 8M 0 0.00 0.00 0 4:43.83 0 0 nginx:

29301 nobody 15 4798 0 S 41M 8M 0 0.00 0.00 0 4:19.98 0 0 nginx:

简单介绍到这,上面示例只是collectl冰山中很小的一角,更多用法可到官网看看文档。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。