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/root/usr | |
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/root/usr')
34 files changed, 283 insertions, 5 deletions
diff --git a/applications/luci-app-statistics/root/usr/bin/stat-genconfig b/applications/luci-app-statistics/root/usr/bin/stat-genconfig index 82431fbd3..b5a880e13 100755 --- a/applications/luci-app-statistics/root/usr/bin/stat-genconfig +++ b/applications/luci-app-statistics/root/usr/bin/stat-genconfig @@ -20,6 +20,7 @@ require("luci.model.uci") require("luci.sys.iptparser") require("luci.util") require("luci.i18n") +require("luci.jsonc") require("nixio.fs") local ipt = luci.sys.iptparser.IptParser() @@ -284,11 +285,8 @@ plugins = { }, } -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", "") if (name == "exec") then plugins[name] = config_exec @@ -299,7 +297,10 @@ for filename in nixio.fs.dir(plugin_dir) do elseif (name == "network") then plugins[name] = config_network else - plugins[name] = plugin.legend + local plugin_def = luci.jsonc.parse(nixio.fs.readfile(plugin_dir .. filename)) + if type(plugin_def) == "table" then + plugins[name] = plugin_def.legend + end end end diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/apcups.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/apcups.json new file mode 100644 index 000000000..c67255df2 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/apcups.json @@ -0,0 +1,9 @@ +{ + "title": "APC UPS", + "category": "general", + "legend": [ + ["Host", "Port"], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/conntrack.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/conntrack.json new file mode 100644 index 000000000..ad0895dd0 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/conntrack.json @@ -0,0 +1,9 @@ +{ + "title": "Conntrack", + "category": "network", + "legend": [ + [], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/contextswitch.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/contextswitch.json new file mode 100644 index 000000000..c11a55cd0 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/contextswitch.json @@ -0,0 +1,9 @@ +{ + "title": "Context Switches", + "category": "general", + "legend": [ + [], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/cpu.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/cpu.json new file mode 100644 index 000000000..1c9b26c28 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/cpu.json @@ -0,0 +1,9 @@ +{ + "title": "Processor", + "category": "general", + "legend": [ + [], + ["ValuesPercentage", "ReportByCpu", "ReportByState"], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/cpufreq.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/cpufreq.json new file mode 100644 index 000000000..1bb7d6067 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/cpufreq.json @@ -0,0 +1,9 @@ +{ + "title": "CPU Frequency", + "category": "general", + "legend": [ + [], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/csv.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/csv.json new file mode 100644 index 000000000..36f0ff7f1 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/csv.json @@ -0,0 +1,9 @@ +{ + "title": "CSV Output", + "category": "output", + "legend": [ + ["DataDir"], + ["StoreRates"], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/curl.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/curl.json new file mode 100644 index 000000000..3e92af6b8 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/curl.json @@ -0,0 +1,4 @@ +{ + "title": "cUrl", + "category": "network" +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/df.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/df.json new file mode 100644 index 000000000..b6cfe53a2 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/df.json @@ -0,0 +1,9 @@ +{ + "title": "Disk Space Usage", + "category": "general", + "legend": [ + [], + ["IgnoreSelected"], + ["Devices", "MountPoints", "FSTypes"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/disk.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/disk.json new file mode 100644 index 000000000..57d7c65b0 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/disk.json @@ -0,0 +1,9 @@ +{ + "title": "Disk Usage", + "category": "general", + "legend": [ + [], + ["IgnoreSelected"], + ["Disks"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/dns.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/dns.json new file mode 100644 index 000000000..72d5848b2 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/dns.json @@ -0,0 +1,9 @@ +{ + "title": "DNS", + "category": "network", + "legend": [ + [], + [], + ["Interfaces", "IgnoreSources"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/email.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/email.json new file mode 100644 index 000000000..b69a8c32d --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/email.json @@ -0,0 +1,9 @@ +{ + "title": "Email", + "category": "general", + "legend": [ + ["SocketFile", "SocketGroup", "SocketPerms", "MaxConns"], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/entropy.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/entropy.json new file mode 100644 index 000000000..da59af696 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/entropy.json @@ -0,0 +1,9 @@ +{ + "title": "Entropy", + "category": "general", + "legend": [ + [], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/exec.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/exec.json new file mode 100644 index 000000000..b26354c7a --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/exec.json @@ -0,0 +1,4 @@ +{ + "title": "Exec", + "category": "general" +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/interface.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/interface.json new file mode 100644 index 000000000..0af71c495 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/interface.json @@ -0,0 +1,9 @@ +{ + "title": "Interfaces", + "category": "network", + "legend": [ + [], + ["IgnoreSelected"], + ["Interfaces"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/iptables.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/iptables.json new file mode 100644 index 000000000..4558f83a3 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/iptables.json @@ -0,0 +1,4 @@ +{ + "title": "Firewall", + "category": "network" +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/irq.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/irq.json new file mode 100644 index 000000000..a3ff4ad64 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/irq.json @@ -0,0 +1,9 @@ +{ + "title": "Interrupts", + "category": "general", + "legend": [ + [], + ["IgnoreSelected"], + ["Irqs"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/iwinfo.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/iwinfo.json new file mode 100644 index 000000000..dc9c58c40 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/iwinfo.json @@ -0,0 +1,9 @@ +{ + "title": "Wireless", + "category": "network", + "legend": [ + [], + ["IgnoreSelected"], + ["Interfaces"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/load.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/load.json new file mode 100644 index 000000000..aff3cfffd --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/load.json @@ -0,0 +1,9 @@ +{ + "title": "System Load", + "category": "general", + "legend": [ + [], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/memory.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/memory.json new file mode 100644 index 000000000..2e1e2577a --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/memory.json @@ -0,0 +1,9 @@ +{ + "title": "Memory", + "category": "general", + "legend": [ + [], + ["ValuesPercentage", "ValuesAbsolute"], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/netlink.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/netlink.json new file mode 100644 index 000000000..e55ab79b7 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/netlink.json @@ -0,0 +1,9 @@ +{ + "title": "Netlink", + "category": "network", + "legend": [ + [], + ["IgnoreSelected"], + ["Interfaces", "VerboseInterfaces", "QDiscs", "Classes", "Filters"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/network.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/network.json new file mode 100644 index 000000000..2e8f85710 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/network.json @@ -0,0 +1,4 @@ +{ + "title": "Network", + "category": "output" +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/nut.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/nut.json new file mode 100644 index 000000000..aaf33be25 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/nut.json @@ -0,0 +1,9 @@ +{ + "title": "UPS", + "category": "general", + "legend": [ + [], + [], + ["UPS"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/olsrd.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/olsrd.json new file mode 100644 index 000000000..2ee2eee08 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/olsrd.json @@ -0,0 +1,9 @@ +{ + "title": "OLSRd", + "category": "network", + "legend": [ + ["Host", "Port", "CollectLinks", "CollectRoutes", "CollectTopology"], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/openvpn.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/openvpn.json new file mode 100644 index 000000000..520162d1f --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/openvpn.json @@ -0,0 +1,9 @@ +{ + "title": "OpenVPN", + "category": "network", + "legend": [ + [], + ["CollectIndividualUsers", "CollectUserCount", "CollectCompression", "ImprovedNamingSchema"], + ["StatusFile"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/ping.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/ping.json new file mode 100644 index 000000000..094360512 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/ping.json @@ -0,0 +1,9 @@ +{ + "title": "Ping", + "category": "network", + "legend": [ + ["TTL", "Interval", "AddressFamily"], + [], + ["Hosts"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/processes.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/processes.json new file mode 100644 index 000000000..9817e7a15 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/processes.json @@ -0,0 +1,9 @@ +{ + "title": "Processes", + "category": "general", + "legend": [ + [], + [], + ["Processes"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/rrdtool.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/rrdtool.json new file mode 100644 index 000000000..26a3e4ffc --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/rrdtool.json @@ -0,0 +1,9 @@ +{ + "title": "RRDTool", + "category": "output", + "legend": [ + ["DataDir", "StepSize", "HeartBeat", "RRARows", "XFF", "CacheFlush", "CacheTimeout"], + ["RRASingle"], + ["RRATimespans"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/sensors.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/sensors.json new file mode 100644 index 000000000..10a61fa17 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/sensors.json @@ -0,0 +1,9 @@ +{ + "title": "Sensors", + "category": "general", + "legend": [ + [], + ["IgnoreSelected"], + ["Sensor"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/splash_leases.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/splash_leases.json new file mode 100644 index 000000000..b99ed75ec --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/splash_leases.json @@ -0,0 +1,9 @@ +{ + "title": "Splash Leases", + "category": "network", + "legend": [ + [], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/tcpconns.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/tcpconns.json new file mode 100644 index 000000000..f932994b4 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/tcpconns.json @@ -0,0 +1,9 @@ +{ + "title": "TCP Connections", + "category": "network", + "legend": [ + [], + ["ListeningPorts"], + ["LocalPorts", "RemotePorts"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/thermal.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/thermal.json new file mode 100644 index 000000000..1aef15517 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/thermal.json @@ -0,0 +1,9 @@ +{ + "title": "Thermal", + "category": "general", + "legend": [ + [], + ["IgnoreSelected"], + ["Device"] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/unixsock.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/unixsock.json new file mode 100644 index 000000000..36a3fab60 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/unixsock.json @@ -0,0 +1,9 @@ +{ + "title": "UnixSock", + "category": "output", + "legend": [ + ["SocketFile", "SocketGroup", "SocketPerms"], + [], + [] + ] +} diff --git a/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/uptime.json b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/uptime.json new file mode 100644 index 000000000..c28f09391 --- /dev/null +++ b/applications/luci-app-statistics/root/usr/share/luci/statistics/plugins/uptime.json @@ -0,0 +1,9 @@ +{ + "title": "Uptime", + "category": "general", + "legend": [ + [], + [], + [] + ] +} |