Collectl – A Powerful Tool to Collect Various Linux Performance Data

Run collectl command with no arguments

Simply run collectl command with no arguments before going deeper. By default it shows cpu, network and disk stats in brief format. Data has been logged every second and keeps growing until you exit.

# collectl
waiting for 1 second sample...
#<--------CPU--------><----------Disks-----------><----------Network---------->
#cpu sys inter  ctxsw KBRead  Reads KBWrit Writes   KBIn  PktIn  KBOut  PktOut
   5   0   507    616      1      1    141      8    128    214    116     199
  12   0  1211   1064      0      0      0      0    758    671     72     350
  11   1  1306   1277      1      1      1      1    922    849    109     486
  15   1  1324   1727      0      0      0      0    385    557    256     514
   5   0  1015    713      1      1      1      1    918    769     69     355
  13   0   843   1046      0      0      0      0    145    286    189     303

Default with verbose mode

In this mode you give up one line per interval with hostname, date, time & much more details.

# collectl --verbose
waiting for 1 second sample...

### RECORD    1 >>> 2daygeek <<< (1483576392.001) (Wed Jan  4 17:33:12 2017) ###

# CPU SUMMARY (INTR, CTXSW & PROC /sec)
# User  Nice   Sys  Wait   IRQ  Soft Steal  Idle  CPUs  Intr  Ctxsw  Proc  RunQ   Run   Avg1  Avg5 Avg15
    10     0     0     0     0     0     0    89     6  1260   1199     2   401     2   0.32  0.84  1.02

# DISK SUMMARY (/sec)
#KBRead RMerged  Reads SizeKB  KBWrite WMerged Writes SizeKB
      1       0      1      1       80      10     11      7

# NETWORK SUMMARY (/sec)
# KBIn  PktIn SizeIn  MultI   CmpI  ErrsI  KBOut PktOut  SizeO   CmpO  ErrsO
   842    807   1069      0      0      0    163    467    359      0      0

Default with Detailed mode

By default mode, it uses summary output. If you want to see more details on specific instances, use the uppercase subsystem names -sCDN instead of lowercase.

# collectl -sCDN
waiting for 1 second sample...

### RECORD    1 >>> 2daygeek <<< (1483576773.001) (Wed Jan  4 17:39:33 2017) ###

# SINGLE CPU STATISTICS
#   Cpu  User Nice  Sys Wait IRQ  Soft Steal Idle
      0    33    0    2    0    0    0     0   65
      1    54    0    4    0    0    0     0   39
      2     1    0    0    0    0    0     0   99
      3     0    0    0    0    0    0     0  100
      4     0    0    0    0    0    0     0  100
      5     0    0    0    0    0    0     0  100

# DISK STATISTICS (/sec)
#          <---------reads---------><---------writes---------><--------averages--------> Pct
#Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
sda              0      0    0    0      16      0    4    4       4     0     0      0    0
sdb              1      0    1    1       0      0    1    1       0     0     0      0    0

# NETWORK STATISTICS (/sec)
#Num    Name   KBIn  PktIn SizeIn  MultI   CmpI  ErrsI  KBOut PktOut  SizeO   CmpO ErrsO
   0   eth0:    410    593    709      0      0      0    252    534    483      0      0
   1     lo:      0      0      0      0      0      0      0      0      0      0      0

Collectl With Timestamps

To display collectl output with timestamps in each line, just add o switch with T option.

# collectl -oT
waiting for 1 second sample...
#         <--------CPU--------><----------Disks-----------><----------Network---------->
#Time     cpu sys inter  ctxsw KBRead  Reads KBWrit Writes   KBIn  PktIn  KBOut  PktOut
14:42:25    0   0   151    228      1      1     57      9      5     50      5      44
14:42:26    4   0   471    746     64      2      0      0    127    206    117     197
14:42:27   11   1  1028    842      1      1      1      1    752    640     38     310
14:42:28   22   2  1882   2042      0      0      0      0    972    976    237     666
14:42:29    9   1   961   1265      1      1      1      1    340    454    181     410
14:42:30    1   0   238    322      0      0     56      7     30     82      8      67
14:42:31   21   1  2114   2077      1      1      1      1   1564   1394    243     803
14:42:32   19   1  1494   1461      0      0      0      0    802    741    119     467

Monitor CPU usage

To print summary of CPU usage, just add -sc with collectl command.

# collectl -sc
waiting for 1 second sample...
#<--------CPU-------->
#cpu sys inter  ctxsw
   2   0   222    301
  13   1  1295   1203
  16   1  1225   1229
  23   2  2016   2061
  35   3  2944   3199
   2   0   262    320
   4   0   449    595

To print detailed CPU usage (individual CPU usage), just add -sC with collectl command.

# collectl -sC
waiting for 1 second sample...

# SINGLE CPU STATISTICS
#   Cpu  User Nice  Sys Wait IRQ  Soft Steal Idle
      0    48    0    5    0    0    1     0   44
      1    92    0    2    0    0    2     0    3
      2    10    0    2    0    0    0     0   88
      3     3    0    0    0    0    0     0   94
      4     0    0    0    0    0    0     0  100
      5     1    0    1    0    0    0     0   97
      0     7    0    2    0    0    0     0   91
      1    33    0    5    0    0    1     0   61
      2     0    0    0    0    0    0     0  100
      3     0    0    0    0    0    0     0  100
      4     2    0    1    0    0    0     0   96
      5     0    0    0    0    0    0     0  100

Monitor Memory usage

To print summary of Memory usage, just add -sm with collectl command.

# collectl -sm
waiting for 1 second sample...
#<-----------Memory----------->
#Free Buff Cach Inac Slab  Map
 615M 320M   1G   1G 596M 485M
 636M 320M   1G   1G 596M 464M
 645M 320M   1G   1G 596M 456M
 679M 320M   1G   1G 596M 423M
 679M 320M   1G   1G 596M 423M
 678M 320M   1G   1G 596M 424M
 644M 320M   1G   1G 596M 458M
 630M 320M   1G   1G 596M 471M

To print detailed Memory usage, just add -sM with collectl command.

# collectl -sM
waiting for 1 second sample...

# MEMORY STATISTICS
# Node    Total     Used     Free     Slab   Mapped     Anon   Locked    Inact HitPct
     0   16356M   11099M    5257M  350772K    5720K   10064K        0    3943M 100.00
     1   16384M    2000M   14383M   61888K    6880K   28248K        0    1350M 100.00
     0   16356M   11099M    5257M  350772K    5728K   10064K        0    3943M 100.00
     1   16384M    2000M   14383M   61888K    6880K   28248K        0    1350M 100.00
     0   16356M   11099M    5257M  350772K    5728K   10064K        0    3943M 100.00
     1   16384M    1999M   14384M   61908K    6880K   28248K        0    1350M 100.00
     0   16356M   11099M    5257M  350772K    5728K   10064K        0    3943M 100.00
     1   16384M    1999M   14384M   61908K    6880K   28248K        0    1350M 100.00

Monitor Network usage

To print summary of Network usage, just add -sn with collectl command.

# collectl -sn
waiting for 1 second sample...
#<----------Network---------->
#  KBIn  PktIn  KBOut  PktOut
    952    955    234     637
    361    478    185     426
      3     34      5      31
    128    213    116     202
    747    615     35     277
   1695   1582    274     992

To print detailed Network usage, just add -sN with collectl command.

# collectl -sN
waiting for 1 second sample...

# NETWORK STATISTICS (/sec)
#Num    Name   KBIn  PktIn SizeIn  MultI   CmpI  ErrsI  KBOut PktOut  SizeO   CmpO ErrsO
   0   eth0:    318    469    694      0      0      0    244    462    542      0      0
   1     lo:      0      0      0      0      0      0      0      0      0      0      0
   0   eth0:     20     89    233      0      0      0      9     77    129      0      0
   1     lo:      0      0      0      0      0      0      0      0      0      0      0
   0   eth0:    122    263    475      0      0      0    122    261    479      0      0
   1     lo:      0      0      0      0      0      0      0      0      0      0      0
   0   eth0:    748    637   1203      0      0      0     35    287    128      0      0
   1     lo:      0      0      0      0      0      0      0      0      0      0      0
   0   eth0:   1000   1020   1004      0      0      0    254    737    353      0      0
   1     lo:      0      0      0      0      0      0      0      0      0      0      0

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

Your email address will not be published. Required fields are marked *