summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-statistics/files
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-05-22 13:09:45 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-05-22 13:09:45 +0000
commit0e3371976118cc1cd36cb5d5cf5c379fe19e0020 (patch)
tree0f5959298003607813303d0a3252185d05e87b59 /applications/luci-statistics/files
parent68fd8eacdd84a40cda9535ad11cce54979cfc93f (diff)
* ffluci/statistics: add cbi model for rrdtool, fix stat-genconfig to allow correctly spelled list value parameters, updated default config
Diffstat (limited to 'applications/luci-statistics/files')
-rw-r--r--applications/luci-statistics/files/etc/config/luci_statistics29
-rwxr-xr-xapplications/luci-statistics/files/usr/bin/stat-genconfig127
2 files changed, 106 insertions, 50 deletions
diff --git a/applications/luci-statistics/files/etc/config/luci_statistics b/applications/luci-statistics/files/etc/config/luci_statistics
index 64beddb91e..1bb183f367 100644
--- a/applications/luci-statistics/files/etc/config/luci_statistics
+++ b/applications/luci-statistics/files/etc/config/luci_statistics
@@ -1,12 +1,12 @@
config 'statistics' 'general'
option 'BaseDir' '/var/run/collectd'
- option 'Include' '/etc/collectd/conf.d/*.conf'
+ option 'Include' '/etc/collectd/conf.d'
option 'PIDFile' '/var/run/collectd.pid'
option 'PluginDir' '/usr/lib/collectd'
option 'TypesDB' '/etc/collectd/types.db'
option 'Interval' '30'
- option 'ReadThreads' '5'
+ option 'ReadThreads' '2'
config 'statistics' 'collectd_ping'
option 'enable' '1'
@@ -14,7 +14,7 @@ config 'statistics' 'collectd_ping'
option 'Hosts' '127.0.0.1'
config 'statistics' 'collectd_csv'
- option 'enable' '1'
+ option 'enable' '0'
option 'StoreRates' '0'
option 'DataDir' '/tmp'
@@ -32,12 +32,13 @@ config 'statistics' 'collectd_disk'
config 'statistics' 'collectd_dns'
option 'enable' '1'
- option 'Interfaces' 'ffdhcp ff lan wan'
+ option 'Interfaces' 'ffdhcp ff br-lan'
option 'IgnoreSources' '127.0.0.1'
config 'statistics' 'collectd_email'
option 'enable' '1'
- option 'SocketFile' '/var/run/collectd-email.socket'
+ option 'SocketFile' '/var/run/collectd/email.sock'
+ option 'SocketGroup' 'nogroup'
config 'statistics' 'collectd_exec'
option 'enable' '1'
@@ -50,7 +51,7 @@ config 'collectd_exec_notify'
config 'statistics' 'collectd_interface'
option 'enable' '1'
- option 'Interfaces' 'ffdhcp ff lan wan'
+ option 'Interfaces' 'br-lan br-ff'
option 'IgnoreSelected' '0'
config 'statistics' 'collectd_iptables'
@@ -77,7 +78,7 @@ config 'statistics' 'collectd_irq'
option 'Irqs' '2 3 4 7'
config 'statistics' 'collectd_logfile'
- option 'enable' '1'
+ option 'enable' '0'
option 'LogLevel' 'notice'
option 'File' '/var/log/collectd.log'
option 'Timestamp' '1'
@@ -89,7 +90,7 @@ config 'statistics' 'collectd_netlink'
option 'QDiscs' 'br-lan br-ff'
config 'statistics' 'collectd_network'
- option 'enable' '1'
+ option 'enable' '0'
config 'collectd_network_listen'
option 'host' '0.0.0.0'
@@ -99,7 +100,6 @@ config 'collectd_network_server'
config 'statistics' 'collectd_processes'
option 'enable' '1'
- option 'Processs' 'olsrd tincd bmxd'
config 'statistics' 'collectd_tcpconns'
option 'enable' '1'
@@ -107,6 +107,15 @@ config 'statistics' 'collectd_tcpconns'
option 'LocalPorts' '22 80 443'
config 'statistics' 'collectd_unixsock'
+ option 'enable' '0'
+ option 'SocketFile' '/var/run/collectd/query.sock'
+ option 'SocketGroup' 'nogroup'
+
+config 'statistics' 'collectd_wireless'
option 'enable' '1'
- option 'SocketFile' '/var/run/collectd-query.sock'
+config 'statistics' 'collectd_rrdtool'
+ option 'enable' '1'
+ option 'DataDir' '/tmp'
+ option 'RRARows' '100'
+ option 'RRASingle' '1'
diff --git a/applications/luci-statistics/files/usr/bin/stat-genconfig b/applications/luci-statistics/files/usr/bin/stat-genconfig
index 2b2e19dcad..cd707c6b2a 100755
--- a/applications/luci-statistics/files/usr/bin/stat-genconfig
+++ b/applications/luci-statistics/files/usr/bin/stat-genconfig
@@ -31,64 +31,75 @@ function section( plugin )
if type(config) == "table" and ( plugin == "general" or config.enable == "1" ) then
- if plugin ~= "general" then print( "<Plugin " .. plugin .. ">" ) end
+ local params = ""
if type( plugins[plugin] ) == "function" then
- plugins[plugin]( config )
+ params = plugins[plugin]( config )
else
- config_generic( config, plugins[plugin][1], plugins[plugin][2], plugins[plugin][3], plugin == "general" )
+ params = config_generic( config, plugins[plugin][1], plugins[plugin][2], plugins[plugin][3], plugin == "general" )
end
+
if plugin ~= "general" then
- print( "</Plugin>\n" )
+ print( "LoadPlugin " .. plugin )
+
+ if params:len() > 0 then
+ print( "<Plugin " .. plugin .. ">\n" .. params .. "</Plugin>\n" )
+ else
+ print( "" )
+ end
else
- print( "\n" )
+ print( params .. "\n" )
end
-
end
end
function config_generic( c, singles, bools, lists, nopad )
+ local str = ""
if type(c) == "table" then
if type(singles) == "table" then
for i, key in ipairs( singles ) do
- _string( c[key], key, nopad )
+ str = str .. _string( c[key], key, nopad )
end
end
if type(bools) == "table" then
for i, key in ipairs( bools ) do
- _bool( c[key], key, nopad )
+ str = str .. _bool( c[key], key, nopad )
end
end
if type(lists) == "table" then
- _list_expand( c, lists, nopad )
+ str = str .. _list_expand( c, lists, nopad )
end
-
end
+ return str
end
function config_exec( c )
+ local str = ""
for s in pairs(sections) do
for key, type in pairs({ Exec="collectd_exec_input", NotificationExec="collectd_exec_notify" }) do
if sections[s][".type"] == type then
cmd = sections[s].cmdline
- user = sections[s].cmduser or "root"
- group = sections[s].cmdgroup or "root"
+ user = sections[s].cmduser or "nobody"
+ group = sections[s].cmdgroup or "nogroup"
- print( "\t" .. key .. " " .. user .. ":" .. group .. ' "' .. cmd .. '"' )
+ str = str .. "\t" .. key .. " " .. user .. ":" .. group .. ' "' .. cmd .. "\"\n"
end
end
end
+
+ return str
end
function config_iptables( c )
+ local str = ""
for s in pairs(sections) do
if sections[s][".type"] == "collectd_iptables_match" then
@@ -109,86 +120,110 @@ function config_iptables( c )
for i, rule in ipairs( ipt:find( search ) ) do
- name = sections[s].name
- if i > 1 then name = name .. " (" .. i .. ")" end
-
- print( "\tChain " .. rule.table .. " " .. rule.chain .. " " .. rule.index .. ' "' .. name .. '"' )
+ name = sections[s].name:gsub( "%s+", "_" )
+ if i > 1 then name = name .. "_(" .. i .. ")" end
+ str = str .. "\tChain " .. rule.table .. " " .. rule.chain .. " " .. rule.index .. ' "' .. name .. "\"\n"
end
end
end
+
+ return str
end
function config_network( c )
+ local str = ""
- for s in pairs(sections) do
- for key, type in pairs({ Listen="collectd_network_listen", Server="collectd_network_server" }) do
- if sections[s][".type"] == type then
+ for s in pairs(sections) do
+ for key, type in pairs({ Listen="collectd_network_listen", Server="collectd_network_server" }) do
+ if sections[s][".type"] == type then
- host = sections[s].host
- port = sections[s].port
+ host = sections[s].host
+ port = sections[s].port
if host then
if port then
- print( "\t" .. key .. " " .. host .. " " .. port )
+ str = str .. "\t" .. key .. " " .. host .. " " .. port .. "\n"
else
- print( "\t" .. key .. " " .. host )
+ str = str .. "\t" .. key .. " " .. host .. "\n"
end
end
end
end
end
- _string( c["TimeToLive"], "TimeToLive" )
- _string( c["CacheFlush"], "CacheFlush" )
- _bool( c["Forward"], "Forward" )
+ return str .. _string( c["TimeToLive"], "TimeToLive" )
+ .. _string( c["CacheFlush"], "CacheFlush" )
+ .. _bool( c["Forward"], "Forward" )
end
function _list_expand( c, l, nopad )
+ local str = ""
+
for i, n in ipairs(l) do
if c[n] then
- _expand( c[n], n:gsub( "(%w+)s", "%1" ), nopad )
+ if n:find("(%w+)ses") then
+ k = n:gsub("(%w+)ses", "%1s")
+ else
+ k = n:gsub("(%w+)s", "%1")
+ end
+
+ str = str .. _expand( c[n], k, nopad )
end
end
+
+ return str
end
function _expand( s, n, nopad )
if type(s) == "string" then
+ local str = ""
+
for i, v in ipairs( ffluci.util.split( s, "%s+", nil, true ) ) do
- _string( v, n, nopad )
+ str = str .. _string( v, n, nopad )
end
+
+ return str
end
end
function _bool( s, n, nopad )
+ local str = ""
local pad = ""
if not nopad then pad = "\t" end
if s and s == "1" then
- print( pad .. n .. " true" )
+ str = pad .. n .. " true"
else
- print( pad .. n .. " false" )
+ str = pad .. n .. " false"
end
+
+ return str .. "\n"
end
function _string( s, n, nopad )
+ local str = ""
local pad = ""
if not nopad then pad = "\t" end
if s then
- if not s:find("%d") then
- if not s:find("%s") then
- print( pad .. n .. " " .. s )
+ if s:find("[^%d]") then
+ if not s:find("[^%w]") then
+ str = pad .. n .. " " .. s
else
- print( pad .. n .. ' "' .. s '"' )
+ str = pad .. n .. ' "' .. s .. '"'
end
else
- print( pad .. n .. " " .. s )
+ str = pad .. n .. " " .. s
end
+
+ str = str .. "\n"
end
+
+ return str
end
@@ -224,7 +259,7 @@ plugins = {
},
email = {
- { "SocketFile", "SocketUser", "SocketPerms", "MaxConns" },
+ { "SocketFile", "SocketGroup", "SocketPerms", "MaxConns" },
{ },
{ }
},
@@ -254,7 +289,7 @@ plugins = {
netlink = {
{ },
{ "IgnoreSelected" },
- { "Interfaces", "VerboseInterfaces", "QDiscs", "Classs", "Filters" }
+ { "Interfaces", "VerboseInterfaces", "QDiscs", "Classes", "Filters" }
},
network = config_network,
@@ -262,7 +297,13 @@ plugins = {
processes = {
{ },
{ },
- { "Processs" }
+ { "Processes" }
+ },
+
+ rrdtool = {
+ { "DataDir", "StepSize", "HeartBeat", "RRARows", "XFF", "CacheFlush", "CacheTimeout" },
+ { "RRASingle" },
+ { "RRATimespans" }
},
tcpconns = {
@@ -272,7 +313,13 @@ plugins = {
},
unixsock = {
- { "SocketFile", "SocketUser", "SocketPerms" },
+ { "SocketFile", "SocketGroup", "SocketPerms" },
+ { },
+ { }
+ },
+
+ wireless = {
+ { },
{ },
{ }
},