PowerCLI

 View Only
Expand all | Collapse all

Get-Stat on a resourcepool not working.

  • 1.  Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 10:03 AM

    Hi,

    When running the below command i get an error :

    Get-Stat -Entity $resPool -Stat mem.active.average -MaxSamples 1 -Realtime

    The Error :

    Get-Stat : 10/1/2010 11:54:46 AM    Get-Stat        The metric counter "mem.active.average" doesn't exist for entity "XXXXXX".
    At line:1 char:9
    + Get-Stat <<<<  -Entity $resPool -Stat mem.active.average -MaxSamples 1 -Realtime
        + CategoryInfo          : ResourceUnavailable: (mem.active.average:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    

    When looking in vCenter the memory statistics are available for the period.

    We are running vCenter 4.0U2, VMware vSphere PowerCLI 4.1 build 264274

    /Allan

    http://doitsmarter.blogspot.com



  • 2.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 10:47 AM

    Did you create that resource pool within the last hour ?

    When I create a new resource pool and then query the metric, I get the same error you are getting.

    Try with the hidden resource pool, called 'Resources'.

    If you get a value for that one, it's a matter of waiting a bit to get values for the new pool.

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 3.  RE: Get-Stat on a resourcepool not working.

    Broadcom Employee
    Posted Oct 01, 2010 11:03 AM

    Hi,

    You need to set the statistic level to 2 or higher.

    To do this:

    1. Open vSphere Client

    2. Go to Administration -> vCenter Server Settings -> Statistics

    3. Click on the desired interval and change the statistic level by clicking the Edit button

    You can check the available statistic types by Get-StatType cmdlet.

    Regards,

    Nedko Nedev

    PowerCLI Development Team



  • 4.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 12:28 PM

    Hi,

    for how long time do i need to wait afterwards to be able to see these changes?

    do i need to change the settings for all 4 loging sections?

    /Allan

    http://doitsmarter.blogspot.com



  • 5.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 12:35 PM

    Since you ask for -Realtime statistics the levels don't play along in this.

    They are only needed for the Historical Intervals.

    The time to wait depends, but if you don't get any values after 1 hour there must be something else that is wrong.

    I assume you were connected to a vCenter when you ran the Get-Stat cmdlet ?

    If yes, try connecting to the ESX(i) server directly and ask the values for the 'Resources' pool.

    That way we are at least sure the metric is captured on the ESX(i) host.

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 6.  RE: Get-Stat on a resourcepool not working.

    Broadcom Employee
    Posted Oct 01, 2010 12:50 PM

    Allan,

    1. The changes are applied immediately on my local environment. You should be able to see samples and the cmdlet is no longer printing error message.

    2. I've run some tests and I saw that you need to change the settings only for the 5min interval.

    LucD,

    Here is what I observed when playing with the vSphere client:

    1. The statistics for each interval are calculated from the statistics of the previous interval(for example 30min are calculated from 5min). So you cannot have level 3 for 30min and level 2 for 5min.

    2. When you change the level for 5min statistics the Realtime statistics settings are automatically updated because you don't have settings in the vSphere Client.

    <br/>

    Regards,

    Nedko Nedev

    PowerCLI Development Team



  • 7.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 01:06 PM

    From the PerformanceManager page in the SDK 4.1 Reference:

    VirtualCenter Server 2.5 (and subsequent vCenter Server) systems initially collect statistics data 10 minutes after system startup, and then hourly thereafter.

    Realtime statistics are not rolled up and hence the level doesn't play.

    Have a look at Understanding VirtualCenter Performance Statistics, section VirtualCenter Statistic Archival, list item 1.

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 8.  RE: Get-Stat on a resourcepool not working.

    Broadcom Employee
    Posted Oct 01, 2010 01:13 PM

    LucD,

    I'm not a vCenter guru but as I say I've done some tests with my local environment that prooved my theory.

    When the 5min statistics are created the information is collected from the realtime statistics. You can't create 5min statistics level 2 when the realtime statistics are level 1 so the level of the realtime statistics is automatically changed to 2.

    You can try it and you'll see that it is working.

    Regards,

    Nedko Nedev

    PowerCLI Development Team



  • 9.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 01:41 PM

    Ok, since you obviously don't want to be lieve me or Scott Drummond or the API Reference, do this little test.

    Disconnect an ESX server, go to the performance tab and you will be still able to access Past Day,Week.Month and Year data since these values are kept on the vCenter.

    You will not be able to access RealTime data anymore, since vCenter fetches these from the ESX(i) server.

    So again, there is no Statistics Level for RealTime data. Statistics Levels is a concept that lives on the vCenter and controls the roll up jobs that run on the SQL server that hosts the vCenter database.

    There are some metrics that only live on vCenter, for example all the Cluster related metrics. And since the proof is in the pudding, you will not have RealTime statistics for these metrics.

    And the answer to the original question, the Resourcepool metrics, provided it concerns cluster-related resourcepools, only live on the vCenter.

    And as a consequence, there are no RealTime values for these metrics, what the error message was saying all along.

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 10.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 01:45 PM

    My previous assumption was wrong.

    The solution is simple, drop the -Realtime parameter and make sure the interval you select (through the -Start and -Finish parameters) is at least at statistics level 2.

    ____________

    Blog: LucD notes

    Twitter: lucd22



  • 11.  RE: Get-Stat on a resourcepool not working.

    Broadcom Employee
    Posted Oct 01, 2010 02:02 PM

    LucD,

    You were right.

    The line Get-Stat -Realtime returns 5min samples instead of Realtime(with no error message). I'll file a bug.

    Regards,

    Nedko Nedev

    PowerCLI Development Team



  • 12.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 01, 2010 05:25 PM

    I found some other weird results:

    PS> Get-Stat -Entity (Get-cluster iscs* )
    Get-Stat : 10/1/2010 6:30:43 PM    Get-Stat        The metric counter "sys.uptime.latest" doesn't exist for entity "iSCSI-Cluster".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* )
        + CategoryInfo          : ResourceUnavailable: (sys.uptime.latest:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    Get-Stat : 10/1/2010 6:30:43 PM    Get-Stat        The metric counter "disk.usage.average" doesn't exist for entity "iSCSI-Cluster".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* )
        + CategoryInfo          : ResourceUnavailable: (disk.usage.average:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    Get-Stat : 10/1/2010 6:30:43 PM    Get-Stat        The metric counter "net.usage.average" doesn't exist for entity "iSCSI-Cluster".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* )
        + CategoryInfo          : ResourceUnavailable: (net.usage.average:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    
    MetricId                Timestamp                          Value Unit     Instance
    ---------               ----------                         ----- ----     --------
    cpu.usagemhz.average    9/29/2010 2:00:00 AM                 433 MHz
    cpu.usagemhz.average    9/28/2010 2:00:00 AM                 693 MHz
    cpu.usagemhz.average    9/27/2010 2:00:00 AM                 120 MHz
    cpu.usagemhz.average    9/26/2010 2:00:00 AM                 120 MHz
    cpu.usagemhz.average    9/25/2010 2:00:00 AM                 132 MHz
    cpu.usagemhz.average    9/24/2010 2:00:00 AM                 464 MHz
    cpu.usagemhz.average    9/23/2010 2:00:00 AM                 213 MHz
    cpu.usage.average       9/29/2010 2:00:00 AM                0.89 %        *
    cpu.usage.average       9/28/2010 2:00:00 AM                1.43 %        *
    cpu.usage.average       9/27/2010 2:00:00 AM                0.24 %        *
    cpu.usage.average       9/26/2010 2:00:00 AM                0.24 %        *
    cpu.usage.average       9/25/2010 2:00:00 AM                0.27 %        *
    cpu.usage.average       9/24/2010 2:00:00 AM                0.95 %        *
    cpu.usage.average       9/23/2010 2:00:00 AM                0.43 %        *
    mem.usage.average       9/29/2010 2:00:00 AM                0.01 %        *
    mem.usage.average       9/28/2010 2:00:00 AM                0.01 %        *
    mem.usage.average       9/27/2010 2:00:00 AM                   0 %        *
    mem.usage.average       9/26/2010 2:00:00 AM                   0 %        *
    mem.usage.average       9/25/2010 2:00:00 AM                   0 %        *
    mem.usage.average       9/24/2010 2:00:00 AM                   0 %        *
    mem.usage.average       9/23/2010 2:00:00 AM                   0 %        *
    
    
    PS> Get-Stat -Entity (Get-cluster iscs* | Get-ResourcePool resources)
    Get-Stat : 10/1/2010 7:20:48 PM    Get-Stat        The metric counter "sys.uptime.latest" doesn't exist for entity "Resources".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* | Get-ResourcePool resources)
        + CategoryInfo          : ResourceUnavailable: (sys.uptime.latest:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    Get-Stat : 10/1/2010 7:20:48 PM    Get-Stat        The metric counter "cpu.usage.average" doesn't exist for entity "Resources".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* | Get-ResourcePool resources)
        + CategoryInfo          : ResourceUnavailable: (cpu.usage.average:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    Get-Stat : 10/1/2010 7:20:49 PM    Get-Stat        The metric counter "disk.usage.average" doesn't exist for entity "Resources".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* | Get-ResourcePool resources)
        + CategoryInfo          : ResourceUnavailable: (disk.usage.average:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    Get-Stat : 10/1/2010 7:20:49 PM    Get-Stat        The metric counter "net.usage.average" doesn't exist for entity "Resources".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* | Get-ResourcePool resources)
        + CategoryInfo          : ResourceUnavailable: (net.usage.average:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    Get-Stat : 10/1/2010 7:20:49 PM    Get-Stat        The metric counter "mem.usage.average" doesn't exist for entity "Resources".
    At line:1 char:9
    + Get-Stat <<<<  -Entity (Get-cluster iscs* | Get-ResourcePool resources)
        + CategoryInfo          : ResourceUnavailable: (mem.usage.average:String) [Get-Stat], VimException
        + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.ViCore.Cmdlets.Comma
       nds.GetViStats
    
    
    MetricId                Timestamp                          Value Unit     Instance
    ---------               ----------                         ----- ----     --------
    cpu.usagemhz.average    9/29/2010 2:00:00 AM                 433 MHz
    cpu.usagemhz.average    9/28/2010 2:00:00 AM                 693 MHz
    cpu.usagemhz.average    9/27/2010 2:00:00 AM                 120 MHz
    cpu.usagemhz.average    9/26/2010 2:00:00 AM                 120 MHz
    cpu.usagemhz.average    9/25/2010 2:00:00 AM                 132 MHz
    cpu.usagemhz.average    9/24/2010 2:00:00 AM                 464 MHz
    cpu.usagemhz.average    9/23/2010 2:00:00 AM                 213 MHz
    

    this is against a 4.1 vcenter with loglevel set to 2 on all intervals still same powercli version(4.1)

    /Allan

    http://doitsmarter.blogspot.com



  • 13.  RE: Get-Stat on a resourcepool not working.

    Posted Oct 02, 2010 12:18 AM

    There is nothing weird about these last results.

    If you don't specify a metric via the -Stat parameter, the Get-Stat cmdlet will request 6 metrics:

    cpu.usagemhz.average
    cpu.usage.average
    mem.usage.average
    sys.uptime.latest
    disk.usage.average
    net.usage.average
    

    If you check the last 3 of these metrics on the PerformanceManager page in the SDK Reference, you'll see that these 3 metrics are not supported for clusters and resourcepools.

    ____________

    Blog: LucD notes

    Twitter: lucd22