What does `predict_linear()` do?
IntermediateConceptPromQL & Recording Rules
Answer
It fits a linear regression over a range of a gauge and predicts the value N seconds ahead. Classic use, disk filling within 4 hours:
predict_linear(node_filesystem_avail_bytes{fstype!~"tmpfs|overlay"}[6h], 4 * 3600) < 0
Combine with a minimum free-space condition to avoid alerts on brief write bursts. deriv() gives the per-second slope of a gauge (do not use rate() on gauges).
More on PromQL & Recording Rules
What are the PromQL data types?BeginnerWhat label matchers does PromQL support?BeginnerExplain `rate()`.Beginner`rate()` vs `irate()`: what is the difference?IntermediateWhat does `increase()` return and why is it sometimes a non-integer?IntermediateWhy must you `rate()` before `sum()`, never the reverse?Intermediate