본문 바로가기
IT/Server

[Linux] OS Resource Monitoring Command

by 뷰IGHT 2022. 7. 11.

실행 프로그램의 바이너리 모니터링 : strace

  • EX ) Mariadb 의 read, write binary 추적 
[root@test ~ ]# ps -ef | grep mariadb
mysql 27667 20248 0 Jun30 ? 00:04:47 ....
root 21273 21087 0 16:24 pts/1 00:00:00 grep --color=auto mariadb

[root@test ~]# strace -e trace=read,write -s 2000 -fp 27667

OS 자원 확인 : nfsiostat-sysstat 또는 iostat

OS 자원 모니터링 (지속적) : watch -n1 nfsiostat-sysstat {$path}

- watch 명령어 ( -n 옵션 : interval 지정. 따라서 1 로 하면 1초마다 갱신하여 지속적으로 모니터링 가능)

[root@test ~]# watch -h

Usage:
 watch [options] command

Options:
  -b, --beep             beep if command has a non-zero exit
  -c, --color            interpret ANSI color and style sequences
  -d, --differences[=<permanent>]
                         highlight changes between updates
  -e, --errexit          exit if command has a non-zero exit
  -g, --chgexit          exit when output from command changes
  -n, --interval <secs>  seconds to wait between updates
  -p, --precise          attempt run command in precise intervals
  -t, --no-title         turn off header
  -x, --exec             pass command to exec instead of "sh -c"

 -h, --help     display this help and exit
 -v, --version  output version information and exit

 

 

모니터링 원하는 경로의 file system 경로 확인 : df 

[root@test ~]# df /db/postgresql/data/
Filesystem      1K-blocks    Used  Available Use% Mounted on
/dev/sda3      1843238572 2911300 1746672644   1% /

- 여기서 찾은 Filesystem path에 대해 watch -n1 을 하곤 함.  원하는 디렉토리의 io 사용량 확인 가능

 

'IT > Server' 카테고리의 다른 글

linux find  (0) 2022.12.22
Server Setting (centos + nginx + php + mysql)  (0) 2021.01.25