Hi evryone,
My script for Performance Statistics give some errors:
I get now these erros then I run the script against only upgraded vCenter from version 5.5 to 6.0.0
Running the script against vCenter version 5.5 is totally ok.
I started to debug the Metrics for vCenter 6.0 and found these Metrics for entity "my vm [Obfuscated] ":
Get-StatType -Entity "my vm [Obfuscated] " -Start $StartTime | Sort-Object -Unique
cpu.cpuentitlement.latest
cpu.ready.summation
cpu.usage.average
cpu.usagemhz.average
disk.maxTotalLatency.latest
disk.provisioned.latest
disk.unshared.latest
disk.usage.average
disk.used.latest
mem.consumed.average
mem.mementitlement.latest
mem.overhead.average
mem.swapinRate.average
mem.swapoutRate.average
mem.usage.average
mem.vmmemctl.average
net.usage.average
sys.uptime.latest
My script contain these Metrics in a variable
$metrics = "cpu.usage.average", `
"cpu.usagemhz.average", `
"mem.usage.average", `
"mem.consumed.average", `
"disk.usage.average", `
"disk.maxTotalLatency.latest", `
"net.usage.average", `
"sys.uptime.latest"
My command in script:
$vms = "my vm [Obfuscated] "
$StartTime = "05.02.2019 08:53:57"
$EndTime = "20.02.2019 13:53:57"
$intervall = "*"
$metrics = "cpu.usage.average", `
"cpu.usagemhz.average", `
"mem.usage.average", `
"mem.consumed.average", `
"disk.usage.average", `
"disk.maxTotalLatency.latest", `
"net.usage.average", `
"sys.uptime.latest"
get-stat -Entity $vms -Stat $metrics -Start $StartTime -Finish $EndTime -IntervalSecs $intervall
We did not change the level value for Performance Statistics, the value is still 1.
Could anyone advise me to solve this problem?
Thanks and regards
Denis
That would correspond with HI4
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
During the upgrade of your vCenter, did you migrate the statistical data as well?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
From my team colleague:
"When upgrading from 5.5 to 6.0, you could not choose this at all
When we look at vCenter statitics for one year, statisics are there."
That is not what I saw when I migrated.
See also point 42 in KB2146439
But that is probably not the cause, since you seem to be getting the data for the other metrics.
Can you check what the oldest and most recent entries are for one of the missing metrics?
$intervall = "*"
$metrics = "disk.maxTotalLatency.latest"
Get-Stat -Entity $vms -Stat $metrics -IntervalSecs $intervall -MaxSamples ([int]::MaxValue) |
Sort-Object -Property Timestamp |
Select -First 1 -Last 1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
We did not upgraded to the appliance.
Get-Stat : 21.02.2019 15:12:17 Get-Stat The metric counter "disk.maxtotallatency.latest" doesn't exist for
entity "my vm [Obfuscated]".
At line:1 char:1
+ Get-Stat -Entity $vms -Stat $metrics -IntervalSecs $intervall -MaxSam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (disk.maxtotallatency.latest:String) [Get-Stat], VimExcept
ion
+ FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAu
tomation.ViCore.Cmdlets.Commands.GetViStats
MetricId Timestamp Value Unit Instance
-------- --------- ----- ---- --------
disk.maxtotallatency... 22.02.2018 01:00:00 0 milli...
disk.maxtotallatency... 21.02.2019 15:00:00 0 milli...
You only seem to have statistical data for that metric for 2 days.
And you see that metric for that specific VM for a longer period in the Performance tab?
Did you also try with another VM?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I don't understand... one date is from 2018 and the other from 2019. Is one year but not 2 days or I'm totally wrong.
MetricId Timestamp Value Unit Instance
-------- --------- ----- ---- --------
disk.maxtotallatency... 22.02.2018 01:00:00 0 milli...
disk.maxtotallatency... 21.02.2019 15:00:00 0 milli..
Yes, we see the statistics in vCenter for one year my team colleague did or a check and confirmed me that.
I tried for other VM's and different vCenter upgraded Win / Win. Statistics are present to.
Yes, I misread, it's 1 year of data.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could it be that the VM you tested with was powered off on the Start date?
In that case you will not get any metrics returned.
Try changing the Start date, you can still extract the desired interval afterwards, based on the Timestamp property.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No the VM is in power on state.
The first time I realise the problem was when I started the script for date between the 10 and 13 february 2019
After I trieded more than one VM in different vCenter's with same result.
Did you change the Start date to a time before the migration?
From the result you can determine which timerange is missing.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
in my script I had to the command "-ErrorAction:SilentlyContinue -WarningAction:SilentlyContinue" to get my excel report completed.
vCenter A (6.0.0 no migrattion, Windows server)
Network & System Metrics no data before 2019.02 15:00
vCenter B (migration win / win 5.5 to 6.0 Windows Server)
Network & System Metrics no data before 2019.07 01:00
vCenter C (migration win / win 5.5 to 6.0, Windows Server)
Network & System Metrics no data before 2019.15 13:00
Same vCenter configuration:
Statistics
5 Minutes 1 Days Level 1
30 Minutes 1 Week Level 1
2 Hours 1 Month Level 1
1 Days 1 Years Level 1
Database Retention Policy 90 / 90
And do these dates correspond with the migration dates?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
sure not, the vCenter A was not migrated and the others were last year migrated
Was someone experimenting with the retain settings of the statistical data?
Are the aggregation jobs on the vCenter working correctly?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
we have conducted the following tests:
We have checked the SQL Database rollup jobs, everythings are OK
We did not make any experiments to the retain settings.
As far as we can say we think that the issue is between vCenter version 6.0 and the "get-stat"-commandlet.
You could check if my Get-Stat2 function experiences the same issue.
That one calls the API directly, no PowerCLI cmdlet involved.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc,
I tried your script.
If only one vCenter is connected where is no problem at all.
If we have multi connection ($global:DefaultVIServers), it does not work.
I tried to use the parameter for $vm = get-vm -Name <myvm> -server <myserver>
no success...
Multiconnection is mandatory for my app where I call the script.
This the error I got:
Exception calling "QueryAvailablePerfMetric" with "4" argument(s): "A specified parameter was not
correct: entity"
At D:\vCenter_Reporting\Get-Stat2.ps1:153 char:5
+ $metricId = $perfMgr.QueryAvailablePerfMetric($Entity.MoRef,$null ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : VimException
-Instance parameter invalid for requested stat: cpu.usage.average.
Valid values are:
At D:\vCenter_Reporting\Get-Stat2.ps1:179 char:9
+ Throw "-Instance parameter invalid for requested stat: $st.`n ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (-Instance param...id values are: :String) [], Runt
imeException
+ FullyQualifiedErrorId : -Instance parameter invalid for requested stat: cpu.usage.average.
Valid values are:
My Get-Stat2 is not foreseen for multiple vCenter connections.
I just referred to it so you could check if the performance data was retrieved through the function when Get-Stat seems to fail.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK, but what can I do now 😉