show wan uplink (also for aux)

This commit is contained in:
Dominik Heidler 2015-11-05 15:46:27 +01:00
parent 72e3b4a5e2
commit 3daee38a7c
2 changed files with 11 additions and 4 deletions

View File

@ -16,11 +16,12 @@ db = FreifunkDB().handle()
CONFIG = {
"vpn_netif": "fffVPN",
"vpn_netif_aux": "fffauxVPN",
}
def import_nodewatcher_xml(mac, xml):
try:
router = db.routers.find_one({"netifs.mac": mac.lower()}, {"stats": 0})
router = db.routers.find_one({"netifs.mac": mac.lower()}, {"stats": 0, "events": 0})
if router:
router_id = router["_id"]
@ -176,7 +177,9 @@ def parse_nodewatcher_xml(xml):
"total": int(tree.xpath("/data/system_data/processes/text()")[0].split("/")[1]),
},
"clients": int(tree.xpath("/data/client_count/text()")[0]),
"has_wan_uplink": len(tree.xpath("/data/interface_data/fffVPN")) > 0,
"has_wan_uplink": (
len(tree.xpath("/data/interface_data/%s" % CONFIG["vpn_netif"])) > 0
or len(tree.xpath("/data/interface_data/%s" % CONFIG["vpn_netif_aux"])) > 0),
},
"hardware": {
"chipset": tree.xpath("/data/system_data/chipset/text()")[0],

View File

@ -19,7 +19,7 @@
padding-left: 5px;
}
#map {
height: 400px;
height: 405px;
width: 100%;
}
.navbar, .table-condensed {
@ -42,7 +42,7 @@
{% endblock %}
{% block content %}
<h1>Router: {{ router.hostname }}</h1>
<h2>Router: {{ router.hostname }}</h2>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
@ -79,6 +79,9 @@
<table class="table table-condensed">
<tr><th>Hostname</th><td>{{ router.hostname }}</td></tr>
<tr><th>Status</th><td><span class="{{ router.status|status2css }}">{{ router.status }}</span></td></tr>
<tr><th>Created</th><td>
{{ router.created|utc2local|format_dt }}
</td></tr>
<tr><th>Last contact</th><td>
{{ router.last_contact|utc2local|format_dt }}
({{ router.last_contact|format_dt_ago }})
@ -96,6 +99,7 @@
<tr><th>User</th><td>{{ router.user.nickname }}</td></tr>
{%- endif %}
<tr><th>Hardware</th><td>{{ router.hardware.name }} ({{ router.hardware.chipset }})</td></tr>
<tr><th>WAN Uplink</th><td><span class="{{ "glyphicon glyphicon-ok" if router.system.has_wan_uplink else "glyphicon glyphicon-remove" }}"></span></td></tr>
<tr><th>Clients</th><td>{{ router.system.clients }}</td></tr>
</table>
</div>