diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-06-03 19:22:55 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-06-03 19:22:55 +0000 |
commit | 8084c460a1ffe70c39fcd1bb4aeb808c81e43231 (patch) | |
tree | f539aa4db5498951fdfb5b8e465f5bde15cbb70a /applications/luci-statistics/root/usr/bin/stat-genconfig | |
parent | be71969b763d8405e1f77152c5523d3e94f2a153 (diff) |
* luci/statistics: update config generator
Diffstat (limited to 'applications/luci-statistics/root/usr/bin/stat-genconfig')
-rwxr-xr-x | applications/luci-statistics/root/usr/bin/stat-genconfig | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/applications/luci-statistics/root/usr/bin/stat-genconfig b/applications/luci-statistics/root/usr/bin/stat-genconfig index 052093b47a..6241e98145 100755 --- a/applications/luci-statistics/root/usr/bin/stat-genconfig +++ b/applications/luci-statistics/root/usr/bin/stat-genconfig @@ -61,12 +61,20 @@ function config_generic( c, singles, bools, lists, nopad ) if type(singles) == "table" then for i, key in ipairs( singles ) do + if preprocess[key] then + c[key] = preprocess[key](c[key]) + end + str = str .. _string( c[key], key, nopad ) end end if type(bools) == "table" then for i, key in ipairs( bools ) do + if preprocess[key] then + c[key] = preprocess[key](c[key]) + end + str = str .. _bool( c[key], key, nopad ) end end @@ -163,6 +171,10 @@ function _list_expand( c, l, nopad ) for i, n in ipairs(l) do if c[n] then + if preprocess[n] then + c[n] = preprocess[n](c[n]) + end + if n:find("(%w+)ses") then k = n:gsub("(%w+)ses", "%1s") else @@ -229,7 +241,7 @@ end plugins = { collectd = { - { "BaseDir", "Include", "PIDFile", "PluginDir", "TypesDB", "Interval", "ReadThreads" }, + { "BaseDir", "Include", "PIDFile", "PluginDir", "TypesDB", "Interval", "ReadThreads", "Hostname" }, { }, { } }, @@ -335,7 +347,16 @@ plugins = { { }, { } }, +} +preprocess = { + RRATimespans = function(val) + local rv = { } + for time in val:gmatch("[^%s]+") do + table.insert( rv, luci.util.parse_units(time) ) + end + return table.concat(rv, " ") + end } |