개발서버로 사용하는 KVM 이며 따로 모니터링 도구가 없다.
virsh 명령어를 사용하여 VM 생성 시 가용 가능한 cpu나 memory 등을 확인 후 구축하는 것이 좋으며, 호스트 및 가상 서버의 자원 사용 상태 등을 모니터링 할 수 있다.
# 호스트 서버 자원 정보 확인하기
# virsh nodeinfo 명령어로 호스트 노드의 CPU 정보 확인가능
# virsh nodeinfo
CPU 모델: x86_64
CPU: 24
CPU 주파수: 3458 MHz
CPU 소켓: 1
소켓당 코어: 6
코어당 스레드: 2
NUMA cell: 2
메모리 용량: 148362824 KiB
# virsh hostname 명령어를 통해 호스트명을 확인 가능
# virsh hostname
KVM-01
# virsh nodecpustats 명령어로 cpu 사용률 확인
# virsh nodecpustats
사용자: 5290909130000000
시스템: 1933546810000000
유휴상태: 375504764450000000
iowait: 12229370000000
# virsh nodememstats 명령어로 memory 사용률 확인
# virsh nodememstats
total : 148362824 KiB
free : 623172 KiB
buffers: 448404 KiB
cached : 91413692 KiB
참고
출처 : https://naleejang.tistory.com/241
노드의 cpu 상태를 알고 싶어요. 그럼 node라는 단어를 통해 아 이건 node의 자원정보를 보여주는 거구나 라는 걸 알 수 있어요. 그리고, cpu를 보고 싶은 거잖아요. 그래서 cpu 라는 단어가 또 사용되겠죠~!! 마지막은 상태는 영어로 stats라고 하잖아요. 그래서 nodecpustats 서브 명령어는 node의 cpu stat(상태)를 보여주는 명령어구나를 알수 있어요. 결과를 좀 볼까요? user 는 당연히 사용자가 현재 사용하고 있는 cpu 사용율이겠죠!! 그리고, system은 운영체제가 시스템을 운영하기 위해 사용하는 사용율일 것입니다. idle은 뭔가요? 놀고 있는 cpu 를 말하는겁니다. 그래서, 사용가능한 자원 정보라고 볼 수 있습니다. 마지막으로 iowait는 말그대로 디스크에 무엇가를 얼마나 쓰고(i, input) 읽었는지(o, output)를 확인할 수 있습니다. 메모지는 전체 사용량(total), 사용하지 않은 메모리량(free), 버퍼 메모리(buffer) 및 cach 메모리(cached) 정보들을 확인할 수 있습니다.
# virsh list 명령어로 실행중인 vm 확인
# virsh list
Id 이름 상태
----------------------------------------------------
1 WEB-TEST 실행중
2 DB-TEST 실행중
3 PUSH-DB 실행중
4 PUSH-01 실행중
5 PUSH-02 실행중
# virsh dominfo {number} 명령어로 실행중인 vm 사양 확인
8core 8GB mem 할당
# virsh dominfo 1
Id: 1
이름: WEB-TEST
UUID: 07b31b7b-f969-4923-968b-5db1bebafe2c
OS 유형: hvm
상태: 실행중
CPU: 8
CPU 시간: 2145038.2s
최대 메모리: 8388608 KiB
사용된 메모리: 8388608 KiB
Persistent: 예
Autostart: 비활성화됨
Managed save: 아니요
모안 모델: none
보안 DOI: 0
# virsh cpu-stats {number}
virsh cpu-stats 명령어를 이용하면 아래와 같이 호스트의 어떤 CPU가 게스트의 CPU 사용을 위해 얼마나 사용이 되었는지를 확인할 수 있습니다. virsh 명령어를 이용하면 가상머신 자체 사용율 뿐만 아니라 실제 호스트의 자원 사용율을 함께 확인할 수 있어 성능이나 자원 정보를 확인할 경우 매우 도움이 많이 됩니다.
출처: https://naleejang.tistory.com/242 [Nalee와 함께 떠나는 IT이야기:티스토리]
# virsh cpu-stats 1
CPU0:
cpu_time 164688.275970031 seconds
vcpu_time 157650.189722762 seconds
CPU1:
cpu_time 55746.774156857 seconds
vcpu_time 48794.604591572 seconds
CPU2:
cpu_time 166750.661255196 seconds
vcpu_time 159131.112980137 seconds
CPU3:
cpu_time 50680.946347047 seconds
vcpu_time 44211.422682480 seconds
CPU4:
cpu_time 167684.570109735 seconds
vcpu_time 158442.442868916 seconds
CPU5:
cpu_time 50705.601284812 seconds
vcpu_time 43534.774893141 seconds
CPU6:
cpu_time 166934.278462086 seconds
vcpu_time 159111.502680428 seconds
CPU7:
cpu_time 51883.582576519 seconds
vcpu_time 43546.005433518 seconds
CPU8:
cpu_time 166839.025215171 seconds
vcpu_time 159716.452684278 seconds
CPU9:
cpu_time 50451.371400815 seconds
vcpu_time 43610.828379673 seconds
CPU10:
cpu_time 165043.535536797 seconds
vcpu_time 158002.943788807 seconds
CPU11:
cpu_time 49648.849414890 seconds
vcpu_time 42697.558341524 seconds
CPU12:
cpu_time 110383.422624951 seconds
vcpu_time 103102.957273442 seconds
CPU13:
cpu_time 35019.941391103 seconds
vcpu_time 23543.857449906 seconds
CPU14:
cpu_time 109557.441019768 seconds
vcpu_time 102862.414938863 seconds
CPU15:
cpu_time 30979.790093862 seconds
vcpu_time 21581.604145728 seconds
CPU16:
cpu_time 106306.826510326 seconds
vcpu_time 95982.554893744 seconds
CPU17:
cpu_time 32128.261012518 seconds
vcpu_time 22406.772238770 seconds
CPU18:
cpu_time 109876.379910226 seconds
vcpu_time 102525.428662289 seconds
CPU19:
cpu_time 31782.212185625 seconds
vcpu_time 21304.165131983 seconds
CPU20:
cpu_time 99805.944710040 seconds
vcpu_time 93421.507328307 seconds
CPU21:
cpu_time 32620.620165286 seconds
vcpu_time 22618.306395461 seconds
CPU22:
cpu_time 106915.983511156 seconds
vcpu_time 100195.873592292 seconds
CPU23:
cpu_time 32764.057009358 seconds
vcpu_time 22885.582436271 seconds
Total:
cpu_time 2145198.352048050 seconds
user_time 35985.570000000 seconds
system_time 235335.840000000 seconds