summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics/luasrc
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/luasrc
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/luasrc')
-rw-r--r--applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua54
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/conntrack.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/contextswitch.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/cpu.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/cpufreq.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/csv.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/curl.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/df.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/disk.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/dns.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/email.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/entropy.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/exec.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/interface.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/iptables.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/irq.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/iwinfo.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/load.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/memory.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/netlink.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/network.lua4
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/nut.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/olsrd.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/openvpn.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/ping.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/processes.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/rrdtool.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/sensors.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/splash_leases.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/tcpconns.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/thermal.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/unixsock.lua9
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/plugins/uptime.lua9
34 files changed, 290 insertions, 41 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 eb7769b85..4c5db17d8 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
@@ -22,53 +22,25 @@ function index()
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
diff --git a/applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua b/applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua
new file mode 100644
index 000000000..c54b550c3
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/apcups.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..59f1a006b
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/conntrack.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..90b44c2e7
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/contextswitch.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..004a450ee
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/cpu.lua
@@ -0,0 +1,9 @@
+return {
+ legend = {
+ { },
+ { },
+ { }
+ },
+ 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
new file mode 100644
index 000000000..29d2b8e80
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/cpufreq.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..17a8621af
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/csv.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..04217bdd6
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/curl.lua
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 000000000..89acbff0f
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/df.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..3d6eeb5ab
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/disk.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..4d10b8658
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/dns.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..6d4c54a57
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/email.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..3b48d1644
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/entropy.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..4a972ccc8
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/exec.lua
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 000000000..e22026789
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/interface.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..75006b306
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/iptables.lua
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 000000000..fa17b939a
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/irq.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..658ff2aeb
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/iwinfo.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..fdd6891e2
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/load.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..8dee2dafc
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/memory.lua
@@ -0,0 +1,9 @@
+return {
+ legend = {
+ { },
+ { },
+ { }
+ },
+ 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
new file mode 100644
index 000000000..885caf0bd
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/netlink.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..5e4e62017
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/network.lua
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 000000000..c490c4fd7
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/nut.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..077729788
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/olsrd.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..850a995bc
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/openvpn.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..9ad16d802
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/ping.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..cabf8f1e4
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/processes.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..de5b4c7ec
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/rrdtool.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..713ab9aef
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/sensors.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..5640ea2bf
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/splash_leases.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..bb76522d3
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/tcpconns.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..e7e45f256
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/thermal.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..71f50e1db
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/unixsock.lua
@@ -0,0 +1,9 @@
+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
new file mode 100644
index 000000000..bb51a6a96
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/statistics/plugins/uptime.lua
@@ -0,0 +1,9 @@
+return {
+ legend = {
+ { },
+ { },
+ { }
+ },
+ label = _("Uptime"),
+ category = "general"
+}