Looks like the answer was right in front of my eyes.
For others in a similar position;
The file that deals with the Overview page, which is the one I was referring to in my post is:
/usr/lib/lua/luci/view/admin_status/index.htm (On live target)
This file has XHR.poll(...) which polls for data every 5 seconds, but this request seems to end up running the lua code above in this same file:
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(
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
local conn_max = tonumber(luci.sys.exec(
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
):match("%d+")) or 4096
local rv = {
uptime = sysinfo.uptime or 0,
localtime = os.date(),
loadavg = sysinfo.load or { 0, 0, 0 },
memory = meminfo,
swap = swapinfo,
connmax = conn_max,
conncount = conn_count,
wifinets = stat.wifi_networks()
}
if wan then
local dev = wan:get_interface()
local link = dev and ipc.link(dev:name())
rv.wan = {
ipaddr = wan:ipaddr(),
gwaddr = wan:gwaddr(),
netmask = wan:netmask(),
dns = wan:dnsaddrs(),
expires = wan:expires(),
uptime = wan:uptime(),
proto = wan:proto(),
i18n = wan:get_i18n(),
ifname = wan:ifname(),
link = wan:adminlink(),
mac = dev and dev:mac(),
type = dev and dev:type(),
name = dev and dev:get_i18n(),
ether = link and link.type == 1
}
end
if wan6 then
local dev = wan6:get_interface()
local link = dev and ipc.link(dev:name())
rv.wan6 = {
ip6addr = wan6:ip6addr(),
gw6addr = wan6:gw6addr(),
dns = wan6:dns6addrs(),
ip6prefix = wan6:ip6prefix(),
uptime = wan6:uptime(),
proto = wan6:proto(),
i18n = wan6:get_i18n(),
ifname = wan6:ifname(),
link = wan6:adminlink(),
mac = dev and dev:mac(),
type = dev and dev:type(),
name = dev and dev:get_i18n(),
ether = link and link.type == 1
}
end
if has_dsl then
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
local dsl_func = loadstring(dsl_stat)
if dsl_func then
rv.dsl = dsl_func()
end
end
luci.http.prepare_content("application/json")
luci.http.write_json(rv)
return
end
So to add data to be returned just add another line:
rv.my_var = something
Use lua to actually get the data through ubus or reading a file etc...