Hello,
i have a "mind-Problem" of one Vmware stat. ;(
i don't get the correct value for ready.summation in %
normaly the interval looks like:
live = 20secs
Day = 300secs
Week = 1800 Secs
Month = 7200 Secs
Year = 86400 Secs
to convert the Secs in % value (because 1000ms are 5% value which are documented in vmware support docu)
so therefore i made the convertion like:
Dayli:
ms/200 (therefore i manually get the correct value)
bit during the script i get wrong outputs and i don't know why following points are not working
- Livestats (LVReadyMS)
- LVReady%,DAReady%, WAReady%,MAReady%, YAReady%
- Math Round not work for $DaReadyMS, $WAReadyMS, $MAReadyMS, $YAReadyMS
so in this case i get for example dayli report for 1x vm a "Summation Value" of 3800ms
MS =3800/3000
so therefore i get "127" - but should be "1,27" .
i don't know why the 3 errors are appearing ;(
May somebody could help me outta to remove my wrong minding?
Have many thx
Markus
The 'summation' rollup is only available in aggregated intervals. In other words you can only use that metric for historical intervals, not for the realtime interval.
The Round function doesn't do anything because at that point in the script you have the value in a string format.
That is due to the -f (format) operator you use in the VM-statavgDAY function.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
Of course the Realtime values are available.
the invervals are in "20"secs.
so manually i get the datas.
(get-vm vmname |get-stat -stat cpu.ready.summation -Realtime -IntervalSecs 20 |measure-object value -ave).average
so but in the script it don't work - don't know why.
- how do i have to change the -f function that i have only digits without comma?
- why is the calculation not correct working for the Ready% ;( ( i think theire is the problem with the Comma of the MS values which i tryed to round)
Many thx
Max
Ok, I stand corrected. The cpu.ready.summation metric exists in the Realtime interval but you will not get any data the way you used the Get-Stat cmdlet.
$vmImpl | get-stat -Stat $statId -realtime -IntervalSecs 20 -Maxsamples 360 ` -Start $StatStart -Finish $StatFinish
Your $StatStart and $StatFinish specify the complete day yesterday which is of course not available in the Realtime interval (which only has data for the last 1-2 hours). Drop the -Start and -Finish parameters and you'll be fine.
I would suggest to not do the formatting of the values in tha functions, but only at the moment you assign the value to one of the properties.
Somethng like this
... function VM-statavgLIVE ($vmImpl, $StatStart, $StatFinish, $statId) { $stats = $vmImpl | get-stat -Stat $statId -realtime -IntervalSecs 20 -Maxsamples 360 ($stats | Measure-Object value -average).average } ... $LVReadyMS = VM-statavgLIVE $_ $DayStart $DayFinish "cpu.ready.summation" $MyObjVM.LVReadyMS = [math]::Round(LVReadyMS,2) $MyObjVM."LVReady%" = [math]::Round($LVReadyMS*5,0) ...
In the Round function you can also specify how many decimal positions you want to keep (I selected 2 in the first call and 0 in the 2nd call).
I think your convertion from seconds to percentages is not correct.
Simple rule of three:
20 secs - 100%
1 sec - 100% / 20 or 5%
x secs - (100% / 20) * x or 5 * x to get the percentage
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Lucd,
thx for your hints, i will go through this hints during the weekend
But for the conversion.
Primary i made following calculation first:
(MS/1000)/intervalsecs*100
From the technotes i got:
%ready = (readyTime * 100) /statsIntervalPeriodInMilliSeconds
i don't find the internetsite any more but theire was the info that it's also possible to calculate only X/200 for Realtime for example.
so only additional "0"
Realtime: MS/200
dayli: MS/3000
Many thx, i will test your advices
Until then have a very nice weekend
best Regards
max