diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-app-statistics/luasrc/statistics/rrdtool | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff) |
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-statistics/luasrc/statistics/rrdtool')
20 files changed, 1429 insertions, 0 deletions
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/colors.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/colors.lua new file mode 100644 index 0000000000..2da9f5a08a --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/colors.lua @@ -0,0 +1,73 @@ +--[[ + +Luci statistics - diagram color helper class +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +module("luci.statistics.rrdtool.colors", package.seeall) + +require("luci.util") + + +Instance = luci.util.class() + +function Instance.from_string( self, s ) + return { + tonumber(s:sub(1,2), 16), + tonumber(s:sub(3,4), 16), + tonumber(s:sub(5,6), 16) + } +end + +function Instance.to_string( self, c ) + return string.format( + "%02x%02x%02x", + math.floor(c[1]), + math.floor(c[2]), + math.floor(c[3]) + ) +end + +function Instance.random( self ) + local r = math.random(255) + local g = math.random(255) + local min = 0 + local max = 255 + + if ( r + g ) < 255 then + min = 255 - r - g + else + max = 511 - r - g + end + + local b = min + math.floor( math.random() * ( max - min ) ) + + return { r, g, b } +end + +function Instance.faded( self, fg, opts ) + opts = opts or {} + opts.background = opts.background or { 255, 255, 255 } + opts.alpha = opts.alpha or 0.25 + + if type(opts.background) == "string" then + opts.background = _string_to_color(opts.background) + end + + local bg = opts.background + + return { + ( opts.alpha * fg[1] ) + ( ( 1.0 - opts.alpha ) * bg[1] ), + ( opts.alpha * fg[2] ) + ( ( 1.0 - opts.alpha ) * bg[2] ), + ( opts.alpha * fg[3] ) + ( ( 1.0 - opts.alpha ) * bg[3] ) + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua new file mode 100644 index 0000000000..0da546c0b4 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua @@ -0,0 +1,35 @@ +--[[ + +Luci statistics - conntrack plugin diagram definition +(c) 2011 Jo-Philipp Wich <xm@subsignal.org> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +module("luci.statistics.rrdtool.definitions.conntrack",package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + return { + title = "%H: Conntrack entries", + vlabel = "Count", + number_format = "%5.0lf", + data = { + sources = { + conntrack = { "value" } + }, + options = { + conntrack = { + color = "0000ff", + title = "Tracked connections" + } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua new file mode 100644 index 0000000000..c0e86245c0 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua @@ -0,0 +1,42 @@ +--[[ + +Luci statistics - cpu plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: cpu.lua 2274 2008-06-03 23:15:16Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.cpu",package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Processor usage on core #%pi", + y_min = "0", + vlabel = "Percent", + number_format = "%5.1lf%%", + data = { + instances = { + cpu = { "idle", "user", "system", "nice" } + }, + + 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 diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua new file mode 100644 index 0000000000..fa206badbd --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua @@ -0,0 +1,46 @@ +--[[ + +Luci statistics - df plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: df.lua 2274 2008-06-03 23:15:16Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.df", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Disk space usage on %di", + vlabel = "Bytes", + per_instance = true, + number_format = "%5.1lf%sB", + + data = { + sources = { + df = { "free", "used" } + }, + + options = { + df__free = { + color = "00ff00", + overlay = false, + title = "free" + }, + + df__used = { + color = "ff0000", + overlay = false, + title = "used" + } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/disk.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/disk.lua new file mode 100644 index 0000000000..ebc37ef3a4 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/disk.lua @@ -0,0 +1,74 @@ +--[[ + +Luci statistics - df plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: df.lua 2274 2008-06-03 23:15:16Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.disk", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + return { + { + title = "%H: Disk I/O operations on %pi", + vlabel = "Operations/s", + number_format = "%5.1lf%sOp/s", + + data = { + types = { "disk_ops" }, + sources = { + disk_ops = { "read", "write" }, + }, + + options = { + disk_ops__read = { + title = "Reads", + color = "00ff00", + flip = false + }, + + disk_ops__write = { + title = "Writes", + color = "ff0000", + flip = true + } + } + } + }, + + { + title = "%H: Disk I/O bandwidth on %pi", + vlabel = "Bytes/s", + number_format = "%5.1lf%sB/s", + + detail = true, + + data = { + types = { "disk_octets" }, + sources = { + disk_octets = { "read", "write" } + }, + options = { + disk_octets__read = { + title = "Read", + color = "00ff00", + flip = false + }, + disk_octets__write = { + title = "Write", + color = "ff0000", + flip = true + } + } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/dns.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/dns.lua new file mode 100644 index 0000000000..94a148d810 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/dns.lua @@ -0,0 +1,81 @@ +--[[ + +Luci statistics - dns plugin diagram definition + +Copyright 2011 Manuel Munz <freifunk at somakoma dot de> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +]]-- + +module("luci.statistics.rrdtool.definitions.dns", package.seeall) + +function rrdargs( graph, plugin, plugin_instance ) + + local traffic = { + title = "%H: DNS traffic", vlabel = "Bit/s", + + data = { + sources = { + dns_octets = { "queries", "responses" } + }, + + options = { + dns_octets__responses = { + total = true, + color = "00ff00", + title = "Responses" + }, + + dns_octets__queries = { + total = true, + color = "0000ff", + title = "Queries" + } + } + } + } + + local opcode_query = { + title = "%H: DNS Opcode Query", vlabel = "Queries/s", + data = { + instances = { dns_opcode = { "Query" } }, + options = { + dns_opcode_Query_value = { + total = true, + color = "0000ff", + title = "Queries/s" + }, + } + } + } + + local qtype = { + title = "%H: DNS QType", vlabel = "Queries/s", + data = { + sources = { dns_qtype = { "" } }, + options = { + dns_qtype_AAAA_ = { title = "AAAA", noarea = true, total = true }, + dns_qtype_A_ = { title = "A", noarea = true, total = true }, + dns_qtype_A6_ = { title = "A6", noarea = true, total = true }, + dns_qtype_TXT_ = { title = "TXT", noarea = true, total = true }, + dns_qtype_MX_ = { title = "MX", noarea = true, total = true }, + dns_qtype_NS_ = { title = "NS", noarea = true, total = true }, + dns_qtype_ANY_ = { title = "ANY", noarea = true, total = true }, + dns_qtype_CNAME_= { title = "CNAME", noarea = true, total = true }, + dns_qtype_SOA_ = { title = "SOA", noarea = true, total = true }, + dns_qtype_SRV_ = { title = "SRV", noarea = true, total = true }, + dns_qtype_PTR_ = { title = "PTR", noarea = true, total = true }, + dns_qtype_RP_ = { title = "RP", noarea = true, total = true }, + dns_qtype_MAILB_= { title = "MAILB", noarea = true, total = true }, + dns_qtype_IXFR_ = { title = "IXFR", noarea = true, total = true }, + dns_qtype_HINFO_= { title = "HINFO", noarea = true, total = true }, + }, + } + } + + return { traffic, opcode_query, qtype } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua new file mode 100644 index 0000000000..a6f3b5c6a6 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua @@ -0,0 +1,117 @@ +--[[ + +Luci statistics - interface plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +module("luci.statistics.rrdtool.definitions.interface", package.seeall) + +function rrdargs( graph, plugin, plugin_instance ) + + -- + -- traffic diagram + -- + local traffic = { + + -- draw this diagram for each plugin instance + per_instance = true, + title = "%H: Transfer on %pi", + 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 + title = "Bytes (TX)" + }, + + if_octets__rx = { + flip = true, -- flip rx line + total = true, -- report total amount of bytes + color = "0000ff", -- rx is blue + title = "Bytes (RX)" + } + } + } + } + + + -- + -- packet diagram + -- + local packets = { + + -- draw this diagram for each plugin instance + per_instance = true, + title = "%H: Packets on %pi", + vlabel = "Packets/s", + + -- diagram data description + data = { + -- data type order + types = { "if_packets", "if_errors" }, + + -- defined sources for data types + sources = { + if_packets = { "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 + title = "Processed (tx)" + }, + + -- 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 + title = "Processed (rx)" + }, + + -- 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 + title = "Errors (tx)" + }, + + -- 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 + title = "Errors (rx)" + } + } + } + } + + return { traffic, packets } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua new file mode 100644 index 0000000000..c1adbdc619 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua @@ -0,0 +1,53 @@ +--[[ + +Luci statistics - iptables plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: ipt_bytes.lua 2276 2008-06-03 23:18:37Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.iptables", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + { + title = "%H: Firewall: Processed bytes in %pi", + vlabel = "Bytes/s", + number_format = "%5.0lf%sB/s", + totals_format = "%5.0lf%sB", + data = { + types = { "ipt_bytes" }, + options = { + ipt_bytes = { + total = true, + title = "%di" + } + } + } + }, + + { + title = "%H: Firewall: Processed packets in %pi", + vlabel = "Packets/s", + number_format = "%5.1lf P/s", + totals_format = "%5.0lf%s", + data = { + types = { "ipt_packets" }, + options = { + ipt_packets = { + total = true, + title = "%di" + } + } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/irq.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/irq.lua new file mode 100644 index 0000000000..aabe14a037 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/irq.lua @@ -0,0 +1,30 @@ +--[[ + +Luci statistics - irq plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: irq.lua 2276 2008-06-03 23:18:37Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.irq", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Interrupts", vlabel = "Issues/s", + number_format = "%5.0lf", data = { + types = { "irq" }, + options = { + irq = { title = "IRQ %di", noarea = true } + } + } + } + +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua new file mode 100644 index 0000000000..0c6eed9936 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua @@ -0,0 +1,102 @@ +--[[ + +Luci statistics - wireless plugin diagram definition +(c) 2011 Jo-Philipp Wich <xm@subsignal.org> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +module("luci.statistics.rrdtool.definitions.iwinfo", package.seeall) + +function rrdargs( graph, plugin, plugin_instance ) + + -- + -- signal/noise diagram + -- + local snr = { + title = "%H: Signal and noise on %pi", + vlabel = "dBm", + number_format = "%5.1lf dBm", + data = { + types = { "signal_noise", "signal_power" }, + options = { + signal_power = { + title = "Signal", + overlay = true, + color = "0000ff" + }, + signal_noise = { + title = "Noise", + overlay = true, + color = "ff0000" + } + } + } + } + + + -- + -- signal quality diagram + -- + local quality = { + title = "%H: Signal quality on %pi", + vlabel = "Quality", + number_format = "%3.0lf", + data = { + types = { "signal_quality" }, + options = { + signal_quality = { + title = "Quality", + noarea = true, + color = "0000ff" + } + } + } + } + + + -- + -- phy rate diagram + -- + local bitrate = { + title = "%H: Average phy rate on %pi", + vlabel = "MBit/s", + number_format = "%5.1lf%sBit/s", + data = { + types = { "bitrate" }, + options = { + bitrate = { + title = "Rate", + color = "00ff00" + } + } + } + } + + -- + -- associated stations + -- + local stations = { + title = "%H: Associated stations on %pi", + vlabel = "Stations", + number_format = "%3.0lf", + data = { + types = { "stations" }, + options = { + stations = { + title = "Stations", + color = "0000ff" + } + } + } + } + + return { snr, quality, bitrate, stations } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/load.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/load.lua new file mode 100644 index 0000000000..4cb4795ef6 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/load.lua @@ -0,0 +1,36 @@ +--[[ + +Luci statistics - load plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: load.lua 2329 2008-06-08 21:51:55Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.load", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Load", vlabel = "Load", + y_min = "0", + units_exponent = "0", + number_format = "%5.2lf", data = { + sources = { + load = { "shortterm", "midterm", "longterm" } + }, + + options = { + load__shortterm = { color = "ff0000", title = "1 minute", noarea = true }, + load__midterm = { color = "ff6600", title = "5 minutes", noarea = true }, + load__longterm = { color = "ffaa00", title = "15 minutes", noarea = true } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua new file mode 100644 index 0000000000..a1c65f56d7 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua @@ -0,0 +1,33 @@ +--[[ + +(c) 2011 Manuel Munz <freifunk at somakoma dot de> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +]]-- + +module("luci.statistics.rrdtool.definitions.memory",package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Memory usage", + vlabel = "MB", + number_format = "%5.1lf%s", + data = { + instances = { + memory = { "free", "buffered", "cached", "used" } + }, + + options = { + memory_buffered = { color = "0000ff", title = "Buffered" }, + memory_cached = { color = "ff00ff", title = "Cached" }, + memory_used = { color = "ff0000", title = "Used" }, + memory_free = { color = "00ff00", title = "Free" } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua new file mode 100644 index 0000000000..9313952518 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua @@ -0,0 +1,203 @@ +--[[ + +Luci statistics - netlink plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +module("luci.statistics.rrdtool.definitions.netlink", package.seeall) + +function rrdargs( graph, plugin, plugin_instance ) + + -- + -- traffic diagram + -- + local traffic = { + title = "%H: Netlink - Transfer on %pi", + 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 + } + } + } + } + + + -- + -- packet diagram + -- + local packets = { + title = "%H: Netlink - Packets on %pi", + vlabel = "Packets/s", detail = true, + + -- 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 + } + } + } + } + + + -- + -- multicast diagram + -- + local multicast = { + title = "%H: Netlink - Multicast on %pi", + vlabel = "Packets/s", detail = true, + + -- 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 + } + } + } + } + + + -- + -- collision diagram + -- + local collisions = { + title = "%H: Netlink - Collisions on %pi", + vlabel = "Collisions/s", detail = true, + + -- 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 + } + } + } + } + + + -- + -- error diagram + -- + local errors = { + title = "%H: Netlink - Errors on %pi", + vlabel = "Errors/s", detail = true, + + -- 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 + } + } + } + } + + + return { traffic, packets, multicast, collisions, errors } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua new file mode 100644 index 0000000000..69f1ae305c --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua @@ -0,0 +1,106 @@ +--[[ + +Luci statistics - ups plugin diagram definition +Copyright © 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> +Copyright © 2012 David Woodhouse <dwmw2@infradead.org> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +]]-- + + +module("luci.statistics.rrdtool.definitions.nut",package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + local voltages = { + title = "%H: Voltages on UPS \"%pi\"", + vlabel = "V", + number_format = "%5.1lfV", + data = { + instances = { + voltage = { "battery", "input", "output" } + }, + + options = { + voltage_output = { color = "00e000", title = "Output voltage", noarea=true, overlay=true }, + voltage_battery = { color = "0000ff", title = "Battery voltage", noarea=true, overlay=true }, + voltage_input = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true } + } + } + } + + local currents = { + title = "%H: Current on UPS \"%pi\"", + vlabel = "A", + number_format = "%5.3lfA", + data = { + instances = { + current = { "battery", "output" } + }, + + options = { + current_output = { color = "00e000", title = "Output current", noarea=true, overlay=true }, + current_battery = { color = "0000ff", title = "Battery current", noarea=true, overlay=true }, + } + } + } + + local percentage = { + title = "%H: Battery charge on UPS \"%pi\"", + vlabel = "Percent", + y_min = "0", + y_max = "100", + number_format = "%5.1lf%%", + data = { + sources = { + percent = { "percent" } + }, + instances = { + percent = "charge" + }, + options = { + percent_charge = { color = "00ff00", title = "Charge level" } + } + } + } + + -- Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century. + local temperature = { + title = "%H: Battery temperature on UPS \"%pi\"", + vlabel = "\176C", + number_format = "%5.1lf\176C", + data = { + instances = { + temperature = "battery" + }, + + options = { + temperature_battery = { color = "ffb000", title = "Battery temperature" } + } + } + } + + local timeleft = { + title = "%H: Time left on UPS \"%pi\"", + vlabel = "Minutes", + number_format = "%.1lfm", + data = { + sources = { + timeleft = { "timeleft" } + }, + instances = { + timeleft = { "battery" } + }, + options = { + timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/" } + } + } + } + + return { voltages, currents, percentage, temperature, timeleft } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua new file mode 100644 index 0000000000..3ca2f03ec8 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua @@ -0,0 +1,146 @@ +--[[ + +Luci statistics - olsrd plugin diagram definition + +Copyright 2011 Manuel Munz <freifunk at somakoma dot de> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +]]-- + +module("luci.statistics.rrdtool.definitions.olsrd", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + local g = { } + + if plugin_instance == "routes" then + + g[#g+1] = { + -- diagram data description + title = "%H: Total amount of OLSR routes", vlabel = "n", + number_format = "%5.0lf", data = { + types = { "routes" }, + options = { + routes = { + color = "ff0000", + title = "Total number of routes" + } + } + } + } + + g[#g+1] = { + title = "%H: Average route ETX", vlabel = "ETX", detail = true, + number_format = "%5.1lf",data = { + instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert + types = { "route_etx" }, + options = { + route_etx = { + title = "Average route ETX" + } + } + } + } + + g[#g+1] = { + title = "%H: Average route metric", vlabel = "metric", detail = true, + number_format = "%5.1lf", data = { + instances = { "average" }, -- falls es irgendwann mal welche pro ip gibt, wie bei links, dann werden die hier excludiert + types = { "route_metric" }, + options = { + route_metric = { + title = "Average route metric" + } + } + } + } + + elseif plugin_instance == "links" then + + g[#g+1] = { + -- diagram data description + title = "%H: Total amount of OLSR neighbours", vlabel = "n", + number_format = "%5.0lf", data = { + instances = { "" }, + types = { "links" }, + options = { + links = { + color = "00ff00", + title = "Number of neighbours" + } + } + } + } + + local instances = graph.tree:data_instances(plugin, plugin_instance, "signal_quality") + table.sort(instances) + + -- define one diagram per host, containing the rx and lq values + local i + for i = 1, #instances, 2 do + local dsn1 = "signal_quality_%s_value" % instances[i]:gsub("[^%w]+", "_") + local dsn2 = "signal_quality_%s_value" % instances[i+1]:gsub("[^%w]+", "_") + local host = instances[i]:match("^[^%-]+%-([^%-]+)%-.+") + + g[#g+1] = { + title = "%H: Signal Quality" .. " (" .. (host or "avg") ..")", vlabel = "ETX", + number_format = "%5.2lf", detail = true, + data = { + types = { "signal_quality" }, + + instances = { + signal_quality = { instances[i], instances[i+1] }, + }, + + options = { + [dsn1] = { + color = "00ff00", + title = "LQ (%s)" % (host or "avg"), + }, + [dsn2] = { + color = "0000ff", + title = "NLQ (%s)" % (host or "avg"), + flip = true + } + } + } + } + end + + elseif plugin_instance == "topology" then + + g[#g+1] = { + title= "%H: Total amount of OLSR links", vlabel = "n", + number_format = "%5.0lf", data = { + instances = { "" }, + types = { "links" }, + options = { + links = { + color = "0000ff", + title = "Total number of links" + } + } + } + } + + g[#g+1] = { + title= "%H: Average signal quality", vlabel = "n", + number_format = "%5.2lf", detail = true, + data = { + instances = { "average" }, -- exclude possible per-ip stuff + types = { "signal_quality" }, + options = { + signal_quality = { + color = "0000ff", + title = "Average signal quality" + } + } + } + } + end + + return g +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua new file mode 100644 index 0000000000..bdffc85997 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua @@ -0,0 +1,41 @@ +--[[ + +Luci statistics - ping plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: ping.lua 6810 2011-01-29 03:33:48Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.ping", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + return { + -- Ping roundtrip time + { title = "%H: ICMP Round Trip Time", vlabel = "ms", + number_format = "%5.1lf ms", data = { + sources = { ping = { "value" } }, + options = { ping__ping = { noarea = true, title = "%di" } } + } }, + + -- Ping droprate + { title = "%H: ICMP Drop Rate", vlabel = "%", + number_format = "%5.2lf %%", data = { + types = { "ping_droprate" }, + options = { ping_droprate = { title = "%di" } } + } }, + + -- Ping standard deviation + { title = "%H: ICMP Standard Deviation", vlabel = "ms", + number_format = "%5.2lf ms", data = { + types = { "ping_stddev" }, + options = { ping_stddev = { title = "%di" } } + } }, + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua new file mode 100644 index 0000000000..6f83c8e283 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua @@ -0,0 +1,110 @@ +--[[ + +Luci statistics - processes plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +]]-- + +module("luci.statistics.rrdtool.definitions.processes", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + { + title = "%H: Processes", + vlabel = "Processes/s", + data = { + instances = { + ps_state = { + "sleeping", "running", "paging", "blocked", "stopped", "zombies" + } + }, + + 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" } + } + } + }, + + { + title = "%H: CPU time used by %pi", + vlabel = "Jiffies", + data = { + sources = { + ps_cputime = { "syst", "user" } + }, + + options = { + ps_cputime__user = { + color = "0000ff", + overlay = true + }, + + ps_cputime__syst = { + color = "ff0000", + overlay = true + } + } + } + }, + + { + title = "%H: Threads and processes belonging to %pi", + vlabel = "Count", + detail = true, + data = { + sources = { + ps_count = { "threads", "processes" } + }, + + options = { + ps_count__threads = { color = "00ff00" }, + ps_count__processes = { color = "0000bb" } + } + } + }, + + { + title = "%H: Page faults in %pi", + vlabel = "Pagefaults", + detail = true, + data = { + sources = { + ps_pagefaults = { "minflt", "majflt" } + }, + + options = { + ps_pagefaults__minflt = { color = "ff0000" }, + ps_pagefaults__majflt = { color = "ff5500" } + } + } + }, + + { + title = "%H: Virtual memory size of %pi", + vlabel = "Bytes", + detail = true, + number_format = "%5.1lf%sB", + data = { + types = { "ps_rss" }, + + options = { + ps_rss = { color = "0000ff" } + } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/splash_leases.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/splash_leases.lua new file mode 100644 index 0000000000..69f3c113cd --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/splash_leases.lua @@ -0,0 +1,37 @@ +--[[ + +Luci statistics - splash_leases plugin diagram definition +(c) 2013 Freifunk Augsburg / Michael Wendland <michael@michiwend.com> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + +]]-- + +module("luci.statistics.rrdtool.definitions.splash_leases", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Splash Leases", + vlabel = "Active Clients", + y_min = "0", + number_format = "%5.1lf", + data = { + sources = { + splash_leases = { "leased", "whitelisted", "blacklisted" } + }, + + options = { + splash_leases__leased = { color = "00CC00", title = "Leased", overlay = false }, + splash_leases__whitelisted = { color = "0000FF", title = "Whitelisted", overlay = false }, + splash_leases__blacklisted = { color = "FF0000", title = "Blacklisted", overlay = false } + } + } + } + +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua new file mode 100644 index 0000000000..4f1c221f9b --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua @@ -0,0 +1,37 @@ +--[[ + +Luci statistics - tcpconns plugin diagram definition +(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: tcp_connections.lua 2274 2008-06-03 23:15:16Z jow $ + +]]-- + +module("luci.statistics.rrdtool.definitions.tcpconns", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + return { + title = "%H: TCP connections to port %pi", + vlabel = "Connections/s", + number_format = "%5.0lf", + data = { + types = { "tcp_connections" }, + instances = { + tcp_connections = { + "SYN_SENT", "SYN_RECV", "LISTEN", "ESTABLISHED", + "LAST_ACK", "TIME_WAIT", "CLOSING", "CLOSE_WAIT", + "CLOSED", "FIN_WAIT1", "FIN_WAIT2" + }, + options = { + load__ESTABLISHED = { title = "%di", noarea = true } + } + } + } + } +end diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/uptime.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/uptime.lua new file mode 100644 index 0000000000..077ec57e83 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/uptime.lua @@ -0,0 +1,27 @@ +--[[ + +Copyright 2013 Thomas Endt <tmo26@gmx.de> + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +]]-- + +module("luci.statistics.rrdtool.definitions.uptime", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Uptime", vlabel = "seconds", + number_format = "%5.0lf%s", data = { + types = { "uptime" }, + options = { + uptime = { title = "Uptime %di", noarea = true } + } + } + } + +end + |