1 module("luci.statistics.rrdtool.definitions.netlink", package.seeall)
3 function rrdargs( graph, host, plugin, plugin_instance )
5 local diagram_list = { }
19 local dtypes_units = {
29 -- data source overrides
30 local dtypes_sources = {
31 if_errors = { "tx", "rx" }, -- if_errors has tx and rx
32 if_octets = { "tx", "rx" }, -- if_octets has tx and rx
33 if_packets = { "tx", "rx" }, -- if_packets has tx and rx
34 if_dropped = { "tx", "rx" }, -- if_dopped has tx and rx
40 -- diagram 1: interface traffic statistics
42 if_octets = { "" } -- bytes/s
45 -- diagram 2: combined interface packet statistics
47 if_dropped = { "" }, -- packets/s
48 if_packets = { "" } -- packets/s
51 -- diagram 3: multicast count
53 if_multicast = { "" } -- packets/s
56 -- diagram 4: interface collision statistics
58 if_collisions = { "" } -- collisions/s
61 -- diagram 5: interface error statistics
63 if_errors = { "" } -- errors/s (?)
66 -- diagram 6: interface rx error statistics
68 if_rx_errors = { -- errors/s
69 "length", "missed", "over", "crc", "fifo", "frame"
73 -- diagram 7: interface tx error statistics
75 if_tx_errors = { -- errors/s
76 "aborted", "carrier", "fifo", "heartbeat", "window"
82 local dtypes_colors = {
86 if_octets__tx_ = "00ff00",
87 if_octets__rx_ = "0000ff"
92 if_dropped__tx_ = "ff0000",
93 if_dropped__rx_ = "ff5500",
94 if_packets__tx_ = "00ff00",
95 if_packets__rx_ = "0000ff"
100 if_multicast = "0000ff"
105 if_collisions = "ff0000"
110 if_errors__tx_ = "ff0000",
111 if_errors__rx_ = "ff5500"
129 heartbeat = "0000ff",
135 for i, name in ipairs(dtypes_names) do
137 local dtypes = dtypes_list[i]
141 opts.image = graph:mkpngpath( host, plugin, plugin_instance, "netlink" .. i )
142 opts.title = host .. ": Netlink Statistiken - " .. name .. " auf " .. plugin_instance
143 opts.rrd = { "-v", dtypes_units[i] }
144 opts.colors = dtypes_colors[i]
146 for dtype, dinstances in pairs(dtypes) do
147 for i, inst in ipairs(dinstances) do
150 if name:len() == 0 then name = dtype end
152 -- check for data source override
153 if dtypes_sources[dtype] then
156 for i, ds in ipairs(dtypes_sources[dtype]) do
157 table.insert( opts.sources, {
159 name = name .. " (" .. ds .. ")",
160 rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ),
161 flip = ( ds == "rx" ),
162 total = ( ds == "rx" or ds == "tx" )
166 -- no override, assume single "value" data source
167 table.insert( opts.sources, {
169 rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ),
170 total = ( name == "if_multicast" )
176 table.insert( diagram_list, opts )