VMware Cloud Community
tdubb123
Expert
Expert

export VM performance %cpu/mem% x days into csv format

s it possible to script export of a bunch of VMs from vrops (cpu% and memory % ) for x days in csv format? one file per vm?

0 Kudos
8 Replies
LucD
Leadership
Leadership

Yes, have a look at vrops-export


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tdubb123
Expert
Expert

I am looking at the vmfields.yaml file and cannot find a field for

- alias: memDemand

    metric: mem|guest_demand

in percentage

also how do I export 180days of data from list of VMs I have?

0 Kudos
tdubb123
Expert
Expert

can i get this info with get-omstat?

0 Kudos
LucD
Leadership
Leadership

Yes, that should be possible


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tdubb123
Expert
Expert

I tried this. do I need to adjust the intervaltype?

$int = ([DateTime]::Now).AddDays(-180)

$Vmlist = get-content "c:\temp\scripts\vms2.txt"

$key = Get-OMStatKey -name "cpu|workload", "mem|workload" -ResourceKind VirtualMachine

foreach ($vm in $vmlist){

Get-OMStat -Resource $vm -Key $statkey -from $int -IntervalType "Days" -IntervalCount 1 -RollupType "Avg" | export-csv -UseCulture -NoTypeInformation "c:\temp\\scripts\$vm.csv"

}

0 Kudos
LucD
Leadership
Leadership

I'm not sure the OM cmdlets can use OBN, so I would do like this.
The rest of your code looks correct.

$int = ([DateTime]::Now).AddDays(-180)

$Vmlist = get-content "c:\temp\scripts\vms2.txt"

$key = Get-OMStatKey -name "cpu|workload", "mem|workload" -ResourceKind VirtualMachine


foreach ($vmName in $vmlist) {

    $vm = Get-VM -Name $vmName | Get-OMResource -ResourceKind 'VirtualMachine'

    Get-OMStat -Resource $vm -Key $statkey -from $int -IntervalType "Days" -IntervalCount 1 -RollupType "Avg" | export-csv -UseCulture -NoTypeInformation "c:\temp\\scripts\$vm.csv"

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tdubb123
Expert
Expert

Hi Luc

Is it possible to get it in this format

NAME      MEM|WORKLOAD       CPU||WORKLOAD   VALUE     TIME

0 Kudos
LucD
Leadership
Leadership

Have a look at Re: Help Speeding Up vROps report


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos