summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics/luasrc/model
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-statistics/luasrc/model')
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua14
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/network.lua2
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua2
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua56
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua125
5 files changed, 197 insertions, 2 deletions
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua
new file mode 100644
index 0000000000..d18bf910f9
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua
@@ -0,0 +1,14 @@
+-- Copyright 2015 Hannu Nyman <hannu.nyman@iki.fi>
+-- Licensed to the public under the Apache License 2.0.
+
+m = Map("luci_statistics",
+ translate("Entropy Plugin Configuration"),
+ translate("The entropy plugin collects statistics about the available entropy."))
+
+s = m:section( NamedSection, "collectd_entropy", "luci_statistics" )
+
+enable = s:option( Flag, "enable", translate("Enable this plugin") )
+enable.default = 0
+
+return m
+
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/network.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/network.lua
index 54b15de83f..547badf568 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/network.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/network.lua
@@ -6,7 +6,7 @@ m = Map("luci_statistics",
translate(
"The network plugin provides network based communication between " ..
"different collectd instances. Collectd can operate both in client " ..
- "and server mode. In client mode locally collected date is " ..
+ "and server mode. In client mode locally collected data is " ..
"transferred to a collectd server instance, in server mode the " ..
"local instance receives data from other hosts."
))
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua
index 59266e553c..950d7a7971 100644
--- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua
@@ -12,7 +12,7 @@ enable.default = 0
host = s:option(Value, "Host", translate("Host"), translate("IP or hostname where to get the txtinfo output from"))
host.placeholder = "127.0.0.1"
-host.datatype = "host"
+host.datatype = "host(1)"
host.rmempty = true
port = s:option(Value, "Port", translate("Port"))
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua
new file mode 100644
index 0000000000..193f0448ae
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua
@@ -0,0 +1,56 @@
+-- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
+
+require "luci.sys"
+
+local m, s, o
+
+
+m = Map("luci_statistics",
+ translate("OpenVPN Plugin Configuration"),
+ translate("The OpenVPN plugin gathers information about the current vpn connection status."))
+
+s = m:section( NamedSection, "collectd_openvpn", "luci_statistics" )
+
+
+o = s:option( Flag, "enable", translate("Enable this plugin") )
+o.default = "0"
+
+
+o = s:option(Flag, "CollectIndividualUsers", translate("Generate a separate graph for each logged user"))
+o.default = "0"
+o.rmempty = true
+o:depends("enable", 1)
+
+
+o = s:option(Flag, "CollectUserCount", translate("Aggregate number of connected users"))
+o.default = "0"
+o.rmempty = true
+o:depends("enable", 1)
+
+
+o = s:option(Flag, "CollectCompression", translate("Gather compression statistics"))
+o.default = "0"
+o.rmempty = true
+o:depends("enable", 1)
+
+
+o = s:option(Flag, "ImprovedNamingSchema", translate("Use improved naming schema"))
+o.default = "0"
+o.rmempty = true
+o:depends("enable", 1)
+
+
+o = s:option(DynamicList, "StatusFile", translate("OpenVPN status files"))
+o.rmempty = true
+o:depends("enable", 1)
+
+local status_files = nixio.fs.glob("/var/run/openvpn.*.status")
+if status_files then
+ local status_file
+ for status_file in status_files do
+ o:value(status_file)
+ end
+end
+
+return m
diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua
new file mode 100644
index 0000000000..77e36bfaff
--- /dev/null
+++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/sensors.lua
@@ -0,0 +1,125 @@
+-- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
+
+require "luci.sys"
+
+local m, s, o
+local sensor_types = {
+ ["12v"] = "voltage",
+ ["2.0v"] = "voltage",
+ ["2.5v"] = "voltage",
+ ["3.3v"] = "voltage",
+ ["5.0v"] = "voltage",
+ ["5v"] = "voltage",
+ ["ain1"] = "voltage",
+ ["ain2"] = "voltage",
+ ["cpu_temp"] = "temperature",
+ ["fan1"] = "fanspeed",
+ ["fan2"] = "fanspeed",
+ ["fan3"] = "fanspeed",
+ ["fan4"] = "fanspeed",
+ ["fan5"] = "fanspeed",
+ ["fan6"] = "fanspeed",
+ ["fan7"] = "fanspeed",
+ ["in0"] = "voltage",
+ ["in10"] = "voltage",
+ ["in2"] = "voltage",
+ ["in3"] = "voltage",
+ ["in4"] = "voltage",
+ ["in5"] = "voltage",
+ ["in6"] = "voltage",
+ ["in7"] = "voltage",
+ ["in8"] = "voltage",
+ ["in9"] = "voltage",
+ ["power1"] = "power",
+ ["remote_temp"] = "temperature",
+ ["temp1"] = "temperature",
+ ["temp2"] = "temperature",
+ ["temp3"] = "temperature",
+ ["temp4"] = "temperature",
+ ["temp5"] = "temperature",
+ ["temp6"] = "temperature",
+ ["temp7"] = "temperature",
+ ["temp"] = "temperature",
+ ["vccp1"] = "voltage",
+ ["vccp2"] = "voltage",
+ ["vdd"] = "voltage",
+ ["vid1"] = "voltage",
+ ["vid2"] = "voltage",
+ ["vid3"] = "voltage",
+ ["vid4"] = "voltage",
+ ["vid5"] = "voltage",
+ ["vid"] = "voltage",
+ ["vin1"] = "voltage",
+ ["vin2"] = "voltage",
+ ["vin3"] = "voltage",
+ ["vin4"] = "voltage",
+ ["volt12"] = "voltage",
+ ["volt5"] = "voltage",
+ ["voltbatt"] = "voltage",
+ ["vrm"] = "voltage"
+
+}
+
+
+m = Map("luci_statistics",
+ translate("Sensors Plugin Configuration"),
+ translate("The sensors plugin uses the Linux Sensors framework to gather environmental statistics."))
+
+s = m:section( NamedSection, "collectd_sensors", "luci_statistics" )
+
+
+o = s:option( Flag, "enable", translate("Enable this plugin") )
+o.default = 0
+
+
+o = s:option(Flag, "__all", translate("Monitor all sensors"))
+o:depends("enable", 1)
+o.default = 1
+o.write = function() end
+o.cfgvalue = function(self, sid)
+ local v = self.map:get(sid, "Sensor")
+ if v == nil or (type(v) == "table" and #v == 0) or (type(v) == "string" and #v == 0) then
+ return "1"
+ end
+end
+
+
+o = s:option(MultiValue, "Sensor", translate("Sensor list"), translate("Hold Ctrl to select multiple items or to deselect entries."))
+o:depends({enable = 1, __all = "" })
+o.widget = "select"
+o.rmempty = true
+o.size = 0
+
+local sensorcli = io.popen("/usr/sbin/sensors -u -A")
+if sensorcli then
+ local bus, sensor
+
+ while true do
+ local ln = sensorcli:read("*ln")
+ if not ln then
+ break
+ elseif ln:match("^[%w-]+$") then
+ bus = ln
+ elseif ln:match("^[%w-]+:$") then
+ sensor = ln:sub(0, -2):lower()
+ if bus and sensor_types[sensor] then
+ o:value("%s/%s-%s" %{ bus, sensor_types[sensor], sensor })
+ o.size = o.size + 1
+ end
+ elseif ln == "" then
+ bus = nil
+ sensor = nil
+ end
+ end
+
+ sensorcli:close()
+end
+
+
+o = s:option( Flag, "IgnoreSelected", translate("Monitor all except specified") )
+o.default = 0
+o.rmempty = true
+o:depends({ enable = 1, __all = "" })
+
+return m