{# docker/widget_resources.html — the dashboard Busiest Containers widget (#5253, #5214): a verdict naming the busiest, then the top containers by CPU (averaged over the last few minutes, so the order holds still). Each figure carries its unit, beside bars of the last few hours. A row's bars are scaled to its own peak, but never below a floor (1 core, 1 GiB by default), so a container idling at 0.05 cores reads flat and a spike means real load. #} {% macro cores(v) -%}{{ "%.2f"|format(v) if v < 1 else "%.1f"|format(v) }}{%- endmacro %} {% macro bars(b, peak_text, roof_text) -%} {%- endmacro %} {% if not rows %}
| Container | Host | CPU · last {{ hours }}h | Memory · last {{ hours }}h |
|---|---|---|---|
| {%- if session.user_id %}{{ r.label }}{% else %}{{ r.label }}{% endif -%} | {{ r.host_name }} | {{- bars(r.cpu_bars, (cores(r.cpu_bars.peak) ~ " cores") if r.cpu_bars.peak is not none else "", cores(r.cpu_bars.roof) ~ " cores") -}} {% if u.cores is none %}—{% else %}{{ cores(u.cores) }} cores{% endif %} | {{- bars(r.mem_bars, r.mem_bars.peak|bytes if r.mem_bars.peak is not none else "", r.mem_bars.roof|bytes) -}} {% if u.mem_bytes is none %}—{% else %}{{ u.mem_bytes|bytes }}{% endif %} |