diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-02-06 12:07:08 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-02-06 12:54:07 +0100 |
commit | 556e14c74307a9b93291e7c25d5eb71ab3260ab6 (patch) | |
tree | 47facc735b1c06ae201d66375d6778c826cc5fbd /applications/luci-app-statistics/luasrc | |
parent | e6f76f21ba7f0e8f903d5251a620386cd02b524b (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')
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 4c5db17d83..529cc2335a 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 c54b550c36..0000000000 --- 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 59f1a006b2..0000000000 --- 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 90b44c2e7d..0000000000 --- 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 bae325990e..0000000000 --- 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 29d2b8e80a..0000000000 --- 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 17a8621afe..0000000000 --- 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 04217bdd6e..0000000000 --- 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 89acbff0ff..0000000000 --- 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 3d6eeb5ab4..0000000000 --- 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 4d10b86580..0000000000 --- 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 6d4c54a574..0000000000 --- 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 3b48d1644d..0000000000 --- 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 4a972ccc84..0000000000 --- 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 e22026789b..0000000000 --- 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 75006b306b..0000000000 --- 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 fa17b939a8..0000000000 --- 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 658ff2aebe..0000000000 --- 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 fdd6891e2f..0000000000 --- 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 9ad1b3f88d..0000000000 --- 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 885caf0bda..0000000000 --- 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 5e4e620177..0000000000 --- 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 c490c4fd7a..0000000000 --- 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 077729788d..0000000000 --- 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 850a995bc2..0000000000 --- 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 9ad16d802b..0000000000 --- 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 cabf8f1e41..0000000000 --- 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 de5b4c7ecd..0000000000 --- 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 713ab9aef4..0000000000 --- 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 5640ea2bf7..0000000000 --- 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 bb76522d3a..0000000000 --- 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 e7e45f256b..0000000000 --- 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 71f50e1dbb..0000000000 --- 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 bb51a6a964..0000000000 --- a/applications/luci-app-statistics/luasrc/statistics/plugins/uptime.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - legend = { - { }, - { }, - { } - }, - label = _("Uptime"), - category = "general" -} |