diff --git a/docker/routlin-dash/app/pages/dhcpleases/content.json b/docker/routlin-dash/app/pages/dhcpleases/content.json index 4cf7e03..c60a91d 100644 --- a/docker/routlin-dash/app/pages/dhcpleases/content.json +++ b/docker/routlin-dash/app/pages/dhcpleases/content.json @@ -45,13 +45,17 @@ "field": "mac_address", "class": "col-mono" }, + { + "label": "Vendor", + "field": "vendor" + }, { "label": "VLAN", "field": "vlan_name" }, { - "label": "Obtained", - "field": "obtained" + "label": "Last Active", + "field": "last_active" }, { "label": "Expires", diff --git a/docker/routlin-dash/app/view_page.py b/docker/routlin-dash/app/view_page.py index 166171b..2b2e998 100644 --- a/docker/routlin-dash/app/view_page.py +++ b/docker/routlin-dash/app/view_page.py @@ -16,6 +16,20 @@ HEALTH_FILE = os.path.join(CONFIGS_DIR, '.health') bp = Blueprint('view_page', __name__) +try: + import manuf as _manuf_mod + _mac_parser = _manuf_mod.MacParser() +except Exception: + _mac_parser = None + +def _get_vendor(mac): + if _mac_parser is None: + return '' + try: + return _mac_parser.get_manuf(mac) or '' + except Exception: + return '' + # File loaders ====================================================== @@ -221,8 +235,9 @@ def live_dhcp_leases(): 'hostname': hostname_html, 'ip_address': parts[2], 'mac_address': parts[1], + 'vendor': _get_vendor(parts[1]), 'vlan_name': vlan_name, - 'obtained': obtained, + 'last_active': obtained, 'expires': relative_time_future(expiry), 'recent': recent, }) diff --git a/docker/routlin-dash/requirements.txt b/docker/routlin-dash/requirements.txt index bb2793b..1cdb17b 100644 --- a/docker/routlin-dash/requirements.txt +++ b/docker/routlin-dash/requirements.txt @@ -1,2 +1,3 @@ flask bcrypt +manuf