netlink.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. require("luci.sys")
  4. local devices = luci.sys.net.devices()
  5. m = Map("luci_statistics",
  6. translate("Netlink Plugin Configuration"),
  7. translate(
  8. "The netlink plugin collects extended informations like " ..
  9. "qdisc-, class- and filter-statistics for selected interfaces."
  10. ))
  11. -- collectd_netlink config section
  12. s = m:section( NamedSection, "collectd_netlink", "luci_statistics" )
  13. -- collectd_netlink.enable
  14. enable = s:option( Flag, "enable", translate("Enable this plugin") )
  15. enable.default = 0
  16. -- collectd_netlink.interfaces (Interface)
  17. interfaces = s:option( MultiValue, "Interfaces", translate("Basic monitoring") )
  18. interfaces.widget = "select"
  19. interfaces.optional = true
  20. interfaces.size = #devices + 1
  21. interfaces:depends( "enable", 1 )
  22. interfaces:value("")
  23. for i, v in ipairs(devices) do
  24. interfaces:value(v)
  25. end
  26. -- collectd_netlink.verboseinterfaces (VerboseInterface)
  27. verboseinterfaces = s:option( MultiValue, "VerboseInterfaces", translate("Verbose monitoring") )
  28. verboseinterfaces.widget = "select"
  29. verboseinterfaces.optional = true
  30. verboseinterfaces.size = #devices + 1
  31. verboseinterfaces:depends( "enable", 1 )
  32. verboseinterfaces:value("")
  33. for i, v in ipairs(devices) do
  34. verboseinterfaces:value(v)
  35. end
  36. -- collectd_netlink.qdiscs (QDisc)
  37. qdiscs = s:option( MultiValue, "QDiscs", translate("Qdisc monitoring") )
  38. qdiscs.widget = "select"
  39. qdiscs.optional = true
  40. qdiscs.size = #devices + 1
  41. qdiscs:depends( "enable", 1 )
  42. qdiscs:value("")
  43. for i, v in ipairs(devices) do
  44. qdiscs:value(v)
  45. end
  46. -- collectd_netlink.classes (Class)
  47. classes = s:option( MultiValue, "Classes", translate("Shaping class monitoring") )
  48. classes.widget = "select"
  49. classes.optional = true
  50. classes.size = #devices + 1
  51. classes:depends( "enable", 1 )
  52. classes:value("")
  53. for i, v in ipairs(devices) do
  54. classes:value(v)
  55. end
  56. -- collectd_netlink.filters (Filter)
  57. filters = s:option( MultiValue, "Filters", translate("Filter class monitoring") )
  58. filters.widget = "select"
  59. filters.optional = true
  60. filters.size = #devices + 1
  61. filters:depends( "enable", 1 )
  62. filters:value("")
  63. for i, v in ipairs(devices) do
  64. filters:value(v)
  65. end
  66. -- collectd_netlink.ignoreselected (IgnoreSelected)
  67. ignoreselected = s:option( Flag, "IgnoreSelected", translate("Monitor all except specified") )
  68. ignoreselected.default = 0
  69. ignoreselected:depends( "enable", 1 )
  70. return m