diff --git a/process_queue b/process_queue index 3510ae2..c1973e8 100644 --- a/process_queue +++ b/process_queue @@ -2,6 +2,7 @@ import logging import logging.config +import math import os import socket import statistics @@ -53,6 +54,15 @@ class DiskFullPredictor: log.info("d = %s, current_used_bytes = %s, current_usable_bytes = %s", m, current_used_bytes, current_usable_bytes) tuf = now - lts.data[i][0] break + else: + # XXX - this is probably a range, so maybe we should use some kind + # of average. It might also be zero, so maybe we have to search for + # the first non-zero value? For now keep it simple. + first_used_bytes = lts.data[0][1] + historic_growth = current_used_bytes / first_used_bytes + future_growth = current_usable_bytes / current_used_bytes + tuf = math.log(future_growth) / math.log(historic_growth) * (now - lts.data[0][0]) + tuf = max(tuf, now - lts.data[0][0]) desc = {**lts.description, "measure": "time_until_disk_full", "node": node,