HI all,
I have not started this yet, but I want to develop a script to help forecast when storage will need to be added to a cluster.
I will get out total available storage disk space from a cluster:
$row."Available Disk Space (GB)" = ($ds | Measure-Object -Property FreeSpaceMB -Sum).Sum/1024
then over samples of this data, find the rate of decrease, then based on that, predict the amount of time (in days, or give a date date) that new storage will need to be added to the cluster. The main goal here will be to send out a email to me let me know I have to add storage on some date, or in so many days.
Rate of decrease formula
% change = (x2 - x1)/x1
Where, x2 = current value, x1 = previous value
Does this make sense? Has anyone done something like this before?
While what you propose could be done with PowerCLI, you would need to either have the script running in a perpetual loop or schedule it to run every day/hour/minutes. I would recommend using vCenter alarms as cost effective easy solution, but that depends upon how you would view storage. It depends upon if you look at them individually or as a cluster of storage. Lastly, tools like vCenter Operations Manager would be highly recommended.
Yes, its does make sense, but no I have not done anything like this before....but if I did it would probably look something like this.
Granted this is just from the mathematical side of things.
First you need to decide one thing, and that is how you want to measure the storage. You can do this either by measuring the amount left, in which case the end result, or result you are measuring for would be 0. OR you are going to measure by the actual storage being used, in which case the end result would be the max that datastore/vmdk(whatever you want to forecast) can hold.
That being said I would first pick a day and setup a csv with the values you want measure, in this case it would probably be something like the StorageName, AmountUsed(Or Remaining), and the Date it was measured on....Next you would want to setup a scheduled task to run, whenever you want the measurements taken.
The math would look something like this
dc=the date or (Get-Date)
dp=the previous date measured
xc=is the current storage amount
xp=is the previous storage amount
xf= the final storage amount which is either 0 or the max as explain ealier
t=is the time until you reach xf
the equation would look something like this...
xc + [(xc - xp)/(dc-dp)]* t=xf
and solve for t
(xf - xc) * {(dc-dp)/(xc - xp)} = t
I hope this makes sense. Also the value of t in this scenario should always be positive....so if it is negative....it means you aren't running out of space, you are gaining space.
Once you have t you can add it to the current get-date to get when the storage will run out....
One more quick side note. when doing get-date, set each of them up as a variable and when you subtract them get the .totaldays property....
Hope this helps...let me know!