Hi All,
I'm currently looking at producing a CPU and Memory usage / capacity report for our estate running vSphere 4.0. I'm new to PowerCLI but can see great potential in automating some of our tasks and collecting usage reports that we currently don't actively do.
I've seen various posts refering to PowerCLI scripts which I'm looking into but what I'm struggling with is returning the same figures I see in the GUI with a one-liner when it comes to guest stats.
If I may use the following example I'm sure it will be obvious to some why I'm not getting the results I expect.
I highlight a VM within the vSphere Client, select the 'Performance' tab, click 'Advanced' and then 'Chart Options'. Once in the 'Customise Performance Chart' screen I select 'CPU' (Past Month) and selecft simple the 'CPU Usage' counter.
Clicking OK gives me my 'Latest', 'Maximum', 'Minimum' and 'Average' values.
According to the following page - http://communities.vmware.com/docs/DOC-5600 - Level 1 logging (which is what we currently have) only provides a 'cpu.usage.average' counter, yet I can see a 'Maximum' and 'Minimum' in the GUI.
How is this calculated and how would this value be obtained using a one line command?
I want to ideally get a point where I can run something like the following for the past month;
'get-VM "vmname" | get-stat -stat cpu.usage.average -Start (get-date).AddHours(-720) ---- for the past month?
What I'm unclear about is how I can return the max / min values I see in the GUI - I'm aware I'm missing arguments but I'm not sure which ones as I understand I'd have to specify a sample range, and then potentially do a calculation to get the max / min values. Is this even possible with a one liner?
Thanks in advance,
M.