From 84788deadda44eec9e3cfc450f93f6c92236aa37 Mon Sep 17 00:00:00 2001 From: Ignace Date: Wed, 12 Aug 2026 08:25:58 +0200 Subject: [PATCH] better y-axis range --- generate_graphs.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/generate_graphs.py b/generate_graphs.py index 2dabb66..f5ee95f 100755 --- a/generate_graphs.py +++ b/generate_graphs.py @@ -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}"