luci-0.11: merge outstanding trunk changes
[project/luci.git] / applications / luci-statistics / luasrc / model / cbi / luci_statistics / collectd.lua
1 --[[
2
3 Luci configuration model for statistics - general collectd 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("Collectd Settings"),
21 translate(
22 "Collectd is a small daemon for collecting data from " ..
23 "various sources through different plugins. On this page " ..
24 "you can change general settings for the collectd daemon."
25 ))
26
27 -- general config section
28 s = m:section( NamedSection, "collectd", "luci_statistics" )
29
30 -- general.hostname (Hostname)
31 hostname = s:option( Value, "Hostname", translate("Hostname") )
32 hostname.default = luci.sys.hostname()
33 hostname.optional = true
34
35 -- general.basedir (BaseDir)
36 basedir = s:option( Value, "BaseDir", translate("Base Directory") )
37 basedir.default = "/var/run/collectd"
38
39 -- general.include (Include)
40 include = s:option( Value, "Include", translate("Directory for sub-configurations") )
41 include.default = "/etc/collectd/conf.d/*.conf"
42
43 -- general.plugindir (PluginDir)
44 plugindir = s:option( Value, "PluginDir", translate("Directory for collectd plugins") )
45 plugindir.default = "/usr/lib/collectd/"
46
47 -- general.pidfile (PIDFile)
48 pidfile = s:option( Value, "PIDFile", translate("Used PID file") )
49 pidfile.default = "/var/run/collectd.pid"
50
51 -- general.typesdb (TypesDB)
52 typesdb = s:option( Value, "TypesDB", translate("Datasets definition file") )
53 typesdb.default = "/etc/collectd/types.db"
54
55 -- general.interval (Interval)
56 interval = s:option( Value, "Interval", translate("Data collection interval"), translate("Seconds") )
57 interval.default = 60
58 interval.isnumber = true
59
60 -- general.readthreads (ReadThreads)
61 readthreads = s:option( Value, "ReadThreads", translate("Number of threads for data collection") )
62 readthreads.default = 5
63 readthreads.isnumber = true
64
65 -- general.fqdnlookup (FQDNLookup)
66 fqdnlookup = s:option( Flag, "FQDNLookup", translate("Try to lookup fully qualified hostname") )
67 fqdnlookup.enabled = "true"
68 fqdnlookup.disabled = "false"
69 fqdnlookup.default = "false"
70 fqdnlookup.optional = true
71 fqdnlookup:depends( "Hostname", "" )
72
73
74 return m