dbb3e9dc06555e9ff823355655eb7ec8dd2df649
[project/luci.git] / applications / luci-app-statistics / luasrc / model / cbi / luci_statistics / interface.lua
1 --[[
2
3 Luci configuration model for statistics - collectd interface 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 require("luci.sys")
17
18
19 m = Map("luci_statistics",
20         translate("Interface Plugin Configuration"),
21         translate(
22                 "The interface plugin collects traffic statistics on " ..
23                 "selected interfaces."
24         ))
25
26 -- collectd_interface config section
27 s = m:section( NamedSection, "collectd_interface", "luci_statistics" )
28
29 -- collectd_interface.enable
30 enable = s:option( Flag, "enable", translate("Enable this plugin") )
31 enable.default = 0
32
33 -- collectd_interface.interfaces (Interface)
34 interfaces = s:option( MultiValue, "Interfaces", translate("Monitor interfaces") )
35 interfaces.widget = "select"
36 interfaces.size   = 5
37 interfaces:depends( "enable", 1 )
38 for k, v in pairs(luci.sys.net.devices()) do
39         interfaces:value(v)
40 end
41
42 -- collectd_interface.ignoreselected (IgnoreSelected)
43 ignoreselected = s:option( Flag, "IgnoreSelected", translate("Monitor all except specified") )
44 ignoreselected.default = 0
45 ignoreselected:depends( "enable", 1 )
46
47 return m