<%# Copyright 2008 Steven Barth Copyright 2008-2011 Jo-Philipp Wich Licensed to the public under the Apache License 2.0. -%> <% local fs = require "nixio.fs" local util = require "luci.util" local stat = require "luci.tools.status" local ver = require "luci.version" local has_ipv6 = fs.access("/proc/net/ipv6_route") local has_dhcp = fs.access("/etc/config/dhcp") local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0) local sysinfo = luci.util.ubus("system", "info") or { } local boardinfo = luci.util.ubus("system", "board") or { } local unameinfo = nixio.uname() or { } local meminfo = sysinfo.memory or { total = 0, free = 0, buffered = 0, shared = 0 } local swapinfo = sysinfo.swap or { total = 0, free = 0 } local has_dsl = fs.access("/etc/init.d/dsl_control") if luci.http.formvalue("status") == "1" then local ntm = require "luci.model.network".init() local wan = ntm:get_wannet() local wan6 = ntm:get_wan6net() 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 = sysinfo.uptime or 0, localtime = os.date(), loadavg = sysinfo.load or { 0, 0, 0 }, loadavg1 = sysinfo.load or { 0, 0, 0 }, loadavg2 = sysinfo.load or { 0, 0, 0 }, loadavg3 = sysinfo.load or { 0, 0, 0 }, memory = meminfo, swap = swapinfo, connmax = conn_max, conncount = conn_count, leases = stat.dhcp_leases(), leases6 = stat.dhcp6_leases(), wifinets = stat.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 if has_dsl then local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat") local dsl_func = loadstring(dsl_stat) rv.dsl = dsl_func() end luci.http.prepare_content("application/json") luci.http.write_json(rv) return end -%> <%+header%>

<%:Status%>

<%:System%>
<%:Hostname%><%=luci.sys.hostname() or "?"%>
<%:Model%>S001
<%:Serial Number%><%=luci.sys.exec("cut -d \' \' -f 5 /proc/cmdline | cut -d \'=\' -f2") or "?"%>
<%:Firmware Version%>v1.51 SP1 <%:+ Hotfix %><%=luci.sys.exec("cat /.hf_date | cut -c5-10") or "?"%>
<%:Operating Mode%>UTM <%=luci.sys.exec("cat /.shield_mode") or "unknown"%>
<%:Local Time%>-
<%:IPS Last Updated%><%=luci.sys.exec("ls -alst /etc/snort/rules/snort.rules | cut -c52-58") or "?"%>
<%:Web Filter Last Updated%><%=luci.sys.exec("ls -alst /etc/itus/lists/ads | cut -c52-58") or "?"%>
<%:Shield Update Last Run%><%=luci.sys.exec("cat /.do_date .version | cut -c5-10,29-51") or "?"%>
<%:Fw_upgrade version%><%=luci.sys.exec("cat /.version ") or "?"%>
<%:Uptime%>-
<%:Memory%>
<%:Total Available%>-
<%:Free%>-
<%:Buffered%>-
<% if swapinfo.total > 0 then %>
<%:Swap%>
<%:Total Available%>-
<%:Free%>-
<% end %>
<%:Network%> <% if has_ipv6 then %> <% end %>
<%:IPv4 Status%>

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

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

<%:Collecting data...%>
<% end %> <% if has_dsl then %>
<%:ADSL%>
<%:ADSL Status%>

?
<%:Collecting data...%>
<% end %> <% if has_wifi then %>
<%:Wireless%>
<%:Collecting data...%>
<%:Associated Stations%>
  <%:MAC-Address%> <%:Network%> <%:Signal%> <%:Noise%> <%:RX Rate%> <%:TX Rate%>

<%:Collecting data...%>
<% end %> <%- local incdir = util.libpath() .. "/view/admin_status/index/" if fs.access(incdir) then local inc for inc in fs.dir(incdir) do if inc:match("%.htm$") then include("admin_status/index/" .. inc:gsub("%.htm$", "")) end end end -%> <%+footer%>