본문 바로가기

리눅스

리눅스 dstat 명령어

728x90

dstat 설치 및 사용 방법

dstat은 리눅스 및 유닉스 시스템에서 시스템 리소스 및 성능을 모니터링하기 위한 다목적 툴입니다. dstat은 다양한 시스템 리소스 및 성능 지표를 실시간으로 수집하고 표시합니다.

dstat 설치

dstat은 대부분의 리눅스 배포판의 패키지 관리자를 통해 설치할 수 있습니다.

yum install -y dstat

다른 배포판에서는 해당 배포판의 패키지 관리자를 사용하여 dstat을 설치하면 됩니다.

dstat 명령어 사용 방법

  • CPU 사용률 모니터링:
dstat -c
  • 메모리 사용량 및 스왑 모니터링:
dstat -m -s
  • 디스크 I/O 모니터링:
dstat -d
  • 네트워크 트래픽 모니터링:
dstat -n
  • 프로세스 상태 및 로드 모니터링:
dstat -p -l

위의 예시에서 사용된 옵션은 dstat의 다양한 기능을 나타내며, 자세한 내용은 man dstat 명령어를 사용하여 매뉴얼 페이지를 확인할 수 있습니다.

 

dstat

728x90

 

dstat -tcdml

dstat -tcdml 명령어는 dstat을 실행하여 시간, CPU, 디스크, 메모리 및 로드에 대한 정보를 실시간으로 표시하는 명령어입니다. 각 옵션의 의미는 다음과 같습니다.

  • -t: 시간 정보를 포함하여 출력합니다.
  • -c: CPU 사용률 및 통계를 표시합니다.
  • -d: 디스크 I/O 통계를 표시합니다.
  • -m: 메모리 사용량 및 통계를 표시합니다.
  • -l: 로드 평균 및 통계를 표시합니다.

따라서, 위의 명령어를 실행하면 시간, CPU 사용률, 디스크 I/O, 메모리 사용량 및 로드에 대한 정보가 실시간으로 표시됩니다. 이를 통해 시스템의 성능 및 리소스 사용 상태를 모니터링할 수 있습니다.

dstat -tal --top-io --top-cpu --top-mem

dstat -tal --top-io --top-cpu --top-mem 명령어는 dstat을 실행하여 시간, 로드, I/O 상위 프로세스, CPU 상위 프로세스, 메모리 상위 프로세스에 대한 정보를 표시하는 명령어입니다. 각 옵션의 의미는 다음과 같습니다.

  • -t: 시간 정보를 포함하여 출력합니다.
  • -a: 모든 상태를 표시합니다. (CPU, 디스크, 메모리 등)
  • -l: 로드 평균과 상위 프로세스를 표시합니다.
  • --top-io: I/O 활동이 가장 많은 프로세스를 표시합니다.
  • --top-cpu: CPU 사용량이 가장 높은 프로세스를 표시합니다.
  • --top-mem: 메모리 사용량이 가장 높은 프로세스를 표시합니다.

위의 명령어를 실행하면 시간, 로드 평균, I/O 상위 프로세스, CPU 상위 프로세스, 메모리 상위 프로세스에 대한 정보가 실시간으로 표시됩니다. 이를 통해 시스템의 성능, I/O 활동, CPU 사용량, 메모리 사용량 등을 모니터링하고 관련 프로세스를 확인할 수 있습니다.

 

dstat은 실시간으로 시스템 리소스 및 성능 지표를 모니터링하므로 시스템 상태를 신속하게 파악하고 성능 이슈를 식별하는 데 도움이 됩니다. 다양한 옵션을 사용하여 필요한 정보를 선택적으로 표시할 수 있으며, 스크립트와 함께 사용하여 성능 데이터를 수집하고 분석하는 등의 용도로 활용할 수 있습니다.

 

위의 예시에서 사용된 옵션은 dstat의 다양한 기능을 나타내며, 자세한 내용은 man dstat 명령어를 사용하여 매뉴얼 페이지를 확인할 수 있습니다.

dstat help

더보기
$ dstat --help
Usage: dstat [-afv] [options..] [delay [count]]
Versatile tool for generating system resource statistics

Dstat options:
  -c, --cpu              enable cpu stats
     -C 0,3,total           include cpu0, cpu3 and total
  -d, --disk             enable disk stats
     -D total,hda           include hda and total
  -g, --page             enable page stats
  -i, --int              enable interrupt stats
     -I 5,eth2              include int5 and interrupt used by eth2
  -l, --load             enable load stats
  -m, --mem              enable memory stats
  -n, --net              enable network stats
     -N eth1,total          include eth1 and total
  -p, --proc             enable process stats
  -r, --io               enable io stats (I/O requests completed)
  -s, --swap             enable swap stats
     -S swap1,total         include swap1 and total
  -t, --time             enable time/date output
  -T, --epoch            enable time counter (seconds since epoch)
  -y, --sys              enable system stats

  --aio                  enable aio stats
  --fs, --filesystem     enable fs stats
  --ipc                  enable ipc stats
  --lock                 enable lock stats
  --raw                  enable raw stats
  --socket               enable socket stats
  --tcp                  enable tcp stats
  --udp                  enable udp stats
  --unix                 enable unix stats
  --vm                   enable vm stats

  --plugin-name          enable plugins by plugin name (see manual)
  --list                 list all available plugins

  -a, --all              equals -cdngy (default)
  -f, --full             automatically expand -C, -D, -I, -N and -S lists
  -v, --vmstat           equals -pmgdsc -D total

  --bits                 force bits for values expressed in bytes
  --float                force float values on screen
  --integer              force integer values on screen

  --bw, --blackonwhite   change colors for white background terminal
  --nocolor              disable colors (implies --noupdate)
  --noheaders            disable repetitive headers
  --noupdate             disable intermediate updates
  --output file          write CSV output to file
  --profile              show profiling statistics when exiting dstat

delay is the delay in seconds between each update (default: 1)
count is the number of updates to display before exiting (default: unlimited)

 

728x90