Rework LuCI build system
[project/luci.git] / applications / luci-app-statistics / luasrc / model / cbi / luci_statistics / rrdtool.lua
1 --[[
2
3 Luci configuration model for statistics - collectd rrdtool 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("RRDTool Plugin Configuration"),
18         translate(
19                 "The rrdtool plugin stores the collected data in rrd database " ..
20                 "files, the foundation of the diagrams.<br /><br />" ..
21                 "<strong>Warning: Setting the wrong values will result in a very " ..
22                 "high memory consumption in the temporary directory. " ..
23                 "This can render the device unusable!</strong>"
24         ))
25
26 -- collectd_rrdtool config section
27 s = m:section( NamedSection, "collectd_rrdtool", "luci_statistics" )
28
29 -- collectd_rrdtool.enable
30 enable = s:option( Flag, "enable", translate("Enable this plugin") )
31 enable.default = 1
32
33 -- collectd_rrdtool.datadir (DataDir)
34 datadir = s:option( Value, "DataDir", translate("Storage directory") )
35 datadir.default  = "/tmp"
36 datadir.rmempty  = true
37 datadir.optional = true
38 datadir:depends( "enable", 1 )
39
40 -- collectd_rrdtool.stepsize (StepSize)
41 stepsize = s:option( Value, "StepSize",
42         translate("RRD step interval"), translate("Seconds") )
43 stepsize.default   = 30
44 stepsize.isinteger = true
45 stepsize.rmempty   = true
46 stepsize.optional  = true
47 stepsize:depends( "enable", 1 )
48
49 -- collectd_rrdtool.heartbeat (HeartBeat)
50 heartbeat = s:option( Value, "HeartBeat",
51         translate("RRD heart beat interval"), translate("Seconds") )
52 heartbeat.default   = 60
53 heartbeat.isinteger = true
54 heartbeat.rmempty   = true
55 heartbeat.optional  = true
56 heartbeat:depends( "enable", 1 )
57
58 -- collectd_rrdtool.rrasingle (RRASingle)
59 rrasingle = s:option( Flag, "RRASingle",
60         translate("Only create average RRAs"), translate("reduces rrd size") )
61 rrasingle.default  = true
62 rrasingle.rmempty  = true
63 rrasingle.optional = true
64 rrasingle:depends( "enable", 1 )
65
66 -- collectd_rrdtool.rratimespans (RRATimespan)
67 rratimespans = s:option( Value, "RRATimespans",
68         translate("Stored timespans"), translate("seconds; multiple separated by space") )
69 rratimespans.default  = "600 86400 604800 2678400 31622400"
70 rratimespans.rmempty  = true
71 rratimespans.optional = true
72 rratimespans:depends( "enable", 1 )
73
74 -- collectd_rrdtool.rrarows (RRARows)
75 rrarows = s:option( Value, "RRARows", translate("Rows per RRA") )
76 rrarows.isinteger = true
77 rrarows.default   = 100
78 rrarows.rmempty   = true
79 rrarows.optional  = true
80 rrarows:depends( "enable", 1 )
81
82 -- collectd_rrdtool.xff (XFF)
83 xff = s:option( Value, "XFF", translate("RRD XFiles Factor") )
84 xff.default  = 0.1
85 xff.isnumber = true
86 xff.rmempty  = true
87 xff.optional = true
88 xff:depends( "enable", 1 )
89
90 -- collectd_rrdtool.cachetimeout (CacheTimeout)
91 cachetimeout = s:option( Value, "CacheTimeout",
92         translate("Cache collected data for"), translate("Seconds") )
93 cachetimeout.isinteger = true
94 cachetimeout.default   = 100
95 cachetimeout.rmempty   = true
96 cachetimeout.optional  = true
97 cachetimeout:depends( "enable", 1 )
98
99 -- collectd_rrdtool.cacheflush (CacheFlush)
100 cacheflush = s:option( Value, "CacheFlush",
101         translate("Flush cache after"), translate("Seconds") )
102 cacheflush.isinteger = true
103 cacheflush.default   = 100
104 cacheflush.rmempty   = true
105 cacheflush.optional  = true
106 cacheflush:depends( "enable", 1 )
107
108 return m