Instead of coding the display logic into the graph models, simply annotate
graph models with .detail = true/false and let the renderer decide which
to pick when.
-- get diagram definitions
for i, opts in ipairs( self:_forcelol( def.rrdargs( self, plugin, plugin_instance, nil, is_index ) ) ) do
-- get diagram definitions
for i, opts in ipairs( self:_forcelol( def.rrdargs( self, plugin, plugin_instance, nil, is_index ) ) ) do
+ if not is_index or not opts.detail then
+ _images[i] = { }
+ -- get diagram definition instances
+ local diagrams = self:_generic( opts, plugin, plugin_instance, nil, i )
- -- get diagram definition instances
- local diagrams = self:_generic( opts, plugin, plugin_instance, nil, i )
+ -- render all diagrams
+ for j, def in ipairs( diagrams ) do
+ -- remember image
+ _images[i][j] = def[1]
- -- render all diagrams
- for j, def in ipairs( diagrams ) do
-
- -- remember image
- _images[i][j] = def[1]
-
- -- exec
- self:_rrdtool( def )
+ -- exec
+ self:_rrdtool( def )
+ end
vlabel = "Bytes/s",
number_format = "%5.1lf%sB/s",
vlabel = "Bytes/s",
number_format = "%5.1lf%sB/s",
data = {
types = { "disk_octets" },
sources = {
data = {
types = { "disk_octets" },
sources = {
--
local packets = {
title = "%H: Netlink - Packets on %pi",
--
local packets = {
title = "%H: Netlink - Packets on %pi",
+ vlabel = "Packets/s", detail = true,
-- diagram data description
data = {
-- diagram data description
data = {
--
local multicast = {
title = "%H: Netlink - Multicast on %pi",
--
local multicast = {
title = "%H: Netlink - Multicast on %pi",
+ vlabel = "Packets/s", detail = true,
-- diagram data description
data = {
-- diagram data description
data = {
--
local collisions = {
title = "%H: Netlink - Collisions on %pi",
--
local collisions = {
title = "%H: Netlink - Collisions on %pi",
- vlabel = "Collisions/s",
+ vlabel = "Collisions/s", detail = true,
-- diagram data description
data = {
-- diagram data description
data = {
--
local errors = {
title = "%H: Netlink - Errors on %pi",
--
local errors = {
title = "%H: Netlink - Errors on %pi",
+ vlabel = "Errors/s", detail = true,
-- diagram data description
data = {
-- diagram data description
data = {
local tree = luci.statistics.datatree.Instance()
local tree = luci.statistics.datatree.Instance()
-function rrdargs( graph, plugin, plugin_instance, dtype, is_index )
-
+function rrdargs( graph, plugin, plugin_instance, dtype )
local g = { }
if plugin_instance == "routes" then
local g = { }
if plugin_instance == "routes" then
- if not is_index then
- g[#g+1] = {
- title = "%H: Average route ETX", vlabel = "ETX",
- number_format = "%5.1lf",data = {
- instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
- types = { "route_etx" },
- options = {
- route_etx = {
- title = "Average route ETX"
- }
+ g[#g+1] = {
+ title = "%H: Average route ETX", vlabel = "ETX", detail = true,
+ number_format = "%5.1lf",data = {
+ instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
+ types = { "route_etx" },
+ options = {
+ route_etx = {
+ title = "Average route ETX"
- g[#g+1] = {
- title = "%H: Average route metric", vlabel = "metric",
- number_format = "%5.1lf", data = {
- instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
- types = { "route_metric" },
- options = {
- route_metric = {
- title = "Average route metric"
- }
+ g[#g+1] = {
+ title = "%H: Average route metric", vlabel = "metric", detail = true,
+ number_format = "%5.1lf", data = {
+ instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert
+ types = { "route_metric" },
+ options = {
+ route_metric = {
+ title = "Average route metric"
elseif plugin_instance == "links" then
elseif plugin_instance == "links" then
- if not is_index then
- local instances = tree:data_instances(plugin, plugin_instance, "signal_quality")
- table.sort(instances)
+ local instances = tree:data_instances(plugin, plugin_instance, "signal_quality")
+ table.sort(instances)
- -- define one diagram per host, containing the rx and lq values
- local i
- for i = 1, #instances, 2 do
- local dsn1 = "signal_quality_%s_value" % instances[i]:gsub("[^%w]+", "_")
- local dsn2 = "signal_quality_%s_value" % instances[i+1]:gsub("[^%w]+", "_")
- local host = instances[i]:match("^[^%-]+%-([^%-]+)%-.+")
+ -- define one diagram per host, containing the rx and lq values
+ local i
+ for i = 1, #instances, 2 do
+ local dsn1 = "signal_quality_%s_value" % instances[i]:gsub("[^%w]+", "_")
+ local dsn2 = "signal_quality_%s_value" % instances[i+1]:gsub("[^%w]+", "_")
+ local host = instances[i]:match("^[^%-]+%-([^%-]+)%-.+")
title = "%H: Signal Quality" .. " (" .. (host or "avg") ..")", vlabel = "ETX",
title = "%H: Signal Quality" .. " (" .. (host or "avg") ..")", vlabel = "ETX",
- number_format = "%5.2lf", data = {
- types = { "signal_quality" },
+ number_format = "%5.2lf", detail = true,
+ data = {
+ types = { "signal_quality" },
- instances = {
- signal_quality = { instances[i], instances[i+1] },
- },
+ instances = {
+ signal_quality = { instances[i], instances[i+1] },
+ },
- options = {
- [dsn1] = {
- color = "00ff00",
- title = "LQ (%s)" % (host or "avg"),
- },
- [dsn2] = {
- color = "0000ff",
- title = "NLQ (%s)" % (host or "avg"),
- flip = true
- }
+ options = {
+ [dsn1] = {
+ color = "00ff00",
+ title = "LQ (%s)" % (host or "avg"),
+ },
+ [dsn2] = {
+ color = "0000ff",
+ title = "NLQ (%s)" % (host or "avg"),
+ flip = true
end
elseif plugin_instance == "topology" then
end
elseif plugin_instance == "topology" then
instances = { "" },
types = { "links" },
options = {
instances = { "" },
types = { "links" },
options = {
- links = { -- or: links__value is aber egal weils eh nur eines davon gibt
color = "0000ff",
title = "Total number of links"
}
color = "0000ff",
title = "Total number of links"
}
- if not is_index then
- g[#g+1] = {
- title= "%H: Average signal quality", vlabel = "n",
- number_format = "%5.2lf", data = {
- instances = { "average" }, -- exclude possible per-ip stuff
- types = { "signal_quality" },
- options = {
- signal_quality = {
- color = "0000ff",
- title = "Average signal quality"
- }
+ g[#g+1] = {
+ title= "%H: Average signal quality", vlabel = "n",
+ number_format = "%5.2lf", detail = true,
+ data = {
+ instances = { "average" }, -- exclude possible per-ip stuff
+ types = { "signal_quality" },
+ options = {
+ signal_quality = {
+ color = "0000ff",
+ title = "Average signal quality"
module("luci.statistics.rrdtool.definitions.ping", package.seeall)
module("luci.statistics.rrdtool.definitions.ping", package.seeall)
-function rrdargs( graph, plugin, plugin_instance, dtype, is_index )
+function rrdargs( graph, plugin, plugin_instance, dtype )
return {
-- Ping roundtrip time
{ title = "%H: ICMP Round Trip Time", vlabel = "ms",
return {
-- Ping roundtrip time
{ title = "%H: ICMP Round Trip Time", vlabel = "ms",
module("luci.statistics.rrdtool.definitions.processes", package.seeall)
module("luci.statistics.rrdtool.definitions.processes", package.seeall)
-function rrdargs( graph, plugin, plugin_instance, dtype, is_index )
+function rrdargs( graph, plugin, plugin_instance, dtype )
- if is_index then
- return {
title = "%H: Processes",
vlabel = "Processes/s",
data = {
title = "%H: Processes",
vlabel = "Processes/s",
data = {
ps_state_zombies = { color = "ff0000" }
}
}
ps_state_zombies = { color = "ff0000" }
}
}
- }
- else
- return {
- {
- title = "%H: CPU time used by %pi",
- vlabel = "Jiffies",
- data = {
- sources = {
- ps_cputime = { "syst", "user" }
- },
- options = {
- ps_cputime__user = {
- color = "0000ff",
- overlay = true
- },
+ {
+ title = "%H: CPU time used by %pi",
+ vlabel = "Jiffies",
+ data = {
+ sources = {
+ ps_cputime = { "syst", "user" }
+ },
- ps_cputime__syst = {
- color = "ff0000",
- overlay = true
- }
- }
- }
- },
-
- {
- title = "%H: Threads and processes belonging to %pi",
- vlabel = "Count",
- data = {
- sources = {
- ps_count = { "threads", "processes" }
+ options = {
+ ps_cputime__user = {
+ color = "0000ff",
+ overlay = true
- options = {
- ps_count__threads = { color = "00ff00" },
- ps_count__processes = { color = "0000bb" }
+ ps_cputime__syst = {
+ color = "ff0000",
+ overlay = true
- },
-
- {
- title = "%H: Page faults in %pi",
- vlabel = "Pagefaults",
- data = {
- sources = {
- ps_pagefaults = { "minflt", "majflt" }
- },
- options = {
- ps_pagefaults__minflt = { color = "ff0000" },
- ps_pagefaults__majflt = { color = "ff5500" }
- }
+ {
+ title = "%H: Threads and processes belonging to %pi",
+ vlabel = "Count",
+ detail = true,
+ data = {
+ sources = {
+ ps_count = { "threads", "processes" }
+ },
+
+ options = {
+ ps_count__threads = { color = "00ff00" },
+ ps_count__processes = { color = "0000bb" }
- {
- title = "%H: Virtual memory size of %pi",
- vlabel = "Bytes",
- number_format = "%5.1lf%sB",
- data = {
- types = { "ps_rss" },
+ {
+ title = "%H: Page faults in %pi",
+ vlabel = "Pagefaults",
+ detail = true,
+ data = {
+ sources = {
+ ps_pagefaults = { "minflt", "majflt" }
+ },
- options = {
- ps_rss = { color = "0000ff" }
- }
+ options = {
+ ps_pagefaults__minflt = { color = "ff0000" },
+ ps_pagefaults__majflt = { color = "ff5500" }
+ }
+ }
+ },
+
+ {
+ title = "%H: Virtual memory size of %pi",
+ vlabel = "Bytes",
+ detail = true,
+ number_format = "%5.1lf%sB",
+ data = {
+ types = { "ps_rss" },
+
+ options = {
+ ps_rss = { color = "0000ff" }
"LAST_ACK", "TIME_WAIT", "CLOSING", "CLOSE_WAIT",
"CLOSED", "FIN_WAIT1", "FIN_WAIT2"
},
"LAST_ACK", "TIME_WAIT", "CLOSING", "CLOSE_WAIT",
"CLOSED", "FIN_WAIT1", "FIN_WAIT2"
},
- options = { for k, v in (tcp_connections) do
- v = { title = "%di", noarea = true }
- end
+ options = {
+ load__ESTABLISHED = { title = "%di", noarea = true }