PowerCLI

 View Only
  • 1.  get-stattype/ get-stat missing metrics

    Posted Jun 24, 2022 12:04 PM

    Hello,
    I have some issues with metrics.
    My environment is under migration for some VM's I got the error message while using get-stat that "The metric counter "cpu.usagemhz.average" doesn't exist for entity". But when I want to see what kind of metrics are available with get-stattype those metrics  are listed there.
    I have a theory that VM machine is registered to vCenter but never turned ON and that is the reason why I can see metrics with get-stattype command.
    I am also wondering why I have bunch of VMS that have only disk.used.latest,disk.provisioned.latest,disk.unshared.latest using get-stattype, What does it mean ??
    Is there any documentation describing the flow for this or can anybody fill my gaps in understanding this ?

    Many thanks !!



  • 2.  RE: get-stattype/ get-stat missing metrics

    Posted Jun 24, 2022 01:27 PM

    For which Interval did you run that cmdlet?
    How are the statistic levels defined on your vCenter?

    If a VM is never powered on there will indeed be no performance data (Get-Stat), but Get-StatType should return metrics.

    Perhaps first have a look at my PowerCLI & vSphere statistics – Part 1 – The basics post.





  • 3.  RE: get-stattype/ get-stat missing metrics

    Posted Aug 22, 2022 02:02 PM

    Hello LucD,
    Thank you for the answer.
    My levels are set up like this: Past day lvl 2,Past Week lvl 1. Past Month lvl 1, Past year lvl 1.
    I have discovered that on some hosts I did not had date stet up so this impacted for around 4,5k VM's.


    On the other hand I am wondering how does the get-stat form works. Is it picking the date > or >= ?

    BTW Many thanks for your blog it is very handy !



  • 4.  RE: get-stattype/ get-stat missing metrics

    Posted Aug 22, 2022 03:50 PM

    Thanks, much appreciated.

    Afaik, the Start parameter is using >
    The underlying QueryPerf method uses the PerfQuerySpec where it says for the StartTime property

    When a startTime is specified, the returned samples do not include the sample at startTime.

     





  • 5.  RE: get-stattype/ get-stat missing metrics

    Posted Aug 23, 2022 07:56 AM

    Dear LucD

    I am very grateful for your help!
    Thank you very much for the link's to source, now I know where to find more information.

    I just noticed that you have write a book " VMware vSphere PowerCLI Reference: Automating vSphere Administration, 2nd Edition".
    Is there any chances for 3rd edition and maybe with some REST API?
    My congratulations on the book!

    If I have your attention I would like to ask a question on the conversion of the metrics form Esxi host to vCenter.
    If Esxi Host did not have set up date and NTP server & creation date for VM's was 1970 is this impacting the history metrics on the vCenter database ?

     



  • 6.  RE: get-stattype/ get-stat missing metrics

    Posted Aug 23, 2022 08:11 AM

    Thanks.

    I'm afraid there is no 3rd edition in the pipeline.
    Most of the co-authors have moved on, and I'm in retirement for more than 1 year.

    If the timestamp on the metrics collected on the ESXi node is not correct, then I'm afraid that the vCenter will throw those entries away when the aggregation jobs are running on the vCenter.
    I'm not sure if the vCenter even collects those metrics from the ESXi node.