openvpn.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. -- Copyright 2015 Jo-Philipp Wich <jow@openwrt.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. module("luci.statistics.rrdtool.definitions.openvpn", package.seeall)
  4. function rrdargs( graph, plugin, plugin_instance )
  5. local inst = plugin_instance:gsub("^openvpn%.(.+)%.status$", "%1")
  6. return {
  7. {
  8. title = "%%H: OpenVPN \"%s\" - Traffic" % inst,
  9. vlabel = "Bytes/s",
  10. data = {
  11. instances = {
  12. if_octets = { "traffic", "overhead" }
  13. },
  14. sources = {
  15. if_octets = { "tx", "rx" }
  16. },
  17. options = {
  18. if_octets_traffic_tx = { weight = 0, title = "Bytes (TX)", total = true, color = "00ff00" },
  19. if_octets_overhead_tx = { weight = 1, title = "Overhead (TX)", total = true, color = "ff9900" },
  20. if_octets_overhead_rx = { weight = 2, title = "Overhead (RX)", total = true, flip = true, color = "ff00ff" },
  21. if_octets_traffic_rx = { weight = 3, title = "Bytes (RX)", total = true, flip = true, color = "0000ff" }
  22. }
  23. }
  24. },
  25. {
  26. title = "%%H: OpenVPN \"%s\" - Compression" % inst,
  27. vlabel = "Bytes/s",
  28. data = {
  29. instances = {
  30. compression = { "data_out", "data_in" }
  31. },
  32. sources = {
  33. compression = { "uncompressed", "compressed" }
  34. },
  35. options = {
  36. compression_data_out_uncompressed = { weight = 0, title = "Uncompressed (TX)", total = true, color = "00ff00" },
  37. compression_data_out_compressed = { weight = 1, title = "Compressed (TX)", total = true, color = "008800" },
  38. compression_data_in_compressed = { weight = 2, title = "Compressed (RX)", total = true, flip = true, color = "000088" },
  39. compression_data_in_uncompressed = { weight = 3, title = "Uncompressed (RX)", total = true, flip = true, color = "0000ff" }
  40. }
  41. }
  42. }
  43. }
  44. end