1 module("luci.statistics.rrdtool.definitions.netlink", package.seeall)
3 function rrdargs( graph, host, plugin, plugin_instance )
5 local diagram_list = { }
18 local dtypes_units = {
27 -- data source overrides
28 local dtypes_sources = {
29 if_errors = { "rx", "tx" }, -- if_errors has rx and tx
30 if_octets = { "rx", "tx" } -- if_octets has rx and tx
36 -- diagram 1: combined interface packet statistics
38 if_dropped = { "" }, -- packets/s
39 if_multicast = { "" }, -- packets/s
40 if_packets = { "" } -- packets/s
43 -- diagram 2: interface collision statistics
45 if_collisions = { "" } -- collisions/s
48 -- diagram 3: interface error statistics
50 if_errors = { "" } -- errors/s (?)
53 -- diagram 4: interface traffic statistics
55 if_octets = { "" } -- bytes/s
58 -- diagram 5: interface rx error statistics
60 if_rx_errors = { -- errors/s
61 "length", "missed", "over", "crc", "fifo", "frame"
65 -- diagram 6: interface tx error statistics
67 if_tx_errors = { -- errors/s
68 "aborted", "carrier", "fifo", "heartbeat", "window"
74 local dtypes_colors = {
78 if_dropped = "ff0000",
79 if_multicast = "0000ff",
85 if_collisions = "ff0000"
90 if_errors__tx_ = "ff0000",
91 if_errors__rx_ = "ff5500"
96 if_octets__tx_ = "00ff00",
97 if_octets__rx_ = "0000ff"
115 heartbeat = "0000ff",
121 for i, name in ipairs(dtypes_names) do
123 local dtypes = dtypes_list[i]
127 opts.image = graph:mkpngpath( host, plugin, plugin_instance, "netlink" .. i )
128 opts.title = host .. ": Netlink Statistiken - " .. name .. " auf " .. plugin_instance
129 opts.rrd = { "-v", dtypes_units[i] }
130 opts.colors = dtypes_colors[i]
132 for dtype, dinstances in pairs(dtypes) do
133 for i, inst in ipairs(dinstances) do
136 if name:len() == 0 then name = dtype end
138 -- check for data source override
139 if dtypes_sources[dtype] then
142 for i, ds in ipairs(dtypes_sources[dtype]) do
143 table.insert( opts.sources, {
145 name = name .. " (" .. ds .. ")",
146 rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst )
150 -- no override, assume single "value" data source
151 table.insert( opts.sources, {
153 rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst )
159 table.insert( diagram_list, opts )