gluon-status-page: add gateway_nexthop to statistics

This commit is contained in:
lemoer 2019-12-05 17:00:59 +01:00 committed by Martin Weinelt
parent aa679bc6e9
commit 82082d8c62
5 changed files with 29 additions and 2 deletions

View File

@ -135,7 +135,7 @@
<tr><th><%:Load average%></th><td><%= statistics('loadavg', 'decimal') %></td></tr> <tr><th><%:Load average%></th><td><%= statistics('loadavg', 'decimal') %></td></tr>
<tr><th><%:RAM%></th><td><%= statistics('memory', 'memory') %></td></tr> <tr><th><%:RAM%></th><td><%= statistics('memory', 'memory') %></td></tr>
<tr><th><%:Filesystem%></th><td><%= statistics('rootfs_usage', 'percent') %></td></tr> <tr><th><%:Filesystem%></th><td><%= statistics('rootfs_usage', 'percent') %></td></tr>
<tr><th><%:Gateway%></th><td><%= statistics('gateway') %></td></tr> <tr><th><%:Gateway%></th><td><%= statistics('gateway') %><br /><%= statistics('gateway_nexthop', 'neighbour') %></td></tr>
<tr><th><%:Clients%></th><td><%= statistics('clients/total') %></td></tr> <tr><th><%:Clients%></th><td><%= statistics('clients/total') %></td></tr>
</table> </table>

File diff suppressed because one or more lines are too long

View File

@ -55,6 +55,9 @@ msgstr "Weitergeleitet"
msgid "Gateway" msgid "Gateway"
msgstr "Gateway" msgstr "Gateway"
msgid "Gateway Nexthop"
msgstr "Gateway Nexthop"
msgid "IP address" msgid "IP address"
msgstr "IP-Adresse" msgstr "IP-Adresse"

View File

@ -46,6 +46,9 @@ msgstr ""
msgid "Gateway" msgid "Gateway"
msgstr "" msgstr ""
msgid "Gateway Nexthop"
msgstr ""
msgid "IP address" msgid "IP address"
msgstr "" msgstr ""

View File

@ -112,6 +112,20 @@
'bytes': function(bytes) { 'bytes': function(bytes) {
return prettyBytes(bytes); return prettyBytes(bytes);
}, },
'neighbour': function(addr) {
if (!addr)
return '';
for (var i in interfaces) {
var iface = interfaces[i];
var neigh = iface.lookup_neigh(addr);
if (!neigh)
continue;
return 'via ' + neigh.get_hostname() + ' (' + i + ')';
}
return 'via ' + addr + ' (unknown iface)';
}
} }
@ -582,6 +596,9 @@
} }
return { return {
'get_hostname': function() {
return hostname.textContent;
},
'update_nodeinfo': function(nodeinfo) { 'update_nodeinfo': function(nodeinfo) {
var addr = choose_address(nodeinfo.network.addresses); var addr = choose_address(nodeinfo.network.addresses);
if (addr) { if (addr) {
@ -711,6 +728,9 @@
} }
} }
function lookup_neigh(addr) {
return neighs[addr];
}
function get_neigh(addr) { function get_neigh(addr) {
var neigh = neighs[addr]; var neigh = neighs[addr];
@ -738,6 +758,7 @@
return { return {
'get_neigh': get_neigh, 'get_neigh': get_neigh,
'lookup_neigh': lookup_neigh
}; };
} }