add support for splash leases plugin
[project/luci.git] / applications / luci-statistics / root / usr / bin / stat-genconfig
index e179cdb..86773b4 100755 (executable)
@@ -25,6 +25,11 @@ local uci = luci.model.uci.cursor()
 local sections = uci:get_all( "luci_statistics" )
 
 
+function print(...)
+       nixio.stdout:write(...)
+       nixio.stdout:write("\n")
+end
+
 function section( plugin )
 
        local config = sections[ "collectd_" .. plugin ] or sections["collectd"]
@@ -157,9 +162,9 @@ function config_network( c )
 
                                if host then
                                        if port then
-                                               str = str .. "\t" .. key .. " " .. host .. " " .. port .. "\n"
+                                               str = str .. "\t" .. key .. " \"" .. host .. "\" \"" .. port .. "\"\n"
                                        else
-                                               str = str .. "\t" .. key .. " " .. host .. "\n"
+                                               str = str .. "\t" .. key .. " \"" .. host .. "\"\n"
                                        end
                                end
                                                end
@@ -195,15 +200,19 @@ function _list_expand( c, l, nopad )
 end
 
 function _expand( s, n, nopad )
-       if type(s) == "string" then
-               local str = ""
+       local str = ""
 
+       if type(s) == "string" then
                for i, v in ipairs( luci.util.split( s, "%s+", nil, true ) ) do
                        str = str .. _string( v, n, nopad )
                end
-
-               return str
+       elseif type(s) == "table" then
+               for i, v in ipairs(s) do
+                       str = str .. _string( v, n, nopad )
+               end
        end
+
+       return str
 end
 
 function _bool( s, n, nopad )
@@ -228,8 +237,8 @@ function _string( s, n, nopad )
        if not nopad then pad = "\t" end
 
        if s then
-               if s:find("[^%d]") then
-                       if not s:find("[^%w]") then
+               if s:find("[^%d]") or n == "Port" then
+                       if not s:find("[^%w]") and n ~= "Port" then
                                str = pad .. n .. " " .. luci.util.trim(s)
                        else
                                str = pad .. n .. ' "' .. luci.util.trim(s) .. '"'
@@ -252,6 +261,12 @@ plugins = {
                { }
        },
 
+       conntrack = {
+               { },
+               { },
+               { }
+       },
+
        cpu     = {
                { },
                { },
@@ -304,6 +319,12 @@ plugins = {
                { "Irqs" }
        },
 
+       iwinfo = {
+               { },
+               { "IgnoreSelected" },
+               { "Interfaces" }
+       },
+
        load    = {
                { },
                { },
@@ -316,6 +337,18 @@ plugins = {
                { }
        },
 
+       madwifi = {
+               { "WatchSet" },
+               { },
+               { "Interfaces", "WatchAdds" }
+       },
+
+       memory = { 
+               { },
+               { },
+               { }
+       },
+
        netlink = {
                { },
                { "IgnoreSelected" },
@@ -324,8 +357,20 @@ plugins = {
 
        network = config_network,
 
+       nut = {
+               { "UPS" },
+               { },
+               { }
+       },
+
+       olsrd = {
+               { "Host", "Port", "CollectLinks","CollectRoutes","CollectTopology"},
+               { },
+               { }
+       },
+
        ping    = {
-               { "TTL" },
+               { "TTL", "Interval" },
                { },
                { "Hosts" }
        },
@@ -342,6 +387,12 @@ plugins = {
                { "RRATimespans" }
        },
 
+        splash_leases = {
+          { },
+          { },
+          { }
+        },
+
        tcpconns = {
                { },
                { "ListeningPorts" },
@@ -354,6 +405,12 @@ plugins = {
                { }
        },
 
+       uptime = {
+               { },
+               { },
+               { }
+       },
+
        wireless = {
                { },
                { },