summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics/luasrc/model/cbi
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-10-05 18:55:28 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-10-05 18:55:28 +0200
commit3289e134953887482bdaa28c28567917bb91facb (patch)
tree09d24627791b6cde12a4c49fb64ab04da7186302 /applications/luci-app-statistics/luasrc/model/cbi
parentcff2b99b4f9af0957ff6de4fe1ce48d30337b41b (diff)
luci-app-statistics: add initial support for collectd-mod-openvpn
This changeset covers compression and traffic stats, not every combination has been tested yet. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-statistics/luasrc/model/cbi')
-rw-r--r--applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/openvpn.lua56
1 files changed, 56 insertions, 0 deletions
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