Firstly - this is really a message to LucD (who I know from previous assistance tends to prowl this forum ) , just figured I'd share it, as it's all usefull info and any insight LucD has will no doubt be usefull for all.
This line
get-stat -Entity 'esxihost.fq.dn' | get-stats -Stat "datastore.numberReadAveraged.average"
should be something like this
Get-Stat -Entity (Get-VMHost -Name $strHostWildCard) -Stat $arrMetrics -Start $today9am.AddDays($intStartDay) -Finish $today5pm
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Tried that one as well, but no luck .
What puzzles me is that we're using a small vmware cluster, 4 servers, one nfs-datastore for all of them, the setup isn't uniqe or special in any way, and still I can't get it to work.
I've attached the script that i'm using, and a screenshot from part of the output. I'm about to give up.
Thanks for all the help! I really appreciate it!
Best regards
/_Axel_
Did you already try with my Get-Stat2 function ?
See Get NFS performance counters via PowerCLI
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello
Thanks a lot for this script.
I'm trying to find large vdisks with low iops in our infrastructure. With the script I can find the disks with low iops but I fail to modify it to add disk size (ideally used space).
How should I do this ?
thanks
That is the 2nd script in this thread you are talking about, right ?
Note that it is not too obvious to link VMDK to guest OS partitions, or do you mean used space on the VMDK level ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Let us know here on in the new thread if there is any update LucD
Not sure I understand what kind of update you are expecting ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
I'm seeing some strange results with this and wondering if someone can help. If I run the script below, so without grouping, the results come out as expected, for both VMs.
$metrics = "cpu.usage.average","mem.usage.average","disk.usage.average","disk.maxTotalLatency.latest","net.usage.average"
$arrVMs = Get-VM Terminator, CCFS01
$start = (Get-Date).AddDays(-7)
$stats = Get-Stat -Entity $arrVMs -Stat $metrics -Start $start | fl
echo $stats
Value : 0.58
Timestamp : 02/03/2016 05:30:00
MetricId : cpu.usage.average
Unit : %
Description : CPU usage as a percentage during the interval
Entity : CCFS01
EntityId : VirtualMachine-vm-107
IntervalSecs : 1800
Instance :
Uid : ...VirtualMachine-vm-107/FloatSample=cpu.usage.average\\635924934000000000/
Value : 0.83
Timestamp : 02/03/2016 05:00:00
MetricId : cpu.usage.average
Unit : %
Description : CPU usage as a percentage during the interval
Entity : CCFS01
EntityId : VirtualMachine-vm-107
IntervalSecs : 1800
Instance :
Uid : ...VirtualMachine=VirtualMachine-vm-107/FloatSample=cpu.usage.average\\635924916000000000/
If I add a grouping.
$metrics = "cpu.usage.average","mem.usage.average","disk.usage.average","disk.maxTotalLatency.latest","net.usage.average"
$arrVMs = Get-VM Terminator, CCFS01
$start = (Get-Date).AddDays(-7)
$stats = Get-Stat -Entity $arrVMs -Stat $metrics -Start $start
$groups = $stats | Group-Object -Property {$_.Entity, $_.MetricId, $_.Instance}
$report = $groups | % {
New-Object PSObject -Property @{
Description = $_.Group[0].Description
Entity = $_.Group[0].Entity
MetricId = $_.Group[0].MetricId
Timestamp = $_.Group[0].Timestamp
Unit = $_.Group[0].Unit
Value = [math]::Round(($_.Group | Measure-Object -Property Value -Average).Average, 2)
}
}
echo $report
The output is only.
Value : 52.34
Description : CPU usage as a percentage during the interval
Timestamp : 08/03/2016 13:00:00
Entity : CCFS01
MetricId : cpu.usage.average
Unit : %
Any help appreciated.
I strongly suspect that the difference is in the use of the Instance property.
For a multi-core CPU there will be three different instances: the aggregate (instance -eq "") and one for each core (instance 0 and 1).
Same is true for the disk and net metrics (provided you have more than one of these in the VM)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The instance field was always empty. I tried removing the CPU metrics from the script and grouping only on Entity and MetricID, but still getting the same one line output.
$metrics = "mem.usage.average","disk.usage.average","disk.maxTotalLatency.latest","net.usage.average"
$arrVMs = Get-VM Terminator, CCFS01
$start = (Get-Date).AddDays(-7)
$stats = Get-Stat -Entity $arrVMs -Stat $metrics -Start $start
$groups = $stats | Group-Object -Property {$_.Entity, $_.MetricId}
$report = $groups | % {
New-Object PSObject -Property @{
Description = $_.Group[0].Description
Entity = $_.Group[0].Entity
MetricId = $_.Group[0].MetricId
Timestamp = $_.Group[0].Timestamp
Unit = $_.Group[0].Unit
Value = [math]::Round(($_.Group | Measure-Object -Property Value -Average).Average, 2)
}
}
echo $report
Value : 65.11
Description : Memory usage as percentage of total configured or available memory
Timestamp : 08/03/2016 13:30:00
Entity : CCFS01
MetricId : mem.usage.average
Unit : %
EDIT: Even if I remove all metrics except mem.usage.average I still get the same result.
How many elements do you get in the $groups variable after the Group-Object line ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Just 1 server by the looks of it.
Count Name | Group |
----- ---- | ----- |
668 CCFS01 mem.usage.average {1.8, 1.75, 2.17, 2.06...}
But since you group on EntityId and MetricId, there should be more entries.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes exactly, something isn't quite right
Were these VMs poweredon at the start of he interval you are requesting ?
You can do a quick check in the Performance tab of the vSphere or Web Client.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No, all powered on. Getting the same results regardless of which VM I pick. If you execute the scripts I posted what do you get?
I get, as expected, 4 objects (one for each metric) per VM
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Interesting.
Which vSphere/PowerCLI version? I'm using 6.0.
The test was against vSphere 5.5, and I used PowerCLI 6.0
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your help LucD.
I took a somewhat different approach but managed to make it work. I've put the solution on my site, http://docs.nzsystems.com/?p=262.