Solved

Need help with PowerCLI script for performace monitor.

Posted on 2014-12-04
10
183 Views
Last Modified: 2014-12-15
Need help with PowerCLI script to get the CPU and memory usage (average, Max, Min and percentage) on hourly basis for past 3 days for select VM(s) only.


Thanks.
0
Comment
Question by:Dhattks
  • 5
  • 4
10 Comments
 
LVL 5

Accepted Solution

by:
GG VP earned 250 total points
Comment Utility
Please go through this vmware community post,
https://communities.vmware.com/message/2275139

Also please have a look at LUCD blog, expert in powercli,
http://www.lucd.info/2009/12/30/powercli-vsphere-statistics-part-1-the-basics/

You could also have a look at RV TOOLS,

http://www.robware.net


Hope this helps!
0
 

Author Comment

by:Dhattks
Comment Utility
Thanks GG,

I found this script online that probably gets the performance counters from vCenter for all the VMs.

Would you know if changing "$allvms = @()" to $server = "vmname" and then changing $allvms at the end to  $server = "vmname" will get me the data only for one particular VM?

Thanks.

attached is the script.
performance-powercli.txt
0
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 250 total points
Comment Utility
No. Just add the name of your VM after Get-VM to only get stats for that specific VM.
 $vms = Get-Vm MyParticularVM
0
 

Author Comment

by:Dhattks
Comment Utility
Thanks for help.
I was able to get the results for one VM using  $vms = Get-Vm MyParticularVM

But I have another script where it gets the data hourly basis for last 3 days but does not get me the Max, Min and percentage CPU and Memory. I only get average.

I some how need to get this script pull Max, Min and percentage as well.

Thanks in advance.
script.txt
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
Not correct. It only gets you the average memory, no CPU stats.
Why don't you use the script posted first?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:Dhattks
Comment Utility
The first script does not get me the hourly stats / data and the second one only gets me the average.
Yes, I have to change the memory to cpu in the script to get the cpu average.
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
If I understood correctly, the first script will result in daily stats, and determining min and max from the average values of each hour. That is because VMWare seems not to provide any min/max values -   would be difficult to do so for all arbitrary time perioids.

What exactly is your desired output? Best to provide a text example ...
0
 

Author Comment

by:Dhattks
Comment Utility
The first script gives daily stats, and determining min and max from the average values.

the second one provides hourly data but average only.

see attachments.
1st-Script-Result.csv
2nd-Script-Result.csv
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
That much is clear. I've asked for the desired output, not what you get from the scripts.
You cannot get a min/max each hour, as the only available value is the average. To get min/max, we need to consolidate data, e.g. daily.
0
 

Author Closing Comment

by:Dhattks
Comment Utility
Thanks everyone.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
It Is not possible to enable LLDP in vSwitch(at least is not supported by VMware), so in this article we will enable this, and also go trough how to enabled CDP and how to get this information in vSwitches and also in vDS.
Advanced tutorial on how to run the esxtop command to capture a batch file in csv format in order to export the file and use it for performance analysis. He demonstrates how to download the file using a vSphere web client (or vSphere client) and exp…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now