s_output = _("Output plugins"),
s_general = _("General plugins"),
s_network = _("Network plugins"),
-
- apcups = _("APC UPS"),
- conntrack = _("Conntrack"),
- contextswitch = _("Context Switches"),
- cpu = _("Processor"),
- cpufreq = _("CPU Frequency"),
- csv = _("CSV Output"),
- curl = _("cUrl"),
- df = _("Disk Space Usage"),
- disk = _("Disk Usage"),
- dns = _("DNS"),
- email = _("Email"),
- entropy = _("Entropy"),
- exec = _("Exec"),
- interface = _("Interfaces"),
- iptables = _("Firewall"),
- irq = _("Interrupts"),
- iwinfo = _("Wireless"),
- load = _("System Load"),
- memory = _("Memory"),
- netlink = _("Netlink"),
- network = _("Network"),
- nut = _("UPS"),
- olsrd = _("OLSRd"),
- openvpn = _("OpenVPN"),
- ping = _("Ping"),
- processes = _("Processes"),
- rrdtool = _("RRDTool"),
- sensors = _("Sensors"),
- splash_leases = _("Splash Leases"),
- tcpconns = _("TCP Connections"),
- thermal = _("Thermal"),
- unixsock = _("UnixSock"),
- uptime = _("Uptime")
}
-- our collectd menu
local collectd_menu = {
- output = { "csv", "network", "rrdtool", "unixsock" },
- general = { "apcups", "contextswitch", "cpu", "cpufreq", "df",
- "disk", "email", "entropy", "exec", "irq", "load", "memory",
- "nut", "processes", "sensors", "thermal", "uptime" },
- network = { "conntrack", "curl", "dns", "interface", "iptables",
- "netlink", "olsrd", "openvpn", "ping",
- "splash_leases", "tcpconns", "iwinfo" }
+ output = { },
+ general = { },
+ network = { }
}
+ 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", "")
+ table.insert(collectd_menu[plugin.category], name)
+ labels[name] = plugin.label
+ end
+
-- create toplevel menu nodes
local st = entry({"admin", "statistics"}, template("admin_statistics/index"), _("Statistics"), 80)
st.index = true
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()
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)