diff options
Diffstat (limited to 'applications/luci-statistics/luasrc/statistics/rrdtool/definitions')
7 files changed, 322 insertions, 283 deletions
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua index 2626d276d..5a2ac53ca 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua @@ -2,30 +2,25 @@ module("luci.statistics.rrdtool.definitions.cpu.cpu",package.seeall) function rrdargs( graph, host, plugin, plugin_instance, dtype ) - dtype_instances = { "idle", "nice", "system", "user" } + return { + title = "Prozessorauslastung", + vlabel = "%", - opts = { } - opts.sources = { } - opts.image = graph:mkpngpath( host, plugin, plugin_instance, dtype ) - opts.title = host .. ": Prozessorauslastung" - opts.rrd = { "-v", "Percent" } - opts.colors = { - idle = 'ffffff', - nice = '00e000', - user = '0000ff', - wait = 'ffb000', - system = 'ff0000', - softirq = 'ff00ff', - interrupt = 'a000a0', - steal = '000000' - } + data = { + instances = { + cpu = { "idle", "nice", "system", "user" } + }, - for i, inst in ipairs(dtype_instances) do - opts.sources[i] = { - name = inst, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ) + options = { + cpu_idle = { color = "ffffff" }, + cpu_nice = { color = "00e000" }, + cpu_user = { color = "0000ff" }, + cpu_wait = { color = "ffb000" }, + cpu_system = { color = "ff0000" }, + cpu_softirq = { color = "ff00ff" }, + cpu_interrupt = { color = "a000a0" }, + cpu_steal = { color = "000000" } + } } - end - - return opts + } end diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua index b16add995..455107322 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua @@ -1,26 +1,15 @@ module("luci.statistics.rrdtool.definitions.iptables.ipt_packets", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance, dtype ) +function rrdargs( graph, plugin, plugin_instance, dtype ) - dtype_instances = graph.tree:data_instances( plugin, plugin_instance, dtype ) - opts = { } - - for i, inst in ipairs(dtype_instances) do - - opts[i] = { } - opts[i].image = graph:mkpngpath( host, plugin, plugin_instance, dtype, inst ) - opts[i].title = host .. ": Firewall - " .. inst:gsub("_"," ") - opts[i].rrd = { "-v", "Pakete/s" } - - opts[i].colors = { + return { + title = "Firewall", + vlabel = "Pakete/s", + data = { + options = { + ipt_packets = { total = true } + } } - - opts[i].sources = { { - name = inst, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ) - } } - end - - return opts + } end diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua index 3960b9c53..47594f0f8 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua @@ -1,180 +1,208 @@ module("luci.statistics.rrdtool.definitions.netlink", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance ) - - local diagram_list = { } - - -- diagram names - local dtypes_names = { - "Verkehr", - "Pakete", - "Multicast-Pakete", - "Paketkollisionen", - "Paketfehler", - "RX-Fehler", - "TX-Fehler" +function rrdargs( graph, plugin, plugin_instance ) + + -- + -- traffic diagram + -- + local traffic = { + + -- diagram title + title = "Verkehr", + + -- vertical label + vlabel = "Bytes/s", + + -- diagram data description + data = { + -- defined sources for data types, if ommitted assume a single DS named "value" (optional) + sources = { + if_octets = { "tx", "rx" } + }, + + -- special options for single data lines + options = { + if_octets__tx = { + total = true, -- report total amount of bytes + color = "00ff00" -- tx is green + }, + + if_octets__rx = { + flip = true, -- flip rx line + total = true, -- report total amount of bytes + color = "0000ff" -- rx is blue + } + } + } } - -- diagram units - local dtypes_units = { - "Bytes/s", - "Pakete/s", - "Pakete/s", - "Kollisionen/s", - "Fehler/s", -- (?) - "Fehler/s", - "Fehler/s" - } - -- data source overrides - local dtypes_sources = { - if_errors = { "tx", "rx" }, -- if_errors has tx and rx - if_octets = { "tx", "rx" }, -- if_octets has tx and rx - if_packets = { "tx", "rx" }, -- if_packets has tx and rx - if_dropped = { "tx", "rx" }, -- if_dopped has tx and rx + -- + -- packet diagram + -- + local packets = { + + -- diagram title + title = "Pakete", + + -- vertical label + vlabel = "Pakete/s", + + -- diagram data description + data = { + -- data type order + types = { "if_packets", "if_dropped", "if_errors" }, + + -- defined sources for data types + sources = { + if_packets = { "tx", "rx" }, + if_dropped = { "tx", "rx" }, + if_errors = { "tx", "rx" } + }, + + -- special options for single data lines + options = { + -- processed packets (tx DS) + if_packets__tx = { + overlay = true, -- don't summarize + total = true, -- report total amount of bytes + color = "00ff00" -- processed tx is green + }, + + -- processed packets (rx DS) + if_packets__rx = { + overlay = true, -- don't summarize + flip = true, -- flip rx line + total = true, -- report total amount of bytes + color = "0000ff" -- processed rx is blue + }, + + -- dropped packets (tx DS) + if_dropped__tx = { + overlay = true, -- don't summarize + total = true, -- report total amount of bytes + color = "660055" -- dropped tx is ... dunno ;) + }, + + -- dropped packets (rx DS) + if_dropped__rx = { + overlay = true, -- don't summarize + flip = true, -- flip rx line + total = true, -- report total amount of bytes + color = "440066" -- dropped rx is violett + }, + + -- packet errors (tx DS) + if_errors__tx = { + overlay = true, -- don't summarize + total = true, -- report total amount of packets + color = "ff5500" -- tx errors are orange + }, + + -- packet errors (rx DS) + if_errors__rx = { + overlay = true, -- don't summarize + flip = true, -- flip rx line + total = true, -- report total amount of packets + color = "ff0000" -- rx errors are red + } + } + } } - -- diagram data types - local dtypes_list = { - - -- diagram 1: interface traffic statistics - { - if_octets = { "" } -- bytes/s - }, - - -- diagram 2: combined interface packet statistics - { - if_dropped = { "" }, -- packets/s - if_packets = { "" } -- packets/s - }, - - -- diagram 3: multicast count - { - if_multicast = { "" } -- packets/s - }, - - -- diagram 4: interface collision statistics - { - if_collisions = { "" } -- collisions/s - }, - - -- diagram 5: interface error statistics - { - if_errors = { "" } -- errors/s (?) - }, - - -- diagram 6: interface rx error statistics - { - if_rx_errors = { -- errors/s - "length", "missed", "over", "crc", "fifo", "frame" + + -- + -- multicast diagram + -- + local multicast = { + + -- diagram title + title = "Multicast-Pakete", + + -- vertical label + vlabel = "Pakete/s", + + -- diagram data description + data = { + -- data type order + types = { "if_multicast" }, + + -- special options for single data lines + options = { + -- multicast packets + if_multicast = { + total = true, -- report total amount of packets + color = "0000ff" -- multicast is blue + } } - }, + } + } + - -- diagram 7: interface tx error statistics - { - if_tx_errors = { -- errors/s - "aborted", "carrier", "fifo", "heartbeat", "window" + -- + -- collision diagram + -- + local collisions = { + + -- diagram title + title = "Paketkollisionen", + + -- vertical label + vlabel = "Kollisionen/s", + + -- diagram data description + data = { + -- data type order + types = { "if_collisions" }, + + -- special options for single data lines + options = { + -- collision rate + if_collisions = { + total = true, -- report total amount of packets + color = "ff0000" -- collsions are red + } } } } - -- diagram colors - local dtypes_colors = { - - -- diagram 1 - { - if_octets__tx_ = "00ff00", - if_octets__rx_ = "0000ff" - }, - - -- diagram 2 - { - if_dropped__tx_ = "ff0000", - if_dropped__rx_ = "ff5500", - if_packets__tx_ = "00ff00", - if_packets__rx_ = "0000ff" - }, - - -- diagram 3 - { - if_multicast = "0000ff" - }, - - -- diagram 4 - { - if_collisions = "ff0000" - }, - - -- diagram 5 - { - if_errors__tx_ = "ff0000", - if_errors__rx_ = "ff5500" - }, - - -- diagram 6 - { - length = "0000ff", - missed = "ff5500", - over = "ff0066", - crc = "ff0000", - fifo = "00ff00", - frame = "ffff00" - }, - - -- diagram 7 - { - aborted = "ff0000", - carrier = "ffff00", - fifo = "00ff00", - heartbeat = "0000ff", - window = "8800ff" + + -- + -- error diagram + -- + local errors = { + + -- diagram title + title = "TX/RX-Fehler", + + -- vertical label + vlabel = "Kollisionen/s", + + -- diagram data description + data = { + -- data type order + types = { "if_tx_errors", "if_rx_errors" }, + + -- data type instances + instances = { + if_tx_errors = { "aborted", "carrier", "fifo", "heartbeat", "window" }, + if_rx_errors = { "length", "missed", "over", "crc", "fifo", "frame" } + }, + + -- special options for single data lines + options = { -- XXX: fixme (define colors...) + if_tx_errors = { + total = true + }, + + if_rx_errors = { + flip = true, + total = true + } + } } } - for i, name in ipairs(dtypes_names) do - - local dtypes = dtypes_list[i] - local opts = { } - - opts.sources = { } - opts.image = graph:mkpngpath( host, plugin, plugin_instance, "netlink" .. i ) - opts.title = host .. ": Netlink Statistiken - " .. name .. " auf " .. plugin_instance - opts.rrd = { "-v", dtypes_units[i] } - opts.colors = dtypes_colors[i] - - for dtype, dinstances in pairs(dtypes) do - for i, inst in ipairs(dinstances) do - - local name = inst - if name:len() == 0 then name = dtype end - - -- check for data source override - if dtypes_sources[dtype] then - - -- has override - for i, ds in ipairs(dtypes_sources[dtype]) do - table.insert( opts.sources, { - ds = ds, -- override - name = name .. " (" .. ds .. ")", - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ), - flip = ( ds == "rx" ), - total = ( ds == "rx" or ds == "tx" ) - } ) - end - else - -- no override, assume single "value" data source - table.insert( opts.sources, { - name = name, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ), - total = ( name == "if_multicast" ) - } ) - end - end - end - - table.insert( diagram_list, opts ) - end - - return diagram_list + return { traffic, packets, multicast, collisions, errors } end diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua index b041c015d..cf1db00b4 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua @@ -1,23 +1,15 @@ module("luci.statistics.rrdtool.definitions.ping.ping", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance, dtype ) +function rrdargs( graph, plugin, plugin_instance, dtype ) - dtype_instances = graph.tree:data_instances( plugin, plugin_instance, dtype ) + return { + title = "Pingzeiten", + vlabel = "ms", - opts = { } - opts.sources = { } - opts.image = graph:mkpngpath( host, plugin, plugin_instance, dtype ) - opts.title = host .. ": Pingzeiten" - opts.rrd = { "-v", "Millisekunden" } - opts.colors = { } - - for i, inst in ipairs(dtype_instances) do - opts.sources[i] = { - ds = "ping", - name = inst, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ) + data = { + sources = { + ping = { "ping" } + } } - end - - return opts + } end diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes/ps_state.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes/ps_state.lua index 07cbe1d4a..715d19c76 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes/ps_state.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes/ps_state.lua @@ -1,31 +1,26 @@ module("luci.statistics.rrdtool.definitions.processes.ps_state", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance, dtype ) +function rrdargs( graph, plugin, plugin_instance, dtype ) - dtype_instances = { - "sleeping", "running", "paging", "blocked", "stopped", "zombies" - } + return { + title = "Prozesse", + vlabel = "Anzahl/s", - opts = { } - opts.sources = { } - opts.image = graph:mkpngpath( host, plugin, plugin_instance, dtype ) - opts.title = host .. ": Prozesse" - opts.rrd = { "-v", "Anzahl" } - opts.colors = { - sleeping = "008080", - running = "008000", - paging = "ffff00", - blocked = "ff5000", - stopped = "555555", - zombies = "ff0000" - } + data = { + instances = { + ps_state = { + "sleeping", "running", "paging", "blocked", "stopped", "zombies" + } + }, - for i, inst in ipairs(dtype_instances) do - opts.sources[i] = { - name = inst, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, "ps_state", inst ) + options = { + ps_state_sleeping = { color = "0000ff" }, + ps_state_running = { color = "008000" }, + ps_state_paging = { color = "ffff00" }, + ps_state_blocked = { color = "ff5000" }, + ps_state_stopped = { color = "555555" }, + ps_state_zombies = { color = "ff0000" } + } } - end - - return opts + } end diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua index 049357494..c944d990d 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua @@ -1,27 +1,25 @@ module("luci.statistics.rrdtool.definitions.tcpconns.tcp_connections", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance, dtype ) +function rrdargs( graph, plugin, plugin_instance, dtype ) - dtype_instances = { - "SYN_SENT", "SYN_RECV", "LISTEN", "ESTABLISHED", "LAST_ACK", "TIME_WAIT", - "CLOSING", "CLOSE_WAIT", "CLOSED", "FIN_WAIT1", "FIN_WAIT2" - } - - opts = { } - opts.sources = { } - opts.image = graph:mkpngpath( host, plugin, plugin_instance, dtype ) - opts.title = host .. ": TCP-Verbindungen - Port " .. plugin_instance - opts.rrd = { "-v", "Anzahl" } - opts.colors = { + return { + title = "TCP-Verbindungen auf Port " .. plugin_instance, + vlabel = "Anzahl/s", - } + data = { + instances = { + tcp_connections = { + "SYN_SENT", "SYN_RECV", "LISTEN", "ESTABLISHED", + "LAST_ACK", "TIME_WAIT", "CLOSING", "CLOSE_WAIT", + "CLOSED", "FIN_WAIT1", "FIN_WAIT2" + } + }, - for i, inst in ipairs(dtype_instances) do - opts.sources[i] = { - name = inst, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ) + options = { + tcp_connections = { + total = true + } + } } - end - - return opts + } end diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua index 708aee311..6c68bb269 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua @@ -2,25 +2,67 @@ module("luci.statistics.rrdtool.definitions.wireless", package.seeall) function rrdargs( graph, host, plugin, plugin_instance ) - dtypes = { "signal_noise", "signal_power" } - - opts = { } - opts.sources = { } - opts.image = graph:mkpngpath( host, plugin, plugin_instance, "wireless" ) - opts.title = host .. ": WLAN Signal" - opts.rrd = { "-v", "dBm" } - opts.colors = { - signal_power = '0000ff', - signal_noise = 'ff0000' + -- + -- signal/noise diagram + -- + local snr = { + + -- diagram title + title = "Signal / Noise", + + -- vertical label + vlabel = "dBm", + + -- draw this diagram for each data instance + per_instance = true, + + -- diagram data description + data = { + types = { "signal_noise", "signal_power" }, + + -- special options for single data lines + options = { + signal_power = { + overlay = true, -- don't summarize + color = "0000ff" -- power is blue + }, + + signal_noise = { + overlay = true, -- don't summarize + color = "ff0000" -- noise is red + } + } + } } - for i, dtype in ipairs(dtypes) do - opts.sources[i] = { - name = dtype, - rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype ), - overlay = true -- don't summarize values + + -- + -- signal quality diagram + -- + local quality = { + + -- diagram title + title = "Signalqualitaet", + + -- vertical label + vlabel = "n/5", + + -- draw this diagram for each data instance + per_instance = true, + + -- diagram data description + data = { + types = { "signal_quality" }, + + -- special options for single data lines + options = { + signal_quality = { + noarea = true, -- don't draw area + color = "0000ff" -- quality is blue + } + } } - end + } - return opts + return { snr, quality } end |