웹사이트 검색

Ubuntu 18.04 LTS에서 collectl 성능 모니터링 도구 설치 및 사용


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • Ubuntu 20.04(Focal Fossa)
  • Ubuntu 18.04(Bionic Beaver)

이 페이지에서

  1. 요구 사항\n
  2. 시작하기\n
  3. 수집 설치
  4. Collectl 작업
  5. CPU, 메모리 및 디스크 사용량 모니터링
  6. 한 번에 CPU, 메모리 및 디스크 모니터링\n
  7. 결론

시스템 리소스 모니터링 및 성능 분석은 모든 시스템 관리자의 중요한 작업입니다. top, htop, free 등을 포함하여 Linux에서 시스템 성능을 모니터링하는 데 사용할 수 있는 많은 도구가 있습니다. Collectl은 무료 오픈 소스 및 경량 성능 모니터링 도구로 cpu, 디스크, 메모리, 네트워크, Infiniband, 광택, 메모리, nfs, 슬래브 등. 다른 모니터링 도구와 달리 수집은 작은 통계 집합에 중점을 둡니다. Collectl은 여러 매개변수를 동시에 모니터링하고 적절한 방식으로 보고할 수 있습니다. Collectl은 모든 종류의 시스템 성능 문제를 식별하는 데 도움이 되는 다양한 옵션을 제공합니다. collectl을 사용하면 mpstat, netstat, nfsstat, sar, ps, top 및 iostat의 동일한 출력을 생성할 수 있습니다.

특징

  • 다양한 형식으로 출력을 표시하는 기능.\n
  • 다양한 파일 형식으로 데이터를 내보냅니다.\n
  • 원격 시스템을 모니터링하는 서비스로 실행하는 기능.\n
  • 거의 모든 하위 시스템을 모니터링합니다.\n

이 튜토리얼에서는 Ubuntu 18.04 서버에 Collectl을 설치하고 사용하는 방법을 배웁니다.

요구 사항

  • Ubuntu 18.04를 실행하는 서버.\n
  • 루트 비밀번호가 서버에 설정됩니다.\n

시작하기

시작하기 전에 시스템을 최신 버전으로 업데이트해야 합니다. 다음 명령을 실행하여 이를 수행할 수 있습니다.

apt-get update -y
apt-get upgrade -y

서버가 업데이트되면 서버를 다시 시작하여 변경 사항을 적용하십시오.

콜렉트 설치

기본적으로 Collectl은 Ubuntu 18.04 기본 리포지토리에서 사용할 수 있습니다. 다음 명령을 실행하여 설치할 수 있습니다.

apt-get install collectl -y

설치가 완료되면 다음 명령을 실행하여 collectl에서 사용 가능한 모든 옵션을 나열할 수 있습니다.

collectl --h

다음 출력이 표시되어야 합니다.

This is a subset of the most common switches and even the descriptions are
abbreviated.  To see all type 'collectl -x', to get started just type 'collectl'

usage: collectl [switches]
  -c, --count      count      collect this number of samples and exit
  -f, --filename   file       name of directory/file to write to
  -i, --interval   int        collection interval in seconds [default=1]
  -o, --options    options    misc formatting options, --showoptions for all
                                d|D - include date in output
                                  T - include time in output
                                  z - turn off compression of plot files
  -p, --playback   file       playback results from 'file' (be sure to quote
			      if wild carded) or the shell might mess it up
  -P, --plot                  generate output in 'plot' format
  -s, --subsys     subsys     specify one or more subsystems [default=cdn]
      --verbose               display output in verbose format (automatically
                              selected when brief doesn't make sense)

Various types of help
  -h, --help                  print this text
  -v, --version               print version
  -V, --showdefs              print operational defaults
  -x, --helpextend            extended help, more details descriptions too
  -X, --helpall               shows all help concatenated together

  --showoptions               show all the options
  --showsubsys                show all the subsystems
  --showsubopts               show all subsystem specific options
  --showtopopts               show --top options

  --showheader                show file header that 'would be' generated
  --showcolheaders            show column headers that 'would be' generated
  --showslabaliases           for SLUB allocator, show non-root aliases
  --showrootslabs             same as --showslabaliases but use 'root' names

Copyright 2003-2016 Hewlett-Packard Development Company, L.P.
collectl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the source kit

수집 작업

이제 옵션 없이 collectl을 실행하면 CPU, 디스크 및 네트워크 통계에 대한 정보가 매우 짧고 사람이 읽을 수 있는 형식으로 표시됩니다.

collectl

다음 출력이 표시되어야 합니다.

waiting for 1 second sample...
#<--------cpu--------><----------disks-----------><----------network---------->
#cpu sys inter  ctxsw KBRead  Reads KBWrit Writes   KBIn  PktIn  KBOut  PktOut 
  17  11   503    320      4      1     20      3      0      0      0       0 
   2   1   565    165      0      0      0      0      0      2      0       2 
   6   3   545     83      0      0      0      0      0      2      0       2 
   0   0   508     39      0      0      0      0      0      2      0       2 
   1   1   517     42      0      0      0      0      0      2      0       2 
   1   1   442     37      0      0      0      0      0      2      0       2 
   1   1   538     65      0      0     20      2      0      2      0       2 
   1   1   443     39      0      0      0      0      0      2      0       2 
   1   1   409     39      0      0      0      0      0      2      0       2 
   1   1   381     38      0      0      0      0      0      2      0       2 
   1   1   451     44      0      0      0      0      0      2      0       2 
   3   2   482     42      0      0      0      0      0      2      0       2 
   9   2   528    101      0      0      0      0      0      2      0       2 
   1   1   428     39      0      0      0      0      0      2      0       2 

다음 명령을 사용하여 모든 하위 시스템에 대한 통계를 나열할 수도 있습니다.

collectl --all

산출:

waiting for 1 second sample...
#<--------cpu--------><-----------------memory-----------------><----------disks-----------><----------network----------><-------tcp--------><------sockets-----><----files---><------nfs totals------="">
#cpu sys inter  ctxsw Cpu0 Free Buff Cach Inac Slab  Map   Fragments KBRead  Reads KBWrit Writes   KBIn  PktIn  KBOut  PktOut   IP  Tcp  Udp Icmp  Tcp  Udp  Raw Frag Handle Inodes  Reads Writes Meta Comm 
   3   0   459     48  459 139M  63M 573M 413M  93M 136M jibaa4a59ab      0      0      0      0      0      0      0       0    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
  12   7   528    142  530 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      1       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   3   1   477     57  477 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   5   2   437     55  435 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   1   0   426     43  426 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   4   1   435     54  435 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44711      0      0    0    0 
   4   2   471     49  472 139M  63M 573M 413M  93M 136M jhbaa5959ab      0      0      0      0      0      2      0       2    0    0    0    0  144    0    0    0   1088  44712      0      0    0    0 

아래와 같이 --top 옵션과 함께 collectl 명령을 사용할 수도 있습니다.

collectl --top

산출:

# TOP PROCESSES sorted by time (counters are /sec) 14:14:24
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
 5194  root     20  1233    0 R   66M   27M  0  0.06  0.13  19  00:02.79    0    0    0    0 /usr/bin/perl 
    8  root     20     2    0 I     0     0  0  0.01  0.00   1  00:01.86    0    0    0    0 rcu_sched 
 1165  root     20   866    0 S  103M    7M  0  0.01  0.00   1  00:05.00    0    0    0    0 sshd: 
 3593  root     20     2    0 I     0     0  0  0.01  0.00   1  00:01.45    0    0    0    0 kworker/0:0 
    1  root     20     0    0 S   76M    9M  0  0.00  0.00   0  00:10.28    0    0    0    0 /sbin/init 
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd 
    4  root      0     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kworker/0:0H 
    6  root      0     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 mm_percpu_wq 
    7  root     20     2    0 S     0     0  0  0.00  0.00   0  00:02.75    0    0    0    0 ksoftirqd/0 
    9  root     20     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 rcu_bh 
   10  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0 
   11  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.03    0    0    0    0 watchdog/0 
   12  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 cpuhp/0 
   13  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kdevtmpfs 
   14  root      0     2    0 I     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 netns 
   15  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 rcu_tasks_kthre 
   16  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kauditd 

CPU, 메모리 및 디스크 사용량 모니터링

-sc 옵션과 함께 collectl을 실행하여 CPU 사용량을 모니터링할 수 있습니다.

collectl -sc

산출:

waiting for 1 second sample...
#<--------cpu-------->
#cpu sys inter  ctxsw 
   1   1   461     35 
   2   2   631     71 
  11   0   472    109 
   1   1   552     48 
   1   1   457     39 
   0   0   566     46 
   5   3   572    101 
   0   0   543     38 
   1   1   445     40 
   1   1   591     43 
   1   1   441     36 
   0   0   565     51 

다음 명령을 사용하여 CPU 사용량에 대한 세부 정보를 볼 수도 있습니다.

collectl -sC

산출:

waiting for 1 second sample...

# SINGLE CPU STATISTICS
#   Cpu  User Nice  Sys Wait IRQ  Soft Steal Guest NiceG Idle
      0     2    0    3    0    0    0     0     0     0   94
      0     0    0    1    0    0    0     0     0     0   98
      0     0    0    1    0    0    0     0     0     0   98
      0     0    0    0    0    0    1     0     0     0   98
      0     0    0    0    0    0    0     0     0     0  100
      0     0    0    0    0    0    0     0     0     0  100
      0     1    0    1    0    0    0     0     0     0   97
      0     0    0    0    0    0    0     0     0     0  100
      0     0    0    1    1    0    1     0     0     0   96
      0     0    0    0    0    0    0     0     0     0  100
      0     0    0    1    0    0    0     0     0     0   98

시스템의 메모리 사용량을 모니터링하려면 다음 명령을 실행하십시오.

collectl -sm

산출:

waiting for 1 second sample...
#<-----------memory----------->
#Free Buff Cach Inac Slab  Map 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 
 139M  63M 573M 413M  93M 136M 

다음 명령을 사용하여 세부 정보로 메모리 사용량을 모니터링합니다.

collectl -sM

산출:

waiting for 1 second sample...

# MEMORY STATISTICS 
# Node    Total     Used     Free     Slab   Mapped     Anon    AnonH   Locked    Inact HitPct
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866844K  142800K   95928K   46160K   93416K        0    5408K  423952K 100.00
     0     985M  866968K  142676K   95928K   46160K   93416K        0    5408K  423952K 100.00

다음 명령을 사용하여 디스크 사용량을 모니터링할 수 있습니다.

collectl -sd

산출:

waiting for 1 second sample...
#<----------disks----------->
#KBRead  Reads KBWrit Writes 
      0      0      0      0 
      0      0      0      0 
      0      0      0      0 
      0      0      0      0 
      0      0      0      0 
      0      0      8      0 
      0      0      0      2

다음 명령을 사용하여 세부 정보로 디스크 사용량을 모니터링합니다.

collectl -sD

산출:

waiting for 1 second sample...

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

CPU, 메모리 및 디스크를 한 번에 모니터링

단일 명령을 실행하여 CPU, 메모리 및 디스크 사용량을 모니터링할 수 있습니다.

collectl -scmd

산출:

waiting for 1 second sample...
#<--------cpu--------><-----------memory-----------><----------disks----------->
#cpu sys inter  ctxsw Free Buff Cach Inac Slab  Map KBRead  Reads KBWrit Writes 
   1   0   518     43 140M  63M 573M 413M  93M 135M      0      0      0      0 
   7   2   509    104 140M  63M 573M 413M  93M 135M      0      0     20      1 
   3   1   518     52 140M  63M 573M 413M  93M 135M      0      0      0      0 
   1   1   445     43 140M  63M 573M 413M  93M 135M      0      0      0      0 
   2   1   482     51 140M  63M 573M 413M  93M 135M      0      0      0      0 
   1   1   535     56 140M  63M 573M 413M  93M 135M      0      0      0      0 
   3   1   499     48 140M  63M 573M 413M  93M 135M      0      0      0      0 
   2   1   482     53 140M  63M 573M 413M  93M 135M      0      0     20      2 

결론

위의 기사에서 나는 collectl에 대한 간략한 개요를 제공했습니다. Collectl에는 Linux 시스템을 쉽게 모니터링할 수 있는 많은 옵션이 있습니다.