* luci/statistics: fix path to types.db in default config, adept stat-genconfig to new project name and updated config

This commit is contained in:
Jo-Philipp Wich 2008-05-25 22:30:30 +00:00
parent e207fce586
commit 1da3c32a73
2 changed files with 15 additions and 15 deletions

View file

@ -3,7 +3,7 @@ config 'statistics' 'collectd'
option 'Include' '/etc/collectd/conf.d' option 'Include' '/etc/collectd/conf.d'
option 'PIDFile' '/var/run/collectd.pid' option 'PIDFile' '/var/run/collectd.pid'
option 'PluginDir' '/usr/lib/collectd' option 'PluginDir' '/usr/lib/collectd'
option 'TypesDB' '/etc/collectd/types.db' option 'TypesDB' '/usr/lib/collectd/types.db'
option 'Interval' '30' option 'Interval' '30'
option 'ReadThreads' '2' option 'ReadThreads' '2'

View file

@ -16,31 +16,31 @@ $Id$
]]-- ]]--
require("ffluci.model.uci") require("luci.model.uci")
require("ffluci.sys.iptparser") require("luci.sys.iptparser")
require("ffluci.util") require("luci.util")
local ipt = ffluci.sys.iptparser.IptParser() local ipt = luci.sys.iptparser.IptParser()
local uci = ffluci.model.uci.Session() local uci = luci.model.uci.Session()
local sections, names = uci:sections( "luci_statistics" ) local sections, names = uci:sections( "luci_statistics" )
function section( plugin ) function section( plugin )
local config = sections[ "collectd_" .. plugin ] or sections["general"] local config = sections[ "collectd_" .. plugin ] or sections["collectd"]
if type(config) == "table" and ( plugin == "general" or config.enable == "1" ) then if type(config) == "table" and ( plugin == "collectd" or config.enable == "1" ) then
local params = "" local params = ""
if type( plugins[plugin] ) == "function" then if type( plugins[plugin] ) == "function" then
params = plugins[plugin]( config ) params = plugins[plugin]( config )
else else
params = 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 == "collectd" )
end end
if plugin ~= "general" then if plugin ~= "collectd" then
print( "LoadPlugin " .. plugin ) print( "LoadPlugin " .. plugin )
if params:len() > 0 then if params:len() > 0 then
@ -113,7 +113,7 @@ function config_iptables( c )
v = sections[s][k] v = sections[s][k]
if type(v) == "string" then if type(v) == "string" then
if k == "options" then v = ffluci.util.split( v, "%s+", nil, true ) end if k == "options" then v = luci.util.split( v, "%s+", nil, true ) end
search[k] = v search[k] = v
end end
end end
@ -180,7 +180,7 @@ function _expand( s, n, nopad )
if type(s) == "string" then if type(s) == "string" then
local str = "" local str = ""
for i, v in ipairs( ffluci.util.split( s, "%s+", nil, true ) ) do for i, v in ipairs( luci.util.split( s, "%s+", nil, true ) ) do
str = str .. _string( v, n, nopad ) str = str .. _string( v, n, nopad )
end end
@ -228,7 +228,7 @@ end
plugins = { plugins = {
general = { collectd = {
{ "BaseDir", "Include", "PIDFile", "PluginDir", "TypesDB", "Interval", "ReadThreads" }, { "BaseDir", "Include", "PIDFile", "PluginDir", "TypesDB", "Interval", "ReadThreads" },
{ }, { },
{ } { }
@ -333,10 +333,10 @@ plugins = {
} }
section("general") section("collectd")
for plugin in pairs(plugins) do for plugin in pairs(plugins) do
if plugin ~= "general" then if plugin ~= "collectd" then
section( plugin ) section( plugin )
end end
end end