Compare commits
2 Commits
a95ba6c51f
...
206be6a8fa
Author | SHA1 | Date |
---|---|---|
|
206be6a8fa | |
|
2e8641ad18 |
10
dashboard.py
10
dashboard.py
|
@ -139,9 +139,13 @@ class TimeSeries(Widget):
|
||||||
|
|
||||||
def v2y(v):
|
def v2y(v):
|
||||||
if self.yscale == "log":
|
if self.yscale == "log":
|
||||||
return (1 - math.log(v / min_value)
|
try:
|
||||||
/ math.log(max_value / min_value)
|
return (1 - math.log(max(v, min_value) / min_value)
|
||||||
) * 200
|
/ math.log(max_value / min_value)
|
||||||
|
) * 200
|
||||||
|
except ValueError:
|
||||||
|
log.error(f"ValueError: v = {v}, min_value = {min_value}, max_value = {max_value}")
|
||||||
|
return 0
|
||||||
elif self.yscale == "linear":
|
elif self.yscale == "linear":
|
||||||
return (1 - v/max_value) * 200
|
return (1 - v/max_value) * 200
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -4,6 +4,7 @@ import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
import statistics
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from ltsdb_json import LTS
|
from ltsdb_json import LTS
|
||||||
|
@ -44,12 +45,13 @@ class DiskFullPredictor:
|
||||||
current_used_bytes = lts.data[-1][1]
|
current_used_bytes = lts.data[-1][1]
|
||||||
current_usable_bytes = usable_lts.data[-1][1]
|
current_usable_bytes = usable_lts.data[-1][1]
|
||||||
tuf = 1E9
|
tuf = 1E9
|
||||||
for d in reversed(lts.data):
|
for i in reversed(range(len(lts.data))):
|
||||||
if d[1] < current_usable_bytes * 0.1:
|
m = statistics.mean(x[1] for x in lts.data[max(0, i - 2) : min(len(lts.data), i + 3)])
|
||||||
|
if m < current_usable_bytes * 0.1:
|
||||||
continue # for sanity
|
continue # for sanity
|
||||||
if current_used_bytes ** 2 / d[1] > current_usable_bytes:
|
if current_used_bytes ** 2 / m > current_usable_bytes:
|
||||||
log.info("d = %s, current_used_bytes = %s, current_usable_bytes = %s", d, current_used_bytes, current_usable_bytes)
|
log.info("d = %s, current_used_bytes = %s, current_usable_bytes = %s", m, current_used_bytes, current_usable_bytes)
|
||||||
tuf = now - d[0]
|
tuf = now - lts.data[i][0]
|
||||||
break
|
break
|
||||||
desc = {**lts.description,
|
desc = {**lts.description,
|
||||||
"measure": "time_until_disk_full",
|
"measure": "time_until_disk_full",
|
||||||
|
|
Loading…
Reference in New Issue