summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-statistics/src/statistics/rrdtool/definitions
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-05-25 17:47:38 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-05-25 17:47:38 +0000
commit4a80f37832a692f627b5e02bc8cdfb2efd9909e3 (patch)
tree816848257a5a12d772b8ae36f244e030b1ed60d1 /applications/luci-statistics/src/statistics/rrdtool/definitions
parent32acc2cf98c07ea67c4e17860da7c4d536e32578 (diff)
* ffluci/statistics: diagram model updates, added ping to genconfig, fixed random() in colors.lua and added support for multiple diagrams per diagram controller
Diffstat (limited to 'applications/luci-statistics/src/statistics/rrdtool/definitions')
-rw-r--r--applications/luci-statistics/src/statistics/rrdtool/definitions/cpu/cpu.lua2
-rw-r--r--applications/luci-statistics/src/statistics/rrdtool/definitions/netlink.lua163
-rw-r--r--applications/luci-statistics/src/statistics/rrdtool/definitions/ping/ping.lua23
-rw-r--r--applications/luci-statistics/src/statistics/rrdtool/definitions/wireless.lua2
4 files changed, 188 insertions, 2 deletions
diff --git a/applications/luci-statistics/src/statistics/rrdtool/definitions/cpu/cpu.lua b/applications/luci-statistics/src/statistics/rrdtool/definitions/cpu/cpu.lua
index fad7fd2a47..557c5dafe1 100644
--- a/applications/luci-statistics/src/statistics/rrdtool/definitions/cpu/cpu.lua
+++ b/applications/luci-statistics/src/statistics/rrdtool/definitions/cpu/cpu.lua
@@ -7,7 +7,7 @@ function rrdargs( graph, host, plugin, plugin_instance, dtype )
opts = { }
opts.sources = { }
opts.image = graph:mkpngpath( host, plugin, plugin_instance, dtype )
- opts.title = graph:mktitle( host, plugin, plugin_instance, dtype )
+ opts.title = host .. ": Prozessorauslastung"
opts.rrd = { "-v", "Percent" }
opts.colors = {
idle = 'ffffff',
diff --git a/applications/luci-statistics/src/statistics/rrdtool/definitions/netlink.lua b/applications/luci-statistics/src/statistics/rrdtool/definitions/netlink.lua
new file mode 100644
index 0000000000..de3924dc74
--- /dev/null
+++ b/applications/luci-statistics/src/statistics/rrdtool/definitions/netlink.lua
@@ -0,0 +1,163 @@
+module("ffluci.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/src/statistics/rrdtool/definitions/ping/ping.lua b/applications/luci-statistics/src/statistics/rrdtool/definitions/ping/ping.lua
new file mode 100644
index 0000000000..48a5673ada
--- /dev/null
+++ b/applications/luci-statistics/src/statistics/rrdtool/definitions/ping/ping.lua
@@ -0,0 +1,23 @@
+module("ffluci.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/src/statistics/rrdtool/definitions/wireless.lua b/applications/luci-statistics/src/statistics/rrdtool/definitions/wireless.lua
index 016f1f4655..5b3acc51f8 100644
--- a/applications/luci-statistics/src/statistics/rrdtool/definitions/wireless.lua
+++ b/applications/luci-statistics/src/statistics/rrdtool/definitions/wireless.lua
@@ -7,7 +7,7 @@ function rrdargs( graph, host, plugin, plugin_instance )
opts = { }
opts.sources = { }
opts.image = graph:mkpngpath( host, plugin, plugin_instance, "wireless" )
- opts.title = graph:mktitle( host, plugin, plugin_instance, "wireless" )
+ opts.title = host .. ": WLAN Signal"
opts.rrd = { "-v", "dBm" }
opts.colors = {
signal_power = '0000ff',