VMware 클러스터에서 RAM이 확장되거나 교체된 가상 머신을 모두 찾으시겠습니까?

VMware 클러스터에서 RAM이 확장되거나 교체된 가상 머신을 모두 찾으시겠습니까?

vSphere 클러스터 또는 리소스 풀을 보고 특정 수준의 메모리 팽창 또는 스와핑을 확인한 경우 어떤 VM이 영향을 받는지 어떻게 식별합니까?일단 찾으면 어떻게 해야 할지 압니다 :)

아래 예에서는 리소스 풀에 65개의 가상 머신이 있습니다. 32GB 미만의 RAM이 있습니다. RAM의 일부가 확장되거나 교체된 VM을 어떻게 식별합니까?

여기에 이미지 설명을 입력하세요

답변1

Powercli는 다음과 같은 작업에 적합합니다.

VM 가져오기 | 여기서 {$_.BalloonedMemory -ne '0'}

여기에 더 많은 예제가 있습니다:

http://www.getshifting.com/wiki/powerclinotes

특히 "벌루닝 및 스와핑이 포함된 VM"을 살펴보세요. http://www.getshifting.com/wiki/powerclinotes#resource_pools_with_ballooning_and_swapping

위 링크에서 복사했습니다:

$myCol = @()
foreach($vm in (Get-View -ViewType VirtualMachine | Where-Object `
  {$_.Summary.QuickStats.BalloonedMemory -ne "0"})){
    $Details = "" | Select-Object VM, `
    SwappedMemory ,BalloonedMemory

    $Details.VM = $vm.Name
    $Details.SwappedMemory = $vm.Summary.QuickStats.SwappedMemory
    $Details.BalloonedMemory = $vm.Summary.QuickStats.BalloonedMemory

    $myCol += $Details
  }
$myCol

답변2

이것이 작은 도움이 되기를 바랍니다.

죄송합니다. 이 정보 출력에서 ​​추가 정렬을 수행하고 리소스(호스트, 데이터 저장소, 클러스터)별로 그룹화하기를 원했기 때문에 전체 vCenter에 대해 실행했습니다.

#!/bin/env python
__author__ = 'dladner'

import os
import sys
import pysphere

from pysphere import VIServer, MORTypes
from pysphere.resources import VimService_services as VI

s = VIServer()
s.connect("vcenter_hostname_or_ip", "username", "password")
vmlist = s.get_registered_vms(status="poweredOn")
count = 0
for vmpath in vmlist:
    pm1 = s.get_performance_manager()
    vm = s.get_vm_by_path(vmpath)
    mor = vm._mor
    ballooned = pm1.get_entity_statistic(mor, 77)
    swapped = pm1.get_entity_statistic(mor, 61)
    count += 1
    print "VM Number %d is %s and Ballooned Memory Amount on this VM is : %s" % (count, vmpath, ballooned)
    print "VM Number %d is %s and Swapped Memory Amount on this VM is  : %s" % (count, vmpath, swapped)

print "NOTICE: This statistic refers to VMkernel swapping and not to guest OS swapping."
s.disconnect()

이렇게 하면 더 높은 풍선/스왑 금액에서 더 낮은 금액으로(+ KB를 MB로 변환하려는 경우) 원하는 방식으로 수정하고 정렬할 수 있는 아래 결과가 제공됩니다.

출력을 수정했습니다(호스트 이름을 대체하고 풍선 표시/교환으로 그룹화함).

SWAPPED:

VM Number 2 is [vm11_rr] hostname and Swapped Memory Amount on this VM is  : [<vm-303427:swapped(61):Swapped::107336:kiloBytes:2013-08-31 04:35:33.561569>]
VM Number 9 is [vm04] hostname and Swapped Memory Amount on this VM is  : [<vm-17451:swapped(61):Swapped::7896:kiloBytes:2013-08-31 04:36:25.791696>]
VM Number 10 is [vm05_nq] hostname and Swapped Memory Amount on this VM is  : [<vm-266882:swapped(61):Swapped::816:kiloBytes:2013-08-31 04:36:33.266692>]
VM Number 11 is [vm06] hostname and Swapped Memory Amount on this VM is  : [<vm-4550:swapped(61):Swapped::-1:kiloBytes:2013-08-31 04:36:40.313133>]
VM Number 14 is [vm05] hostname and Swapped Memory Amount on this VM is  : [<vm-158642:swapped(61):Swapped::12532:kiloBytes:2013-08-31 04:37:02.907590>]
VM Number 23 is [vm07] hostname and Swapped Memory Amount on this VM is  : [<vm-437276:swapped(61):Swapped::135272:kiloBytes:2013-08-31 04:38:10.633787>]
VM Number 24 is [vm14_rr] hostname and Swapped Memory Amount on this VM is  : [<vm-74703:swapped(61):Swapped::183436:kiloBytes:2013-08-31 04:38:17.985025>]
VM Number 25 is [vm01] hostname and Swapped Memory Amount on this VM is  : [<vm-156212:swapped(61):Swapped::13268:kiloBytes:2013-08-31 04:38:25.224494>]
VM Number 33 is [vm14] hostname and Swapped Memory Amount on this VM is  : [<vm-156661:swapped(61):Swapped::828:kiloBytes:2013-08-31 04:39:25.827377>]
VM Number 39 is [vm23_rr] hostname and Swapped Memory Amount on this VM is  : [<vm-391487:swapped(61):Swapped::10020:kiloBytes:2013-08-31 04:40:10.795514>]
VM Number 48 is [vm15] hostname and Swapped Memory Amount on this VM is  : [<vm-446333:swapped(61):Swapped::-1:kiloBytes:2013-08-31 04:41:20.224237>]
VM Number 49 is [vm14_rr] hostname and Swapped Memory Amount on this VM is  : [<vm-395852:swapped(61):Swapped::91664:kiloBytes:2013-08-31 04:41:27.588455>]
vm number 51 is [vm03] hostname and swapped memory amount on this vm is  : [<vm-47780:swapped(61):swapped::8:kilobytes:2013-08-31 04:41:43.539276>]
vm number 54 is [vm29_rr] hostname and swapped memory amount on this vm is  : [<vm-430048:swapped(61):swapped::1200:kilobytes:2013-08-31 04:42:07.398927>]
vm number 56 is [vm03] hostname and swapped memory amount on this vm is  : [<vm-45758:swapped(61):swapped::19560:kilobytes:2013-08-31 04:42:22.790720>]
vm number 59 is [vm25_rr] hostname and swapped memory amount on this vm is  : [<vm-267833:swapped(61):swapped::55836:kilobytes:2013-08-31 04:42:46.202327>]
vm number 60 is [vm01] hostname and swapped memory amount on this vm is  : [<vm-279859:swapped(61):swapped::4289160:kilobytes:2013-08-31 04:42:53.200330>]
vm number 61 is [vm04] hostname and swapped memory amount on this vm is  : [<vm-174860:swapped(61):swapped::26288:kilobytes:2013-08-31 04:43:01.326958>]
vm number 62 is [vm25_rr] hostname and swapped memory amount on this vm is  : [<vm-384185:swapped(61):swapped::8180:kilobytes:2013-08-31 04:43:09.043827>]
vm number 63 is [vm12_rr] hostname and swapped memory amount on this vm is  : [<vm-434605:swapped(61):swapped::25780:kilobytes:2013-08-31 04:43:16.270494>]
vm number 64 is [vm01] hostname and swapped memory amount on this vm is  : [<vm-372871:swapped(61):swapped::21840:kilobytes:2013-08-31 04:43:23.820811>]
vm number 67 is [vm09_nq] hostname and swapped memory amount on this vm is  : [<vm-184134:swapped(61):swapped::716:kilobytes:2013-08-31 04:43:46.909753>]
vm number 69 is [vm31_rr] hostname and swapped memory amount on this vm is  : [<vm-434653:swapped(61):swapped::148:kilobytes:2013-08-31 04:44:02.652494>]

BALLOONED::
VM Number 23 is [vm07] hostname and Ballooned Memory Amount on this VM is : [<vm-437276:vmmemctl(77):Balloon::2638188:kiloBytes:2013-08-31 04:38:08.631993>]
VM Number 24 is [vm14_rr] hostname and Ballooned Memory Amount on this VM is : [<vm-74703:vmmemctl(77):Balloon::1335560:kiloBytes:2013-08-31 04:38:16.188130>]
VM Number 49 is [vm14_rr] hostname and Ballooned Memory Amount on this VM is : [<vm-395852:vmmemctl(77):Balloon::1249812:kiloBytes:2013-08-31 04:41:25.789048>]
VM Number 56 is [vm03] hostname and Ballooned Memory Amount on this VM is : [<vm-45758:vmmemctl(77):Balloon::-1:kiloBytes:2013-08-31 04:42:20.445191>]

추가 도움이 필요하시면 오늘은 꽤 늦었기 때문에 내일 좀 더 정신 차리도록 노력하겠습니다.

출처:

http://pubs.vmware.com/vsphere-50/index.jsp#com.vmware.wssdk.apiref.doc_50/memory_counters.html

https://code.google.com/p/pysphere/

도움이 되었기를 바랍니다.

건배.

PS -1:kiloBytes가 API에서 무엇을 의미하는지 잘 모르겠습니다.

답변3

이는 이전 스레드에 매우 늦게 추가된 것이지만 이를 파이프라인에 유지하고 각 루프에 대해 방지하는 속도를 더 빠르게 만들 수 있습니다. 이것을 시도해 보십시오:

    get-vm | where{ $_.swappedmemory -ne '0'} | get-view | Select Name,@{Name="Swapped”;Expression={$_.summary.quickstats.swappedmemory}},@{Name="Ballooned";Expression={$_.summary.quickstats.balloonedmemory}}

관련 정보