exec.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. m = Map("luci_statistics",
  4. translate("Exec Plugin Configuration"),
  5. translate(
  6. "The exec plugin starts external commands to read values " ..
  7. "from or to notify external processes when certain threshold " ..
  8. "values have been reached."
  9. ))
  10. -- collectd_exec config section
  11. s = m:section( NamedSection, "collectd_exec", "luci_statistics" )
  12. -- collectd_exec.enable
  13. enable = s:option( Flag, "enable", translate("Enable this plugin") )
  14. enable.default = 0
  15. -- collectd_exec_input config section (Exec directives)
  16. exec = m:section( TypedSection, "collectd_exec_input",
  17. translate("Add command for reading values"),
  18. translate(
  19. "Here you can define external commands which will be " ..
  20. "started by collectd in order to read certain values. " ..
  21. "The values will be read from stdout."
  22. ))
  23. exec.addremove = true
  24. exec.anonymous = true
  25. -- collectd_exec_input.cmdline
  26. exec_cmdline = exec:option( Value, "cmdline", translate("Script") )
  27. exec_cmdline.default = "/usr/bin/stat-dhcpusers"
  28. -- collectd_exec_input.cmdline
  29. exec_cmduser = exec:option( Value, "cmduser", translate("User") )
  30. exec_cmduser.default = "nobody"
  31. exec_cmduser.rmempty = true
  32. exec_cmduser.optional = true
  33. -- collectd_exec_input.cmdline
  34. exec_cmdgroup = exec:option( Value, "cmdgroup", translate("Group") )
  35. exec_cmdgroup.default = "nogroup"
  36. exec_cmdgroup.rmempty = true
  37. exec_cmdgroup.optional = true
  38. -- collectd_exec_notify config section (NotifyExec directives)
  39. notify = m:section( TypedSection, "collectd_exec_notify",
  40. translate("Add notification command"),
  41. translate(
  42. "Here you can define external commands which will be " ..
  43. "started by collectd when certain threshold values have " ..
  44. "been reached. The values leading to invokation will be " ..
  45. "feeded to the the called programs stdin."
  46. ))
  47. notify.addremove = true
  48. notify.anonymous = true
  49. -- collectd_notify_input.cmdline
  50. notify_cmdline = notify:option( Value, "cmdline", translate("Script") )
  51. notify_cmdline.default = "/usr/bin/stat-dhcpusers"
  52. -- collectd_notify_input.cmdline
  53. notify_cmduser = notify:option( Value, "cmduser", translate("User") )
  54. notify_cmduser.default = "nobody"
  55. notify_cmduser.rmempty = true
  56. notify_cmduser.optional = true
  57. -- collectd_notify_input.cmdline
  58. notify_cmdgroup = notify:option( Value, "cmdgroup", translate("Group") )
  59. notify_cmdgroup.default = "nogroup"
  60. notify_cmdgroup.rmempty = true
  61. notify_cmdgroup.optional = true
  62. return m