리눅스 기초 다지기 - 33. nmon

 

nmon

: 컴퓨터 성능 시스템 모니터 도구

 

nmon 설치

[root@localhost ~]# yum install -y epel-release
[root@localhost ~]# yum -y install nmon

 

nmon 실행

# nmon 실행
[root@localhost ~]# nmon

# 기본 화면
┌nmon─16n─────────────────────Hostname=localhost────Refresh= 0secs ───10:21.51──────────────────────────────┐
│                                                                                                           │
│   ------------------------------                                                                          │
│    _ __  _ __ ___   ___  _ __          For help type H or ...                                             │
│   | '_ \\| '_ ` _ \\ / _ \\| '_ \\          nmon -?  - hint                                                   │
│   | | | | | | | | | (_) | | | |         nmon -h  - full details                                           │
│   |_| |_|_| |_| |_|\\___/|_| |_|                                                                           │
│                                        To stop nmon type q to Quit                                        │
│   ------------------------------                                                                          │
│                                                                                                           │
│   NAME="Rocky Linux" ID="rocky"                                                                           │
│   Vendor=GenuineIntel Model=Intel(R) Xeon(R) CPU           E5504  @ 2.00GHz                               │
│   MHz=1995.000 bogomips=3990.00          lscpu:CPU=2 Little Endian                                        │
│   ProcessorChips=2 PhysicalCores=1             Sockets=2 Cores=1 Thrds=1                                  │
│                    VirtualCPUs =2              MHz=0 max=0 min=0                                          │
│                                                                                                           │
│   Use these keys to toggle statistics on/off:                                                             │
│     c = CPU         l = CPU Long-term     - = Faster screen updates                                       │
│     C = " WideView  U = Utilisation       + = Slower screen updates                                       │
│     m = Memory      V = Virtual memory    j = File Systems                                                │
│     d = Disks       n = Network           . = only busy disks/procs                                       │
│     r = Resource    N = NFS               h = more options                                                │
│     k = Kernel      t = Top-processes     q = Quit                                                        │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────│

# c 입력 (CPU)
┌nmon─16n──────[H for help]───Hostname=localhost────Refresh= 2secs ───10:22.40──────────────────────────────┐
│ CPU Utilisation ──────────────────────────────────────────────────────────────────────────────────────────│
│---------------------------+-------------------------------------------------+                             │
│CPU User%  Sys% Wait%  Idle|0          |25         |50          |75       100|                             │
│  1   1.5   2.0   0.0  96.5|s>                                               |                             │
│  2   0.5   0.0   0.0  99.5|>                                                |                             │
│---------------------------+-------------------------------------------------+                             │
│Avg   0.8   1.8   0.0  97.5|>                                                |                             │
│---------------------------+-------------------------------------------------+                             │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────│

# m 입력 (Memory)
┌nmon─16n──────[H for help]───Hostname=localhost────Refresh= 2secs ───10:23.09──────────────────────────────┐
│ Memory and Swap ──────────────────────────────────────────────────────────────────────────────────────────│
│ PageSize:4KB   RAM-Memory  Swap-Space       High-Memory     Low-Memory                                    │
│ Total (MB)         3651.1      4036.0       - not in use   - not in use                                   │
│ Free  (MB)          516.4      3597.8                                                                     │
│ Free Percent         14.1%       89.1%                                                                    │
│ Linux Kernel Internal Memory (MB)                                                                         │
│                        Cached=    1414.1     Active=     873.0                                            │
│ Buffers=       0.7 Swapcached=      74.0  Inactive =    1673.9                                            │
│ Dirty  =       0.0 Writeback =       0.0  Mapped   =     227.3                                            │
│ Slab   =     417.2 Commit_AS =    3983.8 PageTables=      12.2                                            │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────│

 

mon 파일 캡처

 

옵션

-f

: 파일로 저장

 

-s <seconds>

: 몇 초 주기로 데이터를 캡처할 지 여부

 

-c <number>

: 스냅샷의 갯수 지정

 

-m

: <dir> 저장 경로

 

60초 주기로 1440번 캡처

[root@localhost ~]# nmon -f -s 60 -c 1440 -m /home/monitor/nmon
[root@localhost ~]# cd /home/monitor/nmon
[root@localhost nmon]# ls -al
total 40
drwxr-xr-x  2 root    root       40 Sep  4 10:39 .
drwx------. 5 monitor monitor   170 Sep  4 10:25 ..
-rw-r--r--  1 root    root    39397 Sep  4 10:39 localhost_230904_1039.nmon

 

매일 00:00 nmon 스케줄러 실행

[root@localhost nmon]# crontab -e
0 0 * * * nmon -f -s 60 -c 1440 -m /home/monitor/nmon