{% extends "base.html" %}{% set active = 'topology' %} {% block title %}Topology · lanwatch{% endblock %} {% block content %}

Topology

{% if not unifi_enabled %}

The topology comes from the UniFi controller, and [unifi] is off. See docs/unifi.md for the API key and the three lines of config.

{% elif topo is none %}

No controller data yet. The infra round reads the controller every {{ config.schedule.infra_interval_s // 60 }} minutes; lanwatch unifi does it now.{% if unifi_error %} Last attempt failed: {{ unifi_error }}{% endif %}

{% else %}

{{ topo.devices }} UniFi device{{ 's' if topo.devices != 1 }}{% if topo.offline %} ({{ topo.offline }} offline){% endif %}, {{ topo.clients }} client{{ 's' if topo.clients != 1 }}{% if topo.unknown_clients %}, {{ topo.unknown_clients }} of them never seen by lanwatch{% endif %}. Gateway on the left, access points and switches beside it, clients under the device they hang off. Each client's network is written under its name.{% if unifi_error %} Last read failed {{ unifi_error }}; this is the previous state.{% endif %}

{% if topo.legend | length > 1 %} {% endif %}
Network topology {{ topo.devices }} UniFi devices and {{ topo.clients }} clients, drawn as a tree from the gateway. The same tree follows as a list. {% for x1, y1, x2, y2 in topo.edges %} {% endfor %} {% for n in topo.nodes %} {% set body %} {{ n.label | truncate(26, true, '…') }} {% set note = (n.network if n.kind == 'client' else n.sub) or '' %}{% if n.offline %}{% set note = 'offline' %}{% elif n.guest %}{% set note = 'guest · ' ~ note %}{% endif %} {% if note %}{{ note | truncate(16, true, '…') }}{% endif %}{% endset %} {% if n.device_id is not none %}{{ body }}{% else %}{{ body }}{% endif %} {% endfor %}

As a list

{% macro branch(node) %}
  • {{ node.label }}{% if node.device_id is not none %} #{{ node.device_id }}{% endif %} {% if node.kind in ('gateway', 'ap', 'switch') %}{{ {'gateway': 'gateway', 'ap': 'access point', 'switch': 'switch'}[node.kind] }}{% if node.offline %} {{ node.state | lower | replace('_', ' ') }}{% endif %}{% if node.sub %} {{ node.sub }}{% endif %} {% elif node.kind == 'client' %}{{ node.sub }}{% if node.network %} · {{ node.network }}{% endif %} · {{ 'wired' if node.wired else 'wireless' }}{% if node.guest %} · guest{% endif %}{% endif %} {% if node.children %}
      {% for c in node.children %}{{ branch(c) }}{% endfor %}
    {% endif %}
  • {% endmacro %}
      {% for r in topo.tree %}{{ branch(r) }}{% endfor %}
    {% endif %} {% endblock %}