Automation

 View Only
  • 1.  Getting montly cpu contention value?

    Posted Feb 05, 2018 06:50 PM

    Hi guys , i am fairly new with powercli , i am trying to get montly value of cpu contention, by my understanding  with this script  (get the script from this forum) i get the average of today (maybe i am wrong):

    $Cluster = 'clustername'

    $stat = 'cpu.latency.average'

    $CPU_contention = (Get-Stat -Entity $esx -Stat $stat -Realtime -MaxSamples 1 | Measure-Object -Property Value -Average).Average

    $CPU_contention='{0:N1}' -f $CPU_contention -replace ",","."

    $CPU_contention

    i think i must replace  -Realtime for -Interval 7200 to get Historical Interval 3  , but i get the error that the hosts of the cluster doesen't have the cited statistics.

    any hint , will be welcome

                                            Martin



  • 2.  RE: Getting montly cpu contention value?
    Best Answer

    Posted Feb 05, 2018 07:13 PM

    You are correct that Realtime doesn't get you the statistical data further back than approx 1 hour.
    For going back one month you would be looking at indeed at Historical Interval 3.
    But then the availability of the metrics depends on the Statistics Levels you have specified on your vCenter.

    For the cpu.latency.average metric the required Statistic Levels are 2 or 3, where 2 only keeps the average and 3 also keeps the minimum and maximum.

    Check the Statistics Level for Historical Interval 3 on your vCenter, it should at least be set to 2.

    $si = Get-View ServiceInstance

    $perfMgr = Get-View -Id $si.Content.PerfManager

    $perfMgr.HistoricalInterval



  • 3.  RE: Getting montly cpu contention value?

    Posted Feb 05, 2018 07:34 PM

    LuckD thank you for the quickest response ever...(just awesome!)

    i run the script  and i get that:

    Key            : 1

    SamplingPeriod : 300

    Name           : Past day

    Length         : 86400

    Level          : 1

    Enabled        : True

    Key            : 2

    SamplingPeriod : 1800

    Name           : Past week

    Length         : 604800

    Level          : 1

    Enabled        : True

    Key            : 3

    SamplingPeriod : 7200

    Name           : Past month

    Length         : 2592000

    Level          : 1

    Enabled        : True

    Key            : 4

    SamplingPeriod : 86400

    Name           : Past year

    Length         : 31536000

    Level          : 1

    Enabled        : True

    I guess that means that the vcenter only has statistics level 1 on all Historical Intervals ....:-(



  • 4.  RE: Getting montly cpu contention value?

    Posted Feb 05, 2018 07:52 PM

    That is correct.
    You can check always which metrics are available with the Get-StatType cmdlet, and specifying the Interval and a sample Entity.