VMware Cloud Community
jingleharish
Contributor
Contributor

Get-Stat Errors

Hello,

Getting the following errors after VCenter server upgrade from 4.0 to 4.1. Let us know what meight be the reason.

Get-Stat : 21/06/2011 5:08:56 AM    Get-Stat        The metric counter "mem.swapinrate.average" doe

sn't exist for entity "esx1.dri.com".

At C:\Users\Desktop\Harish\Scripts\New_Harish\Utilisation.ps1:76 char:21

+         $swapIn = get-stat <<<<  -Entity $vh -stat $metric3 -start $startTime -finish $endTime -i

ntervalMins $inter

    + CategoryInfo          : ResourceUnavailable: (mem.swapinrate.average:String) [Get-Stat], Vim

   Exception

    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,V

   Mware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

Get-Stat : 21/06/2011 5:08:57 AM    Get-Stat        The metric counter "mem.swapoutrate.average" do

esn't exist for entity "esx1.dri.com".

At C:\Users\Desktop\Harish\Scripts\New_Harish\Utilisation.ps1:77 char:22

+         $swapOut = get-stat <<<<  -Entity $vh -stat $metric4 -start $startTime -finish $endTime -

intervalMins $inter

    + CategoryInfo          : ResourceUnavailable: (mem.swapoutrate.average:String) [Get-Stat], Vi

   mException

    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,V

   Mware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

Get-Stat : 21/06/2011 5:08:57 AM    Get-Stat        The metric counter "mem.consumed.average" doesn

't exist for entity "esx1.dri.com".

At C:\Users\Desktop\Harish\Scripts\New_Harish\Utilisation.ps1:78 char:21

+         $memCon = get-stat <<<<  -Entity $vh -stat $metric -start $startTime -finish $endTime -in

tervalMins $inter

    + CategoryInfo          : ResourceUnavailable: (mem.consumed.average:String) [Get-Stat], VimEx

   ception

    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,V

   Mware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

Get-Stat : 21/06/2011 5:08:58 AM    Get-Stat        The metric counter "cpu.usagemhz.average" doesn

't exist for entity "vmhv0005n01.in.telstra.com.au".

At C:\Users\Desktop\Harish\Scripts\New_Harish\Utilisation.ps1:79 char:23

+         $cpuUsage = get-stat <<<<  -Entity $vh -stat $metric1 -start $startTime -finish $endTime

-intervalMins $inter

    + CategoryInfo          : ResourceUnavailable: (cpu.usagemhz.average:String) [Get-Stat], VimEx

   ception

    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,V

   Mware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

CmdLet used: get-stat -Entity $prodRes -stat $metric1 -start $startTime -finish $endTime -intervalMins $inter

Reply
0 Kudos
7 Replies
LucD
Leadership
Leadership

I assume you upgraded your vCenter database in place ?

Another phenomena I saw, when you upgrade your vCenter, all the VI Objects get new MoRefs.

So if you ask statistics for a specific ESX(i) server, the Get-Stat cmdlet will use the current MoRef to find the statistical data.

While in the vCenter database the statistical data for the time period before the upgrade will most probably be stored with another MoRef.

Can you try the Get-Stat but use a time period from after the upgrade.

You should see Get-Stat returning values.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

LucD
Leadership
Leadership

Are you by any chance using Oracle to store the vCenter DB ?

In that case you might check out KB1032755


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
jingleharish
Contributor
Contributor

Any way to get the statistical data for the time period before the upgrade?

Reply
0 Kudos
LucD
Leadership
Leadership

Let's first determine if that actually is the problem.

Can you get statistical data from the period after the vCenter upgrade ?

Are the statistical levels set correctly ? Perhaps the aggregation jobs cleaned up the old data.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
jingleharish
Contributor
Contributor

The upgrade was done on 13th June. I am still getting the same above error, When trying to get the statistical data for past 2 days with intervals of 30Min.

I am getting the following metricID for realtime.

[vSphere PowerCLI] C:\Users\Desktop\Harish\Scripts\New_Harish> get-stat -Entity (Get-VMHost esx01*) -Stat * -MaxSamples 1 | ft metricid

MetricId
--------
cpu.usage.average
cpu.usagemhz.average
mem.usage.average
mem.swapinrate.average
mem.swapoutrate.average
mem.vmmemctl.average
mem.consumed.average
mem.overhead.average
disk.usage.average
disk.maxtotallatency.latest
net.usage.average
sys.uptime.latest
clusterservices.cpufairness.latest
clusterservices.memfairness.latest

Reply
0 Kudos
AureusStone
Expert
Expert

Are the performance charts working fine in vCenter?

Reply
0 Kudos
LucD
Leadership
Leadership

It looks like the aggregation jobs might not be running like it should.

You can try the following script to list the aggregation jobs

[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
$sqlServer = "SQLServer" 
$sqlSRv
= new-object ('Microsoft.SqlServer.Management.Smo.Server') $sqlServer $sqlSrv.JobServer.Jobs | where {$_.Category -eq "Stats Rollup"} | %{     New-Object PSObject -Property @{         Name = $_.Name         Description = $_.Description         LastRun = $_.LastRunDate         NextRun = $_.NextRunDate         LastRunResult = $_.LastRunOutcome         "Schedule(s)" = $_.JobSchedules | %{$_.Name}     } }

This needs to run under an account that thas the required permissions on the SQL server.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos