applications/luci-statistics: display all instances on index pages, introduce is_index flag for models, add olsrd plugin menu
This commit is contained in:
parent
70a4a61664
commit
b2774f0cc6
2 changed files with 17 additions and 6 deletions
|
@ -55,14 +55,15 @@ function index()
|
||||||
tcpconns = _("TCP Connections"),
|
tcpconns = _("TCP Connections"),
|
||||||
ping = _("Ping"),
|
ping = _("Ping"),
|
||||||
dns = _("DNS"),
|
dns = _("DNS"),
|
||||||
wireless = _("Wireless")
|
wireless = _("Wireless"),
|
||||||
|
olsrd = _("OLSRd")
|
||||||
}
|
}
|
||||||
|
|
||||||
-- our collectd menu
|
-- our collectd menu
|
||||||
local collectd_menu = {
|
local collectd_menu = {
|
||||||
output = { "rrdtool", "network", "unixsock", "csv" },
|
output = { "rrdtool", "network", "unixsock", "csv" },
|
||||||
system = { "exec", "email", "cpu", "df", "disk", "irq", "processes", "load" },
|
system = { "exec", "email", "cpu", "df", "disk", "irq", "processes", "load" },
|
||||||
network = { "interface", "netlink", "iptables", "tcpconns", "ping", "dns", "wireless" }
|
network = { "interface", "netlink", "iptables", "tcpconns", "ping", "dns", "wireless", "olsrd" }
|
||||||
}
|
}
|
||||||
|
|
||||||
-- create toplevel menu nodes
|
-- create toplevel menu nodes
|
||||||
|
@ -170,7 +171,8 @@ function statistics_networkplugins()
|
||||||
tcpconns = translate("TCP Connections"),
|
tcpconns = translate("TCP Connections"),
|
||||||
ping = translate("Ping"),
|
ping = translate("Ping"),
|
||||||
dns = translate("DNS"),
|
dns = translate("DNS"),
|
||||||
wireless = translate("Wireless")
|
wireless = translate("Wireless"),
|
||||||
|
olsrd = translate("OLSRd")
|
||||||
}
|
}
|
||||||
|
|
||||||
luci.template.render("admin_statistics/networkplugins", {plugins=plugins})
|
luci.template.render("admin_statistics/networkplugins", {plugins=plugins})
|
||||||
|
@ -191,6 +193,8 @@ function statistics_render()
|
||||||
local span = vars.timespan or uci:get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
|
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 graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) )
|
||||||
|
|
||||||
|
local is_index = false
|
||||||
|
|
||||||
-- deliver image
|
-- deliver image
|
||||||
if vars.img then
|
if vars.img then
|
||||||
local l12 = require "luci.ltn12"
|
local l12 = require "luci.ltn12"
|
||||||
|
@ -216,18 +220,22 @@ function statistics_render()
|
||||||
|
|
||||||
-- no instance requested, find all instances
|
-- no instance requested, find all instances
|
||||||
if #instances == 0 then
|
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
|
-- index instance requested
|
||||||
elseif instances[1] == "-" then
|
elseif instances[1] == "-" then
|
||||||
instances[1] = ""
|
instances[1] = ""
|
||||||
|
is_index = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- render graphs
|
-- render graphs
|
||||||
for i, inst in ipairs( instances ) do
|
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 ) )
|
table.insert( images, graph:strippngpath( img ) )
|
||||||
|
images[images[#images]] = inst
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -235,6 +243,7 @@ function statistics_render()
|
||||||
images = images,
|
images = images,
|
||||||
plugin = plugin,
|
plugin = plugin,
|
||||||
timespans = spans,
|
timespans = spans,
|
||||||
current_timespan = span
|
current_timespan = span,
|
||||||
|
is_index = is_index
|
||||||
} )
|
} )
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,9 @@ $Id$
|
||||||
|
|
||||||
<div style="text-align: center">
|
<div style="text-align: center">
|
||||||
<% for i, img in ipairs(images) do %>
|
<% for i, img in ipairs(images) do %>
|
||||||
|
<% if is_index then %><a href="<%=pcdata(images[img])%>"><% end %>
|
||||||
<img src="<%=REQUEST_URI%>?img=<%=img%>" />
|
<img src="<%=REQUEST_URI%>?img=<%=img%>" />
|
||||||
|
<% if is_index then %></a><% end %>
|
||||||
<br />
|
<br />
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue