X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fview%2Fadmin_status%2Findex.htm;h=bfaad75bfa3ce0896934bcbadd88f3cc120b7385;hp=b26d17a9c10e85dd8985dd7b395865c9419d7ba3;hb=e9a357ed781d1334f0200f00617475e4f3a047b7;hpb=7c765875884d6866c53b63757731b079bace2e9b diff --git a/modules/admin-full/luasrc/view/admin_status/index.htm b/modules/admin-full/luasrc/view/admin_status/index.htm index b26d17a9c..bfaad75bf 100644 --- a/modules/admin-full/luasrc/view/admin_status/index.htm +++ b/modules/admin-full/luasrc/view/admin_status/index.htm @@ -1,7 +1,7 @@ <%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich +Copyright 2008-2011 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -12,8 +12,554 @@ You may obtain a copy of the License at $Id$ -%> + +<% + require "luci.fs" + require "luci.tools.status" + + local has_ipv6 = luci.fs.access("/proc/net/ipv6_route") + local has_dhcp = luci.fs.access("/etc/config/dhcp") + local has_wifi = luci.fs.stat("/etc/config/wireless") + has_wifi = has_wifi and has_wifi.size > 0 + + if luci.http.formvalue("status") == "1" then + local ntm = require "luci.model.network".init() + local dr4 = luci.sys.net.defaultroute() + local dr6 = luci.sys.net.defaultroute6() + local wan, wan6 + + if dr4 and dr4.device then + wan = ntm:get_interface(dr4.device) + wan = wan and wan:get_network() + end + + if dr6 and dr6.device then + wan6 = ntm:get_interface(dr6.device) + wan6 = wan6 and wan6:get_network() + end + + local _, _, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo() + + local conn_count = tonumber(( + luci.sys.exec("wc -l /proc/net/nf_conntrack") or + luci.sys.exec("wc -l /proc/net/ip_conntrack") or + ""):match("%d+")) or 0 + + local conn_max = tonumber(( + luci.sys.exec("sysctl net.nf_conntrack_max") or + luci.sys.exec("sysctl net.ipv4.netfilter.ip_conntrack_max") or + ""):match("%d+")) or 4096 + + local rv = { + uptime = luci.sys.uptime(), + localtime = os.date(), + loadavg = { luci.sys.loadavg() }, + memtotal = memtotal, + memcached = memcached, + membuffers = membuffers, + memfree = memfree, + connmax = conn_max, + conncount = conn_count, + leases = luci.tools.status.dhcp_leases(), + wifinets = luci.tools.status.wifi_networks() + } + + if wan then + rv.wan = { + ipaddr = wan:ipaddr(), + gwaddr = wan:gwaddr(), + netmask = wan:netmask(), + dns = wan:dnsaddrs(), + expires = wan:expires(), + uptime = wan:uptime(), + proto = wan:proto(), + ifname = wan:ifname(), + link = wan:adminlink() + } + end + + if wan6 then + rv.wan6 = { + ip6addr = wan6:ip6addr(), + gw6addr = wan6:gw6addr(), + dns = wan6:dns6addrs(), + uptime = wan6:uptime(), + ifname = wan6:ifname(), + link = wan6:adminlink() + } + end + + luci.http.prepare_content("application/json") + luci.http.write_json(rv) + + return + end + + local system, model = luci.sys.sysinfo() +-%> + <%+header%> + + + +

<%:Status%>

-

<%:Here you can find information about the current system status like CPU clock frequency, memory usage or network interface data.%>

-

<%:Also kernel or service logfiles can be viewed here to get an overview over their current state.%>

-<%+footer%> \ No newline at end of file + +
+ <%:System%> + + + + + + + + + +
<%:Router Name%><%=luci.sys.hostname() or "?"%>
<%:Router Model%><%=pcdata(model or "?")%>
<%:Firmware Version%> + <%=pcdata(luci.version.distname)%> <%=pcdata(luci.version.distversion)%> / + <%=pcdata(luci.version.luciname)%> <%=pcdata(luci.version.luciversion)%> +
<%:Kernel Version%><%=luci.sys.exec("uname -r")%>
<%:Local Time%>-
<%:Uptime%>-
<%:Load Average%>-
+
+ +
+ <%:Memory%> + + + + + + +
<%:Total Available%>-
<%:Free%>-
<%:Cached%>-
<%:Buffered%>-
+
+ +
+ <%:Network%> + + + + <% if has_ipv6 then %> + + <% end %> + +
<%:IPv4 WAN Status%> + + + +

?
<%:Collecting data...%>
+
<%:IPv6 WAN Status%> + + + +

?
<%:Collecting data...%>
+
<%:Active IP Connections%>-
+
+ +<% if has_dhcp then %> +
+ <%:DHCP Leases%> + + + + + + + + + + + +
<%:Hostname%><%:IPv4-Address%><%:MAC-Address%><%:Leasetime remaining%>

<%:Collecting data...%>
+
+<% end %> + +<% if has_wifi then %> +
+ <%:Wireless%> + + + +
<%:Collecting data...%>
+
+ +
+ <%:Associated Stations%> + + + + + + + + + + + + +
 <%:BSSID%><%:Network%><%:Signal%><%:Noise%>

<%:Collecting data...%>
+
+<% end %> + +<%+footer%>