{% 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 }} {% if iface.rx_drops > 0 or iface.tx_drops > 0 %} {% endif %}
RX{{ fmt_bytes(iface.rx_bytes) }}{{ "{:,}".format(iface.rx_packets) }} pkt
TX{{ fmt_bytes(iface.tx_bytes) }}{{ "{:,}".format(iface.tx_packets) }} pkt
⚠ {{ iface.rx_drops + iface.tx_drops }} drops
{% endif %} {% endfor %}