s_system = _("System plugins"),
s_network = _("Network plugins"),
- rrdtool = _("RRDTool"),
- network = _("Network"),
- unixsock = _("UnixSock"),
- csv = _("CSV Output"),
- exec = _("Exec"),
- email = _("Email"),
+ conntrack = _("Conntrack"),
cpu = _("Processor"),
+ csv = _("CSV Output"),
df = _("Disk Space Usage"),
disk = _("Disk Usage"),
+ dns = _("DNS"),
+ email = _("Email"),
+ exec = _("Exec"),
+ interface = _("Interfaces"),
+ iptables = _("Firewall"),
irq = _("Interrupts"),
- processes = _("Processes"),
+ iwinfo = _("Wireless"),
load = _("System Load"),
- interface = _("Interfaces"),
+ memory = _("Memory"),
netlink = _("Netlink"),
- iptables = _("Firewall"),
- tcpconns = _("TCP Connections"),
+ network = _("Network"),
+ olsrd = _("OLSRd"),
ping = _("Ping"),
- dns = _("DNS"),
- wireless = _("Wireless")
+ processes = _("Processes"),
+ rrdtool = _("RRDTool"),
+ tcpconns = _("TCP Connections"),
+ unixsock = _("UnixSock")
}
-- our collectd menu
local collectd_menu = {
- output = { "rrdtool", "network", "unixsock", "csv" },
- system = { "exec", "email", "cpu", "df", "disk", "irq", "processes", "load" },
- network = { "interface", "netlink", "iptables", "tcpconns", "ping", "dns", "wireless" }
+ output = { "csv", "network", "rrdtool", "unixsock" },
+ system = { "cpu", "df", "disk", "email", "exec", "irq", "load", "memory", "processes" },
+ network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "ping", "tcpconns", "iwinfo" }
}
-- create toplevel menu nodes
- local st = entry({"admin", "statistics"}, call("statistics_index"), _("Statistics"), 80)
+ local st = entry({"admin", "statistics"}, template("admin_statistics/index"), _("Statistics"), 80)
st.i18n = "statistics"
st.index = true
for section, plugins in luci.util.kspairs( collectd_menu ) do
local e = entry(
{ "admin", "statistics", "collectd", section },
- call( "statistics_" .. section .. "plugins" ),
- labels["s_"..section], index * 10
+ firstchild(), labels["s_"..section], index * 10
)
e.index = true
end
-- output views
- local page = entry( { "admin", "statistics", "graph" }, call("statistics_index"), _("Graphs"), 80)
+ local page = entry( { "admin", "statistics", "graph" }, template("admin_statistics/index"), _("Graphs"), 80)
page.i18n = "statistics"
page.setuser = "nobody"
page.setgroup = "nogroup"
end
end
-function statistics_index()
- luci.template.render("admin_statistics/index")
-end
-
-function statistics_outputplugins()
- local translate = luci.i18n.translate
- local plugins = {
- rrdtool = _("RRDTool"),
- network = _("Network"),
- unixsock = _("UnixSock"),
- csv = _("CSV Output")
- }
-
- luci.template.render("admin_statistics/outputplugins", {plugins=plugins})
-end
-
-function statistics_systemplugins()
- local translate = luci.i18n.translate
- local plugins = {
- exec = _("Exec"),
- email = _("Email"),
- cpu = _("Processor"),
- df = _("Disk Space Usage"),
- disk = _("Disk Usage"),
- irq = _("Interrupts"),
- processes = _("Processes"),
- load = _("System Load"),
- }
-
- luci.template.render("admin_statistics/systemplugins", {plugins=plugins})
-end
-
-function statistics_networkplugins()
- local translate = luci.i18n.translate
- local plugins = {
- interface = _("Interfaces"),
- netlink = _("Netlink"),
- iptables = _("Firewall"),
- tcpconns = _("TCP Connections"),
- ping = _("Ping"),
- dns = _("DNS"),
- wireless = _("Wireless")
- }
-
- luci.template.render("admin_statistics/networkplugins", {plugins=plugins})
-end
-
-
function statistics_render()
require("luci.statistics.rrdtool")
local span = vars.timespan or uci:get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
local graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) )
+ local is_index = false
+
-- deliver image
if vars.img then
local l12 = require "luci.ltn12"
-- no instance requested, find all instances
if #instances == 0 then
- instances = { graph.tree:plugin_instances( plugin )[1] }
+ --instances = { graph.tree:plugin_instances( plugin )[1] }
+ instances = graph.tree:plugin_instances( plugin )
+ is_index = true
-- index instance requested
elseif instances[1] == "-" then
instances[1] = ""
+ is_index = true
end
-- render graphs
for i, inst in ipairs( instances ) do
- for i, img in ipairs( graph:render( plugin, inst ) ) do
+ for i, img in ipairs( graph:render( plugin, inst, is_index ) ) do
table.insert( images, graph:strippngpath( img ) )
+ images[images[#images]] = inst
end
end
images = images,
plugin = plugin,
timespans = spans,
- current_timespan = span
+ current_timespan = span,
+ is_index = is_index
} )
end