openvpn.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. -- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. require "luci.sys"
  4. local m, s, o
  5. m = Map("luci_statistics",
  6. translate("OpenVPN Plugin Configuration"),
  7. translate("The OpenVPN plugin gathers information about the current vpn connection status."))
  8. s = m:section( NamedSection, "collectd_openvpn", "luci_statistics" )
  9. o = s:option( Flag, "enable", translate("Enable this plugin") )
  10. o.default = "0"
  11. o = s:option(Flag, "CollectIndividualUsers", translate("Generate a separate graph for each logged user"))
  12. o.default = "0"
  13. o.rmempty = true
  14. o:depends("enable", 1)
  15. o = s:option(Flag, "CollectUserCount", translate("Aggregate number of connected users"))
  16. o.default = "0"
  17. o.rmempty = true
  18. o:depends("enable", 1)
  19. o = s:option(Flag, "CollectCompression", translate("Gather compression statistics"))
  20. o.default = "0"
  21. o.rmempty = true
  22. o:depends("enable", 1)
  23. o = s:option(Flag, "ImprovedNamingSchema", translate("Use improved naming schema"))
  24. o.default = "0"
  25. o.rmempty = true
  26. o:depends("enable", 1)
  27. o = s:option(DynamicList, "StatusFile", translate("OpenVPN status files"))
  28. o.rmempty = true
  29. o:depends("enable", 1)
  30. local status_files = nixio.fs.glob("/var/run/openvpn.*.status")
  31. if status_files then
  32. local status_file
  33. for status_file in status_files do
  34. o:value(status_file)
  35. end
  36. end
  37. return m