summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics/root/usr/bin/stat-genconfig
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2019-07-05 10:17:49 +0200
committerGitHub <noreply@github.com>2019-07-05 10:17:49 +0200
commit6122deefbd66d0ad5f929c968bd88000e2e49056 (patch)
tree4622d1e1864144232a41bd61eb2dca1f8a1c8bf2 /applications/luci-app-statistics/root/usr/bin/stat-genconfig
parent66c8ebfeffcffdcfcdf64888b7685dca26f82ff5 (diff)
parentc1380ab36797dc4a9cba5a6aa738019452178d79 (diff)
Merge pull request #2818 from mberndt123/mb/extensible-statistics
luci-app-statistics: more extensibility
Diffstat (limited to 'applications/luci-app-statistics/root/usr/bin/stat-genconfig')
-rwxr-xr-xapplications/luci-app-statistics/root/usr/bin/stat-genconfig194
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 cb091ae672..df36da419f 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)