diff --git a/steward/templates/_macros.html b/steward/templates/_macros.html index 2867b70..d5666f1 100644 --- a/steward/templates/_macros.html +++ b/steward/templates/_macros.html @@ -29,3 +29,12 @@ {%- elif value is not none and value >= warn -%}color:var(--yellow);font-weight:600; {%- endif -%} {%- endmacro %} + +{# Inverted emphasis for "higher is better" metrics like uptime %: amber below + `warn`, red below `crit`. The mirror of metric_style — same one-place-for- + thresholds discipline, opposite direction. Defaults suit SLA percentages. #} +{% macro uptime_style(value, warn=99.0, crit=95.0) -%} +{%- if value is not none and value < crit -%}color:var(--red);font-weight:700; +{%- elif value is not none and value < warn -%}color:var(--yellow);font-weight:600; +{%- endif -%} +{%- endmacro %} diff --git a/steward/templates/hosts/overview_widget.html b/steward/templates/hosts/overview_widget.html index 2a4868a..581d2db 100644 --- a/steward/templates/hosts/overview_widget.html +++ b/steward/templates/hosts/overview_widget.html @@ -1,7 +1,7 @@ {# Unified Hosts widget — monitor status + agent glance per host, links to the hub. Name sits on its own line (never truncated); its data wraps beneath it, grouped under the host. Prefer vertical growth over cramming a row. #} -{% from "_macros.html" import metric_style %} +{% from "_macros.html" import metric_style, uptime_style %} {% if hosts %}