Automation

 View Only
  • 1.  advice on get-stat

    Posted Dec 05, 2009 10:37 PM

    I have few questions regarding the get-stat cmdlet. Its to do with some of its parameters:

    First, I am trying to understand maxsamples, and what it does. I see some scripts which have dates for last 30 days, but then have maxsample settings for 3 or 7 or 10. What does the maxsample to, and what difference would it make if it was not used.

    The next parameter is the intervalmins and intervalsecs, are they used instead of the start and finish parameters. Such as are they used to get samples for the last few hours or minutes. So if I wanted a sample for the last 5 hours or 10 mins I would use these parameters is that correct.

    The next parameter is realtime. Do we have to use this paramter for most get-stats command, if I dont use this setting I get errors. What does this parameter do and what if I dont use it.

    Also in my virtualcentre settings in statistics, I have checked 5 min, 30 min, 2 hours and 1 days. Having these durations checked or not checked haveany affect on the counters and retrieving statistics for specific dates.

    ALso is there a link where I can see all the list of counters, in particular I want to find out if there is one for cpu ready time.

    ANy advise please .



  • 2.  RE: advice on get-stat

    Posted Dec 05, 2009 11:37 PM

    A few quotes from Ch. 7 of my book:

    --- quote start ---

    I’m going to skip down a bit to mention the MaxSamples parameter. This integer specifies how many records are returned for each metric. The default number of samples is ten. Therefore, if you retrieve six metrics with the default MaxSamples size, you’ll receive 60 records.

    ...

    In this section, I’ll cover the remaining parameters which are: Start, Finish, IntervalMins, and Realtime.

    Start and Finish let you specify a timespan for statistical reports. You can specify the times using a datetime object which is returned by Get-Date, or you can enter a date in string format, as this example shows:

    ...

    If you omit the Finish parameter, then it defaults to the current time. If you leave off the Start time, then the system shows you as many records as it can, up to the number of samples you specify.

    It is important to note that the MaxSamples parameter must be large enough to encompass your desired timespan; otherwise you’ll see an artificially truncated range of results. This is a bit annoying if you don’t want to do the math to determine how many records will occur in a given period of time.

    ...

    You can change how much time elapses between each record with the IntervalMins parameter. The default interval is 30 minutes, as you can see in the previous example.

    Let me quote from the help file:

    “Specifies the granularity in minutes for which the statistics should be collected. The closest available granularity is used.”

    Note that this parameter is your reporting interval, not the collection interval. The collection interval is configured in the Management Server Configuration dialog of the VI Client and looks like this:

    --- quote end ---

    Hope this helps.



  • 3.  RE: advice on get-stat

    Posted Dec 06, 2009 12:18 AM

    Sorry Hal, should have done a refresh before I posted my reply.



  • 4.  RE: advice on get-stat

    Posted Dec 06, 2009 12:16 AM

    Performance measurement is a broad topic.

    And you better read some of Scott Drummonds excellent articles in the Performance community on the subject.

    Might I suggest Understanding VirtualCenter Performance Statistics as a starter.

    To answer some of your questions:

    - the Realtime parameter indicates you want get the performance data directly from the ESX server. The performance interval on ESX is currently 20 seconds. So a cpu.usage.average of 35% means that the CPU was used an average of 35% of those 20 seconds.

    - the other, so called Historical intervals are calculated on the vCenter (based on the performance coming from the ESX server). vCenter knows 4 Historical Intervals. The interval times are 5 minutes, 30 minutes, 2 hours and 1 day.

    - These Historical Intervals also define how long the performance data is kept. For example, the date for Historical Interval 1 (interval 5 mins) is kept for 1 day. Historical Interval 4 (interval 1 day) is kept for 1 year.

    - the Intervalmins and Intervalsecs parameters do not replace the Start and Finish parameters.

    - Start and Finish allow you to indicate between which 2 points in time you want to get the performance data

    - Intervalmins and Intervalsecs allow you to specify over which interval the performance data should be calculated. Note that the Get-Stat cmdlet will return the closest of the available intervals. Remember these are 20 secs, 5 mins, 30 mins, 2 hours, 1 day.

    - For example, you want a metric between 9 days and 6 days ago and you ask for Intervalsecs 300. Since the start of your requested interval is more than 1 week ago, the data will come from Historical Interval 3 which has an interval of 2 hours.

    - If you want data of the last 5 hours you would specify -Start (Get-Date).AddHours(-5) and -Finish (Get-Date)

    - If some Historical Intervals are not checked there will be no data available for that specific period in time.

    - For example, if you uncheck Historical Interval 4, you will not be able to retrieve performance data older than 1 month.

    - An important factor for the Historical Intervals is the statistics level. This level determines how many counters will be available for a specific Historical Interval

    - To see all the available metric for a specific entity you can use the Get-StatType cmdlet or my Get-Stat2 script with the QueryMetrics parameter



  • 5.  RE: advice on get-stat

    Posted Dec 06, 2009 11:45 AM

    OK, so if I choose the start ane finish date for last 8 days, such as -start (get-date).AddDays(-8) `

    -Finish (Get-Date) and I choose maxsamples as 100, that would give me 100 readings bases on a 30 minutes interval (or 2 hours), as the interval duration is 30 minutes (or is it 2 hours) for data kept for more than a week. Is this correct.

    If I did not specify a value for maxsamples, it would give me 10 readings as the default is 10. Is this correct.

    If I specified a maxample value for 99999, would it say that we are requested too many sample values, as you cannot get that many sample values in the last 8 days.

    Also at what duration of the last 8 days, does it take the sample readings, and which sample readings does it choose ( at what times)

    Is it best to specify maxsamplevalues , or leave it as default which is 10.

    If now I added parameters for intervalmins and intervalsecs such as I choose intervalmins 45, would it takes sample readings every 45 minutes now. Is this correct.

    Also in the VC settings in statistics if I did not choose interval gurations settings for 2 hours I would not be able to get sample readings for more than a week, is this correct ?

    Just trying to clarify everything.



  • 6.  RE: advice on get-stat

    Posted Dec 06, 2009 12:34 PM

    This is a bit of a trick question.

    The consolidation on the vCenter is done every 2 hours.

    In Virtual Center the samples older than 1 week were thrown away.

    In vSPhere the older records are apparently kept for longer than 1 week.

    That means that you will be able, in vSPhere, to get samples from Historical Interval 2, sample time 30 minutes, further back in the past than 1 week.

    The MaxSamples parameter will tell the Get-Stat cmdlet to return only 100 samples.

    If your samples all come from Historical Interval 2, you will loose some samples since there would be 8 x 48 = 384 samples for the 8 days.

    Note that this number can vary due the consolidation process.

    Also note that since the Get-Stat cmdlet returns the samples in a reverse chronological order, you will get the 100 most recent samples.

    The default of 10 samples for the MaxSamples parameter is not true anymore, at least since PowerCLI 4.

    If you don't specify MaxSamples nor Start and Finish, you will get all available samples from Historical Interval 4, which has a 1 day interval.

    No, there will be no error message if you ask more samples (ex 99999) through MaxSamples then there are available.

    Get-Stat will just return what is available.

    If you uncheck the 2 hours interval (which will automatically uncheck the 1 day interval) you will only be able to get samples from Historical Interval 2, sample time 30 minutes. But at the moment I have no clue how long vSphere will keep the Historical Interval 2 samples.

    From looking at the database table, and confirmed by the Get-Stat cmdlet, the HI2 samples are kept a lot longer than they were in Virtual Center 2.5.

    I hope this clarifies it a bit.



  • 7.  RE: advice on get-stat

    Posted Dec 06, 2009 03:15 PM

    So if choose maxsample values of 100 for a 8 day period, then does that mean I would get only sample values for 4 or 5 days of the 8 day duration, as for 8 days there would be 384 samples, and i am requesting 100, is this correct.

    If i dont choose maxsamples, then I would get all 384 days sample. Is this correct

    ALso you said if I dont specify a maxsample or start or finish, then I would historical interval 4 sample which is 1 days, so bascically will get only sample value. Is this correct

    Its difficult to get your head around it. just want to clarify and can interpret these reports to mgt more clearly.



  • 8.  RE: advice on get-stat
    Best Answer

    Posted Dec 06, 2009 03:26 PM

    Yes, but 100 samples would give approximately 2 days of samples (100 : 48).

    Yes, if you don't specify MaxSamples you get all samples for the requested time range.

    Yes, Historical Interval 4 will return 1 sample per day. And HI4 is the default when there is no IntervalMins/IntervalSecs or Start and Finsh. MaxSamples doesn't influence this (my previous remark on this was not very clear I'm afraid).