{# plugins/snmp/templates/snmp/index.html #} {% extends "base.html" %} {% from "_macros.html" import page_header, status_badge, stat_tile, empty_state %} {% block title %}SNMP — Steward{% endblock %} {% block content %} {{ page_header("SNMP devices", devices|length ~ " device" ~ ("s" if devices|length != 1 else "") ~ " configured") }} {% if not devices %}
{{ empty_state("No SNMP devices configured. Add them to the snmp plugin's plugin.yaml.") }}
{% else %} {% for device in devices %}
{#- reach: answered within the last few polls (up), only long ago (stale), or never (pending); routes._device_state. #} {% if device.reach == 'up' %}{{ status_badge('up', 'Reachable') }} {% elif device.reach == 'stale' %}{{ status_badge('stale', 'No answer', title="The last reading is from " ~ device.at.strftime('%Y-%m-%d %H:%M UTC') ~ "; the values below are from then") }} {% else %}{{ status_badge('pending', 'No data yet') }}{% endif %}

{{ device.name }}

{{ device.host }} {% if device.at %}read {{ device.at|ago }}{% endif %} History
{% if device.readings %}
{% for oid_cfg in device.oids %} {% set label = oid_cfg.label if oid_cfg.label else oid_cfg.oid %} {% set val = device.readings.get(label) %} {{ stat_tile(label, "—" if val is none else ("%.2fM"|format(val / 1000000)) if val >= 1000000 else ("%.1fK"|format(val / 1000)) if val >= 1000 else "%.4g"|format(val)) }} {% endfor %}
{% else %}

No readings yet; waiting for the next poll.

{% endif %}
{% endfor %} {% endif %} {% endblock %}