I'm using the following the code at the moment:
$WarningPreference = "SilentlyContinue"
$metrics = "cpu.usagemhz.average","cpu.usage.average"
$start = (get-date).AddDays(-7)
$finish = get-date
$stats = get-stat -Entity (get-cluster *) -Stat $metrics -Start $start -Finish $finish -Interval 86400
$groups = $stats | Group-Object -Property {$_.TimeStamp, $_.MetricId, $_.Value, $_.Unit, $_.Entity}
$report = $groups | % {
New-Object PSObject -Property @{
'TimeStamp' = $_.Group[0].TimeStamp
'MetricId' = $_.Group[0].MetricId
'Value' = $_.Group[0].Value
'Unit' = $_.Group[0].Unit
'Entity' = $_.Group[0].Entity
}
}
$report | Select TimeStamp, Value, Unit | Export-Csv "C:\out.csv" -NoTypeInformation
This gives me this:
TimeStamp | Value | Unit |
18/05/2014 01:00 | 91 | MHz |
17/05/2014 01:00 | 91 | MHz |
16/05/2014 01:00 | 91 | MHz |
15/05/2014 01:00 | 91 | MHz |
14/05/2014 01:00 | 795 | MHz |
18/05/2014 01:00 | 1.56 | % |
17/05/2014 01:00 | 1.56 | % |
16/05/2014 01:00 | 1.56 | % |
15/05/2014 01:00 | 1.56 | % |
14/05/2014 01:00 | 13.7 | % |
but I need to seperate the metrics into seperate columns like in the second table. I ran that off in excel to get an idea of what I need.