better y-axis range

This commit is contained in:
2026-08-12 08:25:58 +02:00
parent 925f35da2b
commit 84788deadd
+16 -2
View File
@@ -22,10 +22,22 @@ def graph(output: Path, rrd: Path, start: str, title: str, unit: str,
trouble_mixed: bool = False) -> None:
args = ["rrdtool", "graph", str(output), "--start", f"end-{start}",
"--end", "now", "--width", "900", "--height", "260",
"--title", title, "--vertical-label", unit, "--slope-mode",
"--title", title, "--vertical-label", unit,
"--watermark", "cheap-system-monitor"]
if not trouble_mixed:
args.append("--slope-mode")
if logarithmic:
args += ["--logarithmic", "--lower-limit", "1"]
if title.startswith("Processor load"):
# RRD's `m` axis suffix means milli-load: 1000m is a load of 1.0.
args += ["--lower-limit", "0", "--upper-limit", "1", "--rigid",
"--units-exponent", "-3"]
if title.startswith("CPU usage"):
args += ["--lower-limit", "0", "--upper-limit", "80", "--rigid"]
if trouble_mixed:
args += ["--lower-limit", "0", "--upper-limit", "20", "--rigid"]
if disk_memory:
args += ["--lower-limit", "0", "--upper-limit", "100", "--rigid"]
if thermal_mixed:
args += ["--lower-limit", "0", "--upper-limit", "100", "--rigid"]
if any(ds.startswith("health_") for ds, _label, _cf in series):
@@ -51,7 +63,9 @@ def graph(output: Path, rrd: Path, start: str, title: str, unit: str,
f"GPRINT:{var}:AVERAGE:Average\\:%8.2lf",
f"GPRINT:{var}:MAX:Maximum\\:%8.2lf\\n"]
continue
if network_mixed and ds == "net_out":
if trouble_mixed and ds == "failed_services":
drawing = f"AREA:{var}#2563EB80:{label}"
elif network_mixed and ds == "net_out":
drawing = f"AREA:{var}#86EFAC:{label}"
elif network_mixed and ds == "net_in":
drawing = f"LINE3:{var}#2563EB:{label}"