Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 180923

Pulling Metrics for all VMs within a vCenter Tag Category

$
0
0

Hi All

 

I have a Category called Prod which has various tags within it which are then attached to various VMs. What i would like to do is pull vROPS CPU & Memory demand metrics for all the VMs within that category for a given time period... I have the following so far:

 

 

     Connect-VIServer vCenter1,vCenter2 -User user -Password password

     Connect-OMServer vrops -User user -Password password

 

     $From = '14/12/18 07:00:00'

     $To = '14/12/18 20:00:00'

     $OMvmlist = Get-VM | where {(Get-TagAssignment -Entity $_ | Select -ExpandProperty Tag) -like 'PROD*'}

     $metrics = "cpu|demandmhz","mem|workload"

     Get-OMResource $OMvmList | Get-OMStat -Key $metrics -From $From -To $To | Select Time,Resource,Key,Value | Export-Csv -Path "c:\csv\cpumemdemand.csv" -noTypeInformation

 

It seems to give me essentially what i want but to make it easier to use i would like the columns to be Time, Resource, CPUvalue, Memoryvalue. can anyone advise how i can go about doing this? Still very new to powercli so the fact ive got this far is a small miracle...


Viewing all articles
Browse latest Browse all 180923

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>