diff options
Diffstat (limited to 'applications/luci-app-statistics/luasrc/statistics')
28 files changed, 160 insertions, 3 deletions
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua index b9f48a45bd..4586b23caa 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua @@ -26,6 +26,7 @@ function Graph.__init__( self, timespan, opts ) opts.rramax = opts.rramax or ( sections.collectd_rrdtool.RRAMax == "1" ) opts.host = opts.host or sections.collectd.Hostname or sys.hostname() opts.width = opts.width or sections.rrdtool.image_width or 400 + opts.height = opts.height or sections.rrdtool.image_height or 100 opts.rrdpath = opts.rrdpath or sections.collectd_rrdtool.DataDir or "/tmp/rrd" opts.imgpath = opts.imgpath or sections.rrdtool.image_path or "/tmp/rrdimg" opts.rrdpath = opts.rrdpath:gsub("/$","") @@ -40,7 +41,8 @@ function Graph.__init__( self, timespan, opts ) self.args = { "-a", "PNG", "-s", "NOW-" .. opts.timespan, - "-w", opts.width + "-w", opts.width, + "-h", opts.height } -- store options @@ -60,7 +62,7 @@ function Graph._mkpath( self, plugin, plugin_instance, dtype, dtype_instance ) end function Graph.mkrrdpath( self, ... ) - return string.format( "%s/%s.rrd", self.opts.rrdpath, self:_mkpath( ... ) ) + return string.format( "%s/%s.rrd", self.opts.rrdpath, self:_mkpath( ... ):gsub("\\", "\\\\"):gsub(":", "\\:") ) end function Graph.mkpngpath( self, ... ) diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/apcups.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/apcups.lua index 37055f5861..637b5f9592 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/apcups.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/apcups.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.apcups",package.seeall) +function item() + return luci.i18n.translate("APC UPS") +end + function rrdargs( graph, plugin, plugin_instance ) local lu = require("luci.util") diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua index 5212b736e2..d99dab0f01 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.conntrack",package.seeall) +function item() + return luci.i18n.translate("Conntrack") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua index 6826e12adb..f9473e4406 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/contextswitch.lua @@ -2,6 +2,10 @@ module("luci.statistics.rrdtool.definitions.contextswitch",package.seeall) +function item() + return luci.i18n.translate("Context Switches") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua index ae0c0ce778..226c84ee96 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.cpu",package.seeall) +function item() + return luci.i18n.translate("Processor") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua index 25a72d2285..08aab04b85 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua @@ -2,6 +2,10 @@ module("luci.statistics.rrdtool.definitions.cpufreq",package.seeall) +function item() + return luci.i18n.translate("CPU Frequency") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/curl.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/curl.lua index 2bbdfb08fb..4fde243ca9 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/curl.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/curl.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.curl", package.seeall) +function item() + return luci.i18n.translate("cUrl") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua index b5633c15ff..fb732991ba 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/df.lua @@ -3,9 +3,13 @@ module("luci.statistics.rrdtool.definitions.df", package.seeall) +function item() + return luci.i18n.translate("Disk Space Usage") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) - return { + local df_complex = { title = "%H: Disk space usage on %pi", vlabel = "Bytes", number_format = "%5.1lf%sB", @@ -36,4 +40,51 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) } } } + + local percent_bytes = { + title = "%H: Disk space usage on %pi", + vlabel = "Percent", + number_format = "%5.2lf %%", + + data = { + instances = { + percent_bytes = { "free", "used", "reserved" } + }, + + options = { + percent_bytes_free = { + color = "00ff00", + overlay = false, + title = "free" + }, + + percent_bytes_used = { + color = "ff0000", + overlay = false, + title = "used" + }, + + percent_bytes_reserved = { + color = "0000ff", + overlay = false, + title = "reserved" + } + } + } + } + + local types = graph.tree:data_types( plugin, plugin_instance ) + + local p = {} + for _, t in ipairs(types) do + if t == "percent_bytes" then + p[#p+1] = percent_bytes + end + + if t == "df_complex" then + p[#p+1] = df_complex + end + end + + return p 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 index b6f7d6d5f8..29597ff989 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/disk.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/disk.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.disk", package.seeall) +function item() + return luci.i18n.translate("Disk Usage") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/dns.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/dns.lua index cf96d8fbe1..0ff4c76858 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/dns.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/dns.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.dns", package.seeall) +function item() + return luci.i18n.translate("DNS") +end + function rrdargs( graph, plugin, plugin_instance ) local traffic = { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua index 3d30a70afb..01eb33f9b4 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.entropy", package.seeall) +function item() + return luci.i18n.translate("Entropy") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua index 6ca65e539f..a4d4eefd53 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/interface.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.interface", package.seeall) +function item() + return luci.i18n.translate("Interfaces") +end + function rrdargs( graph, plugin, plugin_instance ) -- diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua index 9790e0e3d2..7218bfd441 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iptables.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.iptables", package.seeall) +function item() + return luci.i18n.translate("Firewall") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/irq.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/irq.lua index f61d0da646..56b4547b94 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/irq.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/irq.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.irq", package.seeall) +function item() + return luci.i18n.translate("Interrupts") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua index 194afd6fc0..53f4c7a40c 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.iwinfo", package.seeall) +function item() + return luci.i18n.translate("Wireless") +end + function rrdargs( graph, plugin, plugin_instance ) -- diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/load.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/load.lua index ce762dab46..b06c8c4148 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/load.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/load.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.load", package.seeall) +function item() + return luci.i18n.translate("System Load") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua index 53d559c599..b05d31dc02 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua @@ -11,6 +11,10 @@ You may obtain a copy of the License at module("luci.statistics.rrdtool.definitions.memory",package.seeall) +function item() + return luci.i18n.translate("Memory") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua index f485048538..bdd3f2eb44 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/netlink.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.netlink", package.seeall) +function item() + return luci.i18n.translate("Netlink") +end + function rrdargs( graph, plugin, plugin_instance ) -- diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua index dd93196902..84ca4951f9 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua @@ -2,6 +2,10 @@ module("luci.statistics.rrdtool.definitions.nut",package.seeall) +function item() + return luci.i18n.translate("UPS") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) local voltages = { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua index 481557bb7f..52bfbdf4f7 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.olsrd", package.seeall) +function item() + return luci.i18n.translate("OLSRd") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) local g = { } diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/openvpn.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/openvpn.lua index 876e871d1d..d16dbac908 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/openvpn.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/openvpn.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.openvpn", package.seeall) +function item() + return luci.i18n.translate("OpenVPN") +end + function rrdargs( graph, plugin, plugin_instance ) local inst = plugin_instance:gsub("^openvpn%.(.+)%.status$", "%1") diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua index 5b575bfff2..c3645e408c 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.ping", package.seeall) +function item() + return luci.i18n.translate("Ping") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua index 010ac1cd2e..4303824f34 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.processes", package.seeall) +function item() + return luci.i18n.translate("Processes") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) if plugin_instance == "" then diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/sensors.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/sensors.lua index b3119234a4..6e09a7b9f0 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/sensors.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/sensors.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.sensors", package.seeall) +function item() + return luci.i18n.translate("Sensors") +end + function rrdargs( graph, plugin, plugin_instance ) return { 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 index 1a192ae6a6..5af998cfb5 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/splash_leases.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/splash_leases.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.splash_leases", package.seeall) +function item() + return luci.i18n.translate("Splash Leases") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua index 7e7ed238f4..2d762f7a4c 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/tcpconns.lua @@ -3,6 +3,10 @@ module("luci.statistics.rrdtool.definitions.tcpconns", package.seeall) +function item() + return luci.i18n.translate("TCP Connections") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/thermal.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/thermal.lua index 532246465e..4a555a6054 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/thermal.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/thermal.lua @@ -2,6 +2,10 @@ module("luci.statistics.rrdtool.definitions.thermal",package.seeall) +function item() + return luci.i18n.translate("Thermal") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/uptime.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/uptime.lua index a50e78491f..8d7d42bc6b 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/uptime.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/uptime.lua @@ -11,6 +11,10 @@ You may obtain a copy of the License at module("luci.statistics.rrdtool.definitions.uptime", package.seeall) +function item() + return luci.i18n.translate("Uptime") +end + function rrdargs( graph, plugin, plugin_instance, dtype ) return { |