diff options
author | Steven Barth <steven@midlink.org> | 2008-05-27 12:23:39 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-05-27 12:23:39 +0000 |
commit | d35a620e9f5665a94967f4bd02c93581a1dd7e00 (patch) | |
tree | cbe7a9b9fe71e40d850c649361c87608d56ea48b /applications/luci-statistics/luasrc/statistics/rrdtool/definitions | |
parent | 5df565faba5eb0c26a7ce0e2d6e9092bf71cb1e8 (diff) |
commit 4f6198094cf4134179d1f9c9fa8f79759a27c87e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue May 27 13:56:12 2008 +0200
rename src/ to luasrc/
Diffstat (limited to 'applications/luci-statistics/luasrc/statistics/rrdtool/definitions')
7 files changed, 326 insertions, 0 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 new file mode 100644 index 0000000000..2626d276d1 --- /dev/null +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu/cpu.lua @@ -0,0 +1,31 @@ +module("luci.statistics.rrdtool.definitions.cpu.cpu",package.seeall) + +function rrdargs( graph, host, plugin, plugin_instance, dtype ) + + dtype_instances = { "idle", "nice", "system", "user" } + + 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' + } + + for i, inst in ipairs(dtype_instances) do + opts.sources[i] = { + 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/iptables/ipt_packets.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua new file mode 100644 index 0000000000..b16add995d --- /dev/null +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iptables/ipt_packets.lua @@ -0,0 +1,26 @@ +module("luci.statistics.rrdtool.definitions.iptables.ipt_packets", package.seeall) + +function rrdargs( graph, host, 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 = { + + } + + 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 new file mode 100644 index 0000000000..3cee6abc00 --- /dev/null +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua @@ -0,0 +1,163 @@ +module("luci.statistics.rrdtool.definitions.netlink", package.seeall) + +function rrdargs( graph, host, plugin, plugin_instance ) + + local diagram_list = { } + + -- diagram names + local dtypes_names = { + "Pakete", + "Paketkollisionen", + "Paketfehler", + "Verkehr", + "RX-Fehler", + "TX-Fehler" + } + + -- diagram units + local dtypes_units = { + "Pakete/s", + "Kollisionen/s", + "Fehler/s", -- (?) + "Bytes/s", + "Fehler/s", + "Fehler/s" + } + + -- data source overrides + local dtypes_sources = { + if_errors = { "rx", "tx" }, -- if_errors has rx and tx + if_octets = { "rx", "tx" } -- if_octets has rx and tx + } + + -- diagram data types + local dtypes_list = { + + -- diagram 1: combined interface packet statistics + { + if_dropped = { "" }, -- packets/s + if_multicast = { "" }, -- packets/s + if_packets = { "" } -- packets/s + }, + + -- diagram 2: interface collision statistics + { + if_collisions = { "" } -- collisions/s + }, + + -- diagram 3: interface error statistics + { + if_errors = { "" } -- errors/s (?) + }, + + -- diagram 4: interface traffic statistics + { + if_octets = { "" } -- bytes/s + }, + + -- diagram 5: interface rx error statistics + { + if_rx_errors = { -- errors/s + "length", "missed", "over", "crc", "fifo", "frame" + } + }, + + -- diagram 6: interface tx error statistics + { + if_tx_errors = { -- errors/s + "aborted", "carrier", "fifo", "heartbeat", "window" + } + } + } + + -- diagram colors + local dtypes_colors = { + + -- diagram 1 + { + if_dropped = "ff0000", + if_multicast = "0000ff", + if_packets = "00ff00" + }, + + -- diagram 2 + { + if_collisions = "ff0000" + }, + + -- diagram 3 + { + if_errors__tx_ = "ff0000", + if_errors__rx_ = "ff5500" + }, + + -- diagram 4 + { + if_octets__tx_ = "00ff00", + if_octets__rx_ = "0000ff" + }, + + -- diagram 5 + { + length = "0000ff", + missed = "ff5500", + over = "ff0066", + crc = "ff0000", + fifo = "00ff00", + frame = "ffff00" + }, + + -- diagram 6 + { + aborted = "ff0000", + carrier = "ffff00", + fifo = "00ff00", + heartbeat = "0000ff", + window = "8800ff" + } + } + + + 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 ) + } ) + end + else + -- no override, assume single "value" data source + table.insert( opts.sources, { + name = name, + rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype, inst ) + } ) + end + end + end + + table.insert( diagram_list, opts ) + end + + return diagram_list +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 new file mode 100644 index 0000000000..b041c015da --- /dev/null +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/ping/ping.lua @@ -0,0 +1,23 @@ +module("luci.statistics.rrdtool.definitions.ping.ping", package.seeall) + +function rrdargs( graph, host, plugin, plugin_instance, dtype ) + + dtype_instances = graph.tree:data_instances( plugin, plugin_instance, dtype ) + + 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 ) + } + 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 new file mode 100644 index 0000000000..07cbe1d4af --- /dev/null +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes/ps_state.lua @@ -0,0 +1,31 @@ +module("luci.statistics.rrdtool.definitions.processes.ps_state", package.seeall) + +function rrdargs( graph, host, plugin, plugin_instance, dtype ) + + dtype_instances = { + "sleeping", "running", "paging", "blocked", "stopped", "zombies" + } + + 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" + } + + for i, inst in ipairs(dtype_instances) do + opts.sources[i] = { + name = inst, + rrd = graph:mkrrdpath( host, plugin, plugin_instance, "ps_state", inst ) + } + 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 new file mode 100644 index 0000000000..0493574948 --- /dev/null +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/tcpconns/tcp_connections.lua @@ -0,0 +1,27 @@ +module("luci.statistics.rrdtool.definitions.tcpconns.tcp_connections", package.seeall) + +function rrdargs( graph, host, 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 = { + + } + + for i, inst in ipairs(dtype_instances) do + opts.sources[i] = { + 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/wireless.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua new file mode 100644 index 0000000000..e315ca5210 --- /dev/null +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/wireless.lua @@ -0,0 +1,25 @@ +module("luci.statistics.rrdtool.definitions.wireless", package.seeall) + +function rrdargs( graph, host, plugin, plugin_instance ) + + dtypes = { "signal_power", "signal_noise" } + + 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' + } + + for i, dtype in ipairs(dtypes) do + opts.sources[i] = { + name = dtype, + rrd = graph:mkrrdpath( host, plugin, plugin_instance, dtype ) + } + end + + return opts +end |