How to anticipate the time before disk space would be close to exhaustion?
I have a task to make alerts if there’s free disk space for only 2 hours for dinamycally growing directory.
Honestly I don’t know what’s the best way to it.
I’m not sure if the space will grow linearly and there would not be sharp jumps.
If you don’t know whether the rate is constant or has sharp spikes, you can’t know for sure.
It is difficult to make predictions, especially about the future.
The simplest and relatively accurate rule for resource exhaustion is the "yesterday’s weather" rule. Accumulate info about the past to inform your prediction algorithm.
One easy measure would be the current "resource exhaustion rate", i.e. how much disk space you consumed during the last 2 hours and assuming that the rate does not change. Under that assumption, you can make a good guess about the remaining time until a disk is full.
In real-life business operations with daily, weekly and yearly cycles you might want to keep statistics for time-of-day, day-of-week, and month-of-year to account for effects such as nightly data processing starting at 9 PM, or heightened activity at the beginning or end of the week, or Black Friday hystery.