luci-0.11: merge r9571 - r9622
[project/luci.git] / applications / luci-statistics / luasrc / model / cbi / luci_statistics / netlink.lua
1 --[[
2
3 Luci configuration model for statistics - collectd netlink 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 local devices = luci.sys.net.devices()
19
20
21 m = Map("luci_statistics",
22 translate("Netlink Plugin Configuration"),
23 translate(
24 "The netlink plugin collects extended informations like " ..
25 "qdisc-, class- and filter-statistics for selected interfaces."
26 ))
27
28 -- collectd_netlink config section
29 s = m:section( NamedSection, "collectd_netlink", "luci_statistics" )
30
31 -- collectd_netlink.enable
32 enable = s:option( Flag, "enable", translate("Enable this plugin") )
33 enable.default = 0
34
35 -- collectd_netlink.interfaces (Interface)
36 interfaces = s:option( MultiValue, "Interfaces", translate("Basic monitoring") )
37 interfaces.widget = "select"
38 interfaces.optional = true
39 interfaces.size = #devices + 1
40 interfaces:depends( "enable", 1 )
41 interfaces:value("")
42 for i, v in ipairs(devices) do
43 interfaces:value(v)
44 end
45
46 -- collectd_netlink.verboseinterfaces (VerboseInterface)
47 verboseinterfaces = s:option( MultiValue, "VerboseInterfaces", translate("Verbose monitoring") )
48 verboseinterfaces.widget = "select"
49 verboseinterfaces.optional = true
50 verboseinterfaces.size = #devices + 1
51 verboseinterfaces:depends( "enable", 1 )
52 verboseinterfaces:value("")
53 for i, v in ipairs(devices) do
54 verboseinterfaces:value(v)
55 end
56
57 -- collectd_netlink.qdiscs (QDisc)
58 qdiscs = s:option( MultiValue, "QDiscs", translate("Qdisc monitoring") )
59 qdiscs.widget = "select"
60 qdiscs.optional = true
61 qdiscs.size = #devices + 1
62 qdiscs:depends( "enable", 1 )
63 qdiscs:value("")
64 for i, v in ipairs(devices) do
65 qdiscs:value(v)
66 end
67
68 -- collectd_netlink.classes (Class)
69 classes = s:option( MultiValue, "Classes", translate("Shaping class monitoring") )
70 classes.widget = "select"
71 classes.optional = true
72 classes.size = #devices + 1
73 classes:depends( "enable", 1 )
74 classes:value("")
75 for i, v in ipairs(devices) do
76 classes:value(v)
77 end
78
79 -- collectd_netlink.filters (Filter)
80 filters = s:option( MultiValue, "Filters", translate("Filter class monitoring") )
81 filters.widget = "select"
82 filters.optional = true
83 filters.size = #devices + 1
84 filters:depends( "enable", 1 )
85 filters:value("")
86 for i, v in ipairs(devices) do
87 filters:value(v)
88 end
89
90 -- collectd_netlink.ignoreselected (IgnoreSelected)
91 ignoreselected = s:option( Flag, "IgnoreSelected", translate("Monitor all except specified") )
92 ignoreselected.default = 0
93 ignoreselected:depends( "enable", 1 )
94
95 return m