{% macro fmt_bytes(b) %}
{%- if b < 1048576 %}{{ "%.1f"|format(b/1024) }} KB
{%- elif b < 1073741824 %}{{ "%.1f"|format(b/1048576) }} MB
{%- else %}{{ "%.2f"|format(b/1073741824) }} GB
{%- endif %}
{%- endmacro %}
{% for iface in interfaces %}
{% if iface.name not in ['lo'] %}
{{ iface.name }}
| RX | {{ fmt_bytes(iface.rx_bytes) }} | {{ "{:,}".format(iface.rx_packets) }} pkt |
| TX | {{ fmt_bytes(iface.tx_bytes) }} | {{ "{:,}".format(iface.tx_packets) }} pkt |
{% if iface.rx_drops > 0 or iface.tx_drops > 0 %}
| ⚠ {{ iface.rx_drops + iface.tx_drops }} drops |
{% endif %}
{% endif %}
{% endfor %}