티스토리 뷰

Linux

Linux의 Resource를 모니터링 해보자

naleejang 2013. 11. 21. 10:53

정말 오랜만에 글을 써보는것 같습니다. 그동안 프로젝트로 인해 너무 바뻐서 글을 쓸 시간이 없었거든요~~~

오늘은 레드햇이나 우분투와 같은 리눅스 시스템의 리소스 모니터링 툴에 대해 글을 써볼까? 합니다. 사실 이전에는 cpu 사용율을 모니터링 하는 top, 메모리 자원을 확인하는 free 정도의 명령어 밖에는 몰랐는데, 이번 프로젝트를 하면서 cpu, memory 뿐 아니라, network, file i/o, disk에 대한 리소스 상태까지도 모니터링 할 수 있는 명령어를 알았습니다

 

인터넷을 검색해 보니 관련 자료도 많이 보이더군요~!! 어떤 시스템을 구성하던지 자원관리는 아주 중요합니다. 다음 명령어를 통해 내가 사용하는 서버의 리소스를, 내가 사용하는 VM의 리소스를 확인해 보는건 어떨까요?

 

위에서 소개한 명령어는 dstat 라는 명령어이다.

 

dstat 라는 명령어를 그냥 실행하면 설치를 하라는 메시지가 나온다. 설치를 해야 쓸 수 있는 명령어이다.

nalee@ubuntu:~$ dstat

The program 'dstat' is currently not installed. You can install it by typing:

sudo apt-get install dstat

 

1. 그럼 dstat를 설치해 보자.

nalee@ubuntu:~$ sudo apt-get install dstat

[sudo] password for nalee: 

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following NEW packages will be installed:

  dstat

0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.

Need to get 65.5 kB of archives.

After this operation, 351 kB of additional disk space will be used.

Get:1 http://us.archive.ubuntu.com/ubuntu/ quantal/universe dstat all 0.7.2-3 [65.5 kB]

Fetched 65.5 kB in 10s (6,264 B/s)

Selecting previously unselected package dstat.

(Reading database ... 50687 files and directories currently installed.)

Unpacking dstat (from .../archives/dstat_0.7.2-3_all.deb) ...

Processing triggers for man-db ...

Setting up dstat (0.7.2-3) ...

 

2. dstat 설치가 끝났으면 이젠 dstat를 실행해보자

nalee@ubuntu:~$ dstat

You did not select any stats, using -cdngy by default.

----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--

usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw 

  0   1  99   0   0   0| 214k  181k|   0     0 |   0     0 |  48    98 

  0   0 100   0   0   0|   0     0 | 180B 1234B|   0     0 |  18    30 

  0   1 100   0   0   0|   0     0 |  60B  452B|   0     0 |  25    32 

  1   0 100   0   0   0|   0     0 |  60B  346B|   0     0 |  14    13 

  0   0 100   0   0   0|   0     0 |  60B  346B|   0     0 |  19    24 

  0   0  99   0   0   0|   0     0 |  60B  346B|   0     0 |  13    13 

  0   1  99   1   0   0|   0    40k|  60B  346B|   0     0 |  29    36 

  0   0 100   0   0   0|   0     0 |  60B  346B|   0     0 |  17    23 

  1   0 100   0   0   0|   0     0 |  60B  346B|   0     0 |  22    26 

  0   0 100   0   0   0|   0     0 |  60B  346B|   0     0 |  13    13

 

3. dstat에는 다양한 옵션들이 있다. 어떤 옵션들이 있는지 -h 옵션을 통해 확인이 가능하다.

nalee@ubuntu:~$ dstat -h

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

 

  --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

 

delay is the delay in seconds between each update (default: 1)

count is the number of updates to display before exiting (default: unlimited)

 

dstat를 그냥 치면 시스템에서 보여줄 수 있는 모든 정보를 모니터링할 수 있다. 그러나 특정 리소스만 모니터링 하고 싶다면 옵션을 통해 확인하고 싶은 정보들만 모니터링 할 수도 있다. 어떤 블로그에 옵션에 나온 영어를 친절하게 한글로 올려 놓은 블로그가 있어 관련 링크를 남겨본다.


https://www.linux.co.kr/home2/board/subbs/board.php?bo_table=lecture&wr_id=1772

최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함