diff options
author | Matthias Berndt <matthias_berndt@gmx.de> | 2019-07-04 00:40:58 +0200 |
---|---|---|
committer | Matthias Berndt <matthias_berndt@gmx.de> | 2019-07-05 02:03:13 +0200 |
commit | c1380ab36797dc4a9cba5a6aa738019452178d79 (patch) | |
tree | 7a4f9a750f5289e8d62124deca72475211bc12ea /applications/luci-app-statistics/root/usr/bin | |
parent | f56a6df49c9129f8d0b5451e9a8aca0315aba488 (diff) |
make luci-app-statistics more extensible
Diffstat (limited to 'applications/luci-app-statistics/root/usr/bin')
-rwxr-xr-x | applications/luci-app-statistics/root/usr/bin/stat-genconfig | 194 |
1 files changed, 10 insertions, 184 deletions
diff --git a/applications/luci-app-statistics/root/usr/bin/stat-genconfig b/applications/luci-app-statistics/root/usr/bin/stat-genconfig index cb091ae67..df36da419 100755 --- a/applications/luci-app-statistics/root/usr/bin/stat-genconfig +++ b/applications/luci-app-statistics/root/usr/bin/stat-genconfig @@ -19,6 +19,7 @@ $Id$ require("luci.model.uci") require("luci.sys.iptparser") require("luci.util") +require("nixio.fs") local ipt = luci.sys.iptparser.IptParser() local uci = luci.model.uci.cursor() @@ -270,206 +271,31 @@ end plugins = { - apcups = { - { "Host", "Port" }, - { }, - { } - }, - collectd = { { "BaseDir", "Include", "PIDFile", "PluginDir", "TypesDB", "Interval", "ReadThreads", "Hostname" }, { }, { } }, - - conntrack = { - { }, - { }, - { } - }, - - cpu = { - { }, - { }, - { } - }, - - cpufreq = { - { }, - { }, - { } - }, - - contextswitch = { - { }, - { }, - { } - }, - - csv = { - { "DataDir" }, - { "StoreRates" }, - { } - }, - curl = config_curl, - - df = { - { }, - { "IgnoreSelected" }, - { "Devices", "MountPoints", "FSTypes" } - }, - - disk = { - { }, - { "IgnoreSelected" }, - { "Disks" } - }, - - dns = { - { }, - { }, - { "Interfaces", "IgnoreSources" } - }, - - email = { - { "SocketFile", "SocketGroup", "SocketPerms", "MaxConns" }, - { }, - { } - }, - - entropy = { - { }, - { }, - { } - }, - exec = config_exec, - - interface = { - { }, - { "IgnoreSelected" }, - { "Interfaces" } - }, - iptables = config_iptables, - - irq = { - { }, - { "IgnoreSelected" }, - { "Irqs" } - }, - - iwinfo = { - { }, - { "IgnoreSelected" }, - { "Interfaces" } - }, - - load = { - { }, - { }, - { } - }, - logfile = { { "LogLevel", "File" }, { "Timestamp" }, { } }, - - memory = { - { }, - { }, - { } - }, - - netlink = { - { }, - { "IgnoreSelected" }, - { "Interfaces", "VerboseInterfaces", "QDiscs", "Classes", "Filters" } - }, - network = config_network, +} - nut = { - { }, - { }, - { "UPS" } - }, - - olsrd = { - { "Host", "Port", "CollectLinks","CollectRoutes","CollectTopology"}, - { }, - { } - }, - - openvpn = { - { }, - { "CollectIndividualUsers", "CollectUserCount", "CollectCompression", "ImprovedNamingSchema" }, - { "StatusFile" } - }, - - ping = { - { "TTL", "Interval", "AddressFamily" }, - { }, - { "Hosts" } - }, - - processes = { - { }, - { }, - { "Processes" } - }, - - rrdtool = { - { "DataDir", "StepSize", "HeartBeat", "RRARows", "XFF", "CacheFlush", "CacheTimeout" }, - { "RRASingle" }, - { "RRATimespans" } - }, - - sensors = { - { }, - { "IgnoreSelected" }, - { "Sensor" } - }, - - splash_leases = { - { }, - { }, - { } - }, - - tcpconns = { - { }, - { "ListeningPorts" }, - { "LocalPorts", "RemotePorts" } - }, - - thermal = { - { }, - { "IgnoreSelected" }, - { "Device" } - }, - - unixsock = { - { "SocketFile", "SocketGroup", "SocketPerms" }, - { }, - { } - }, - - uptime = { - { }, - { }, - { } - }, +local plugin_dir = "/usr/lib/lua/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", "") + plugins[name] = plugin.legend +end - wireless = { - { }, - { }, - { } - }, -} preprocess = { RRATimespans = function(val) |