997d455d9a3a66e79b8d3ad8fdf923033b166362
[project/luci.git] / applications / luci-app-statistics / luasrc / model / cbi / luci_statistics / exec.lua
1 --[[
2
3 Luci configuration model for statistics - collectd exec plugin configuration
4 (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 ]]--
15
16 m = Map("luci_statistics",
17         translate("Exec Plugin Configuration"),
18         translate(
19                 "The exec plugin starts external commands to read values " ..
20                 "from or to notify external processes when certain threshold " ..
21                 "values have been reached."
22         ))
23
24 -- collectd_exec config section
25 s = m:section( NamedSection, "collectd_exec", "luci_statistics" )
26
27 -- collectd_exec.enable
28 enable = s:option( Flag, "enable", translate("Enable this plugin") )
29 enable.default = 0
30
31
32 -- collectd_exec_input config section (Exec directives)
33 exec = m:section( TypedSection, "collectd_exec_input",
34         translate("Add command for reading values"),
35         translate(
36                 "Here you can define external commands which will be " ..
37                 "started by collectd in order to read certain values. " ..
38                 "The values will be read from stdout."
39         ))
40 exec.addremove = true
41 exec.anonymous = true
42
43 -- collectd_exec_input.cmdline
44 exec_cmdline = exec:option( Value, "cmdline", translate("Script") )
45 exec_cmdline.default = "/usr/bin/stat-dhcpusers"
46
47 -- collectd_exec_input.cmdline
48 exec_cmduser = exec:option( Value, "cmduser", translate("User") )
49 exec_cmduser.default  = "nobody"
50 exec_cmduser.rmempty  = true
51 exec_cmduser.optional = true
52
53 -- collectd_exec_input.cmdline
54 exec_cmdgroup = exec:option( Value, "cmdgroup", translate("Group") )
55 exec_cmdgroup.default  = "nogroup"
56 exec_cmdgroup.rmempty  = true
57 exec_cmdgroup.optional = true
58
59
60 -- collectd_exec_notify config section (NotifyExec directives)
61 notify = m:section( TypedSection, "collectd_exec_notify",
62         translate("Add notification command"),
63         translate(
64                 "Here you can define external commands which will be " ..
65                 "started by collectd when certain threshold values have " ..
66                 "been reached. The values leading to invokation will be " ..
67                 "feeded to the the called programs stdin."
68         ))
69 notify.addremove = true
70 notify.anonymous = true
71
72 -- collectd_notify_input.cmdline
73 notify_cmdline = notify:option( Value, "cmdline", translate("Script") )
74 notify_cmdline.default = "/usr/bin/stat-dhcpusers"
75
76 -- collectd_notify_input.cmdline
77 notify_cmduser = notify:option( Value, "cmduser", translate("User") )
78 notify_cmduser.default  = "nobody"
79 notify_cmduser.rmempty  = true
80 notify_cmduser.optional = true
81
82 -- collectd_notify_input.cmdline
83 notify_cmdgroup = notify:option( Value, "cmdgroup", translate("Group") )
84 notify_cmdgroup.default  = "nogroup"
85 notify_cmdgroup.rmempty  = true
86 notify_cmdgroup.optional = true
87
88
89 return m