fix: beszel storage fallback from dp/du stats fields
This commit is contained in:
@@ -156,6 +156,20 @@ class BeszelClient(BaseHTTPClient):
|
||||
or details.get("mounts")
|
||||
or []
|
||||
)
|
||||
if not disks and self._as_float(stats.get("dp")) > 0:
|
||||
disk_pct = self._as_float(stats.get("dp"))
|
||||
disk_used = self._as_float(stats.get("du"))
|
||||
disk_total = round(disk_used / (disk_pct / 100), 1) if disk_pct > 0 else 0.0
|
||||
disk_free = round(max(disk_total - disk_used, 0.0), 1)
|
||||
logger.info("beszel storage fallback: using dp=%.1f du=%.1f from stats", disk_pct, disk_used)
|
||||
disks = [BeszelDiskMetric(
|
||||
name="rootfs",
|
||||
mount="/",
|
||||
used_gb=disk_used,
|
||||
total_gb=disk_total,
|
||||
free_gb=disk_free,
|
||||
usage_percent=disk_pct,
|
||||
)]
|
||||
if not disks:
|
||||
logger.info("beszel storage unsupported: no disks/mounts in payload")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user