Merge pull request #501 from LuttyYang/master
[project/luci.git] / applications / luci-app-statistics / luasrc / model / cbi / luci_statistics / openvpn.lua
1 -- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 require "luci.sys"
5
6 local m, s, o
7
8
9 m = Map("luci_statistics",
10         translate("OpenVPN Plugin Configuration"),
11         translate("The OpenVPN plugin gathers information about the current vpn connection status."))
12
13 s = m:section( NamedSection, "collectd_openvpn", "luci_statistics" )
14
15
16 o = s:option( Flag, "enable", translate("Enable this plugin") )
17 o.default = "0"
18
19
20 o = s:option(Flag, "CollectIndividualUsers", translate("Generate a separate graph for each logged user"))
21 o.default = "0"
22 o.rmempty = true
23 o:depends("enable", 1)
24
25
26 o = s:option(Flag, "CollectUserCount", translate("Aggregate number of connected users"))
27 o.default = "0"
28 o.rmempty = true
29 o:depends("enable", 1)
30
31
32 o = s:option(Flag, "CollectCompression", translate("Gather compression statistics"))
33 o.default = "0"
34 o.rmempty = true
35 o:depends("enable", 1)
36
37
38 o = s:option(Flag, "ImprovedNamingSchema", translate("Use improved naming schema"))
39 o.default = "0"
40 o.rmempty = true
41 o:depends("enable", 1)
42
43
44 o = s:option(DynamicList, "StatusFile", translate("OpenVPN status files"))
45 o.rmempty = true
46 o:depends("enable", 1)
47
48 local status_files = nixio.fs.glob("/var/run/openvpn.*.status")
49 if status_files then
50         local status_file
51         for status_file in status_files do
52                 o:value(status_file)
53         end
54 end
55
56 return m