summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-02-06 12:07:08 +0100
committerJo-Philipp Wich <jo@mein.io>2020-02-06 12:54:07 +0100
commit556e14c74307a9b93291e7c25d5eb71ab3260ab6 (patch)
tree47facc735b1c06ae201d66375d6778c826cc5fbd /applications/luci-app-statistics/luasrc
parente6f76f21ba7f0e8f903d5251a620386cd02b524b (diff)
luci-app-statistics: convert plugin definitions to JSON
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-statistics/luasrc')
-rw-r--r--applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua15
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/conntrack.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/contextswitch.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/cpu.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/cpufreq.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/csv.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/curl.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/df.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/disk.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/dns.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/email.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/entropy.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/exec.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/interface.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/iptables.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/irq.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/iwinfo.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/load.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/memory.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/netlink.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/network.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/nut.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/olsrd.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/openvpn.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/ping.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/processes.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/rrdtool.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/sensors.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/splash_leases.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/tcpconns.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/thermal.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/unixsock.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/uptime.lua9
34 files changed, 8 insertions, 284 deletions
diff --git a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
index 4c5db17d8..529cc2335 100644
--- a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
+++ b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
@@ -9,6 +9,7 @@ function index()
require("nixio.fs")
require("luci.util")
require("luci.statistics.datatree")
+ require("luci.jsonc")
-- override entry(): check for existence <plugin>.so where <plugin> is derived from the called path
function _entry( path, ... )
@@ -31,14 +32,14 @@ function index()
network = { }
}
- local plugin_dir = "/usr/lib/lua/luci/statistics/plugins/"
+ local plugin_dir = "/usr/share/luci/statistics/plugins/"
for filename in nixio.fs.dir(plugin_dir) do
- local plugin_fun = loadfile(plugin_dir .. filename)
- setfenv(plugin_fun, { _ = luci.i18n.translate })
- local plugin = plugin_fun()
- local name = filename:gsub("%.lua", "")
- table.insert(collectd_menu[plugin.category], name)
- labels[name] = plugin.label
+ local plugin_def = luci.jsonc.parse(nixio.fs.readfile(plugin_dir .. filename))
+ if type(plugin_def) == "table" then
+ local name = filename:gsub("%.json", "")
+ table.insert(collectd_menu[plugin_def.category], name)
+ labels[name] = plugin_def.title
+ end
end
-- create toplevel menu nodes
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua
deleted file mode 100644
index c54b550c3..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { "Host", "Port" },
- { },
- { }
- },
- label = _("APC UPS"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/conntrack.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/conntrack.lua
deleted file mode 100644
index 59f1a006b..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/conntrack.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { }
- },
- label = _("Conntrack"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/contextswitch.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/contextswitch.lua
deleted file mode 100644
index 90b44c2e7..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/contextswitch.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { }
- },
- label = _("Context Switches"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/cpu.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/cpu.lua
deleted file mode 100644
index bae325990..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/cpu.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "ValuesPercentage" , "ReportByCpu", "ReportByState" },
- { }
- },
- label = _("Processor"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/cpufreq.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/cpufreq.lua
deleted file mode 100644
index 29d2b8e80..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/cpufreq.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { }
- },
- label = _("CPU Frequency"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/csv.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/csv.lua
deleted file mode 100644
index 17a8621af..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/csv.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { "DataDir" },
- { "StoreRates" },
- { }
- },
- label = _("CSV Output"),
- category = "output"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/curl.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/curl.lua
deleted file mode 100644
index 04217bdd6..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/curl.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-return {
- label = _("cUrl"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/df.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/df.lua
deleted file mode 100644
index 89acbff0f..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/df.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Devices", "MountPoints", "FSTypes" }
- },
- label = _("Disk Space Usage"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/disk.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/disk.lua
deleted file mode 100644
index 3d6eeb5ab..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/disk.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Disks" }
- },
- label = _("Disk Usage"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/dns.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/dns.lua
deleted file mode 100644
index 4d10b8658..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/dns.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { "Interfaces", "IgnoreSources" }
- },
- label = _("DNS"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/email.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/email.lua
deleted file mode 100644
index 6d4c54a57..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/email.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { "SocketFile", "SocketGroup", "SocketPerms", "MaxConns" },
- { },
- { }
- },
- label = _("Email"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/entropy.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/entropy.lua
deleted file mode 100644
index 3b48d1644..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/entropy.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { }
- },
- label = _("Entropy"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/exec.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/exec.lua
deleted file mode 100644
index 4a972ccc8..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/exec.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-return {
- label = _("Exec"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/interface.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/interface.lua
deleted file mode 100644
index e22026789..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/interface.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Interfaces" }
- },
- label = _("Interfaces"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/iptables.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/iptables.lua
deleted file mode 100644
index 75006b306..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/iptables.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-return {
- label = _("Firewall"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/irq.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/irq.lua
deleted file mode 100644
index fa17b939a..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/irq.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Irqs" }
- },
- label = _("Interrupts"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/iwinfo.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/iwinfo.lua
deleted file mode 100644
index 658ff2aeb..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/iwinfo.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Interfaces" }
- },
- label = _("Wireless"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/load.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/load.lua
deleted file mode 100644
index fdd6891e2..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/load.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { }
- },
- label = _("System Load"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/memory.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/memory.lua
deleted file mode 100644
index 9ad1b3f88..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/memory.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "ValuesPercentage", "ValuesAbsolute" },
- { }
- },
- label = _("Memory"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/netlink.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/netlink.lua
deleted file mode 100644
index 885caf0bd..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/netlink.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Interfaces", "VerboseInterfaces", "QDiscs", "Classes", "Filters" }
- },
- label = _("Netlink"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/network.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/network.lua
deleted file mode 100644
index 5e4e62017..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/network.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-return {
- label = _("Network"),
- category = "output"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/nut.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/nut.lua
deleted file mode 100644
index c490c4fd7..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/nut.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { "UPS" }
- },
- label = _("UPS"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/olsrd.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/olsrd.lua
deleted file mode 100644
index 077729788..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/olsrd.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { "Host", "Port", "CollectLinks","CollectRoutes","CollectTopology"},
- { },
- { }
- },
- label = _("OLSRd"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/openvpn.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/openvpn.lua
deleted file mode 100644
index 850a995bc..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/openvpn.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "CollectIndividualUsers", "CollectUserCount", "CollectCompression", "ImprovedNamingSchema" },
- { "StatusFile" }
- },
- label = _("OpenVPN"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/ping.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/ping.lua
deleted file mode 100644
index 9ad16d802..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/ping.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { "TTL", "Interval", "AddressFamily" },
- { },
- { "Hosts" }
- },
- label = _("Ping"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/processes.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/processes.lua
deleted file mode 100644
index cabf8f1e4..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/processes.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { "Processes" }
- },
- label = _("Processes"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/rrdtool.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/rrdtool.lua
deleted file mode 100644
index de5b4c7ec..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/rrdtool.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { "DataDir", "StepSize", "HeartBeat", "RRARows", "XFF", "CacheFlush", "CacheTimeout" },
- { "RRASingle" },
- { "RRATimespans" }
- },
- label = _("RRDTool"),
- category = "output"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/sensors.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/sensors.lua
deleted file mode 100644
index 713ab9aef..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/sensors.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Sensor" }
- },
- label = _("Sensors"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/splash_leases.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/splash_leases.lua
deleted file mode 100644
index 5640ea2bf..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/splash_leases.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { }
- },
- label = _("Splash Leases"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/tcpconns.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/tcpconns.lua
deleted file mode 100644
index bb76522d3..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/tcpconns.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "ListeningPorts" },
- { "LocalPorts", "RemotePorts" }
- },
- label = _("TCP Connections"),
- category = "network"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/thermal.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/thermal.lua
deleted file mode 100644
index e7e45f256..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/thermal.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { "IgnoreSelected" },
- { "Device" }
- },
- label = _("Thermal"),
- category = "general"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/unixsock.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/unixsock.lua
deleted file mode 100644
index 71f50e1db..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/unixsock.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { "SocketFile", "SocketGroup", "SocketPerms" },
- { },
- { }
- },
- label = _("UnixSock"),
- category = "output"
-}
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/uptime.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/uptime.lua
deleted file mode 100644
index bb51a6a96..000000000
--- a/applications/luci-app-statistics/luasrc/statistics/plugins/uptime.lua
+++ /dev/null
@@ -1,9 +0,0 @@
-return {
- legend = {
- { },
- { },
- { }
- },
- label = _("Uptime"),
- category = "general"
-}