applications/luci-statistics: add support for conntrack plugin
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 28 Nov 2011 04:50:54 +0000 (04:50 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 28 Nov 2011 04:50:54 +0000 (04:50 +0000)
applications/luci-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua [new file with mode: 0644]
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua [new file with mode: 0644]
applications/luci-statistics/root/etc/config/luci_statistics
applications/luci-statistics/root/usr/bin/stat-genconfig

diff --git a/applications/luci-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua b/applications/luci-statistics/luasrc/model/cbi/luci_statistics/conntrack.lua
new file mode 100644 (file)
index 0000000..81e9c05
--- /dev/null
@@ -0,0 +1,21 @@
+--[[
+
+Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+]]--
+
+m = Map("luci_statistics",
+       translate("Conntrack Plugin Configuration"),
+       translate("The conntrack plugin collects statistics about the number of tracked connections."))
+
+s = m:section( NamedSection, "collectd_conntrack", "luci_statistics" )
+
+enable = s:option( Flag, "enable", translate("Enable this plugin") )
+enable.default = 0
+
+return m
diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua
new file mode 100644 (file)
index 0000000..12a1101
--- /dev/null
@@ -0,0 +1,35 @@
+--[[
+
+Luci statistics - conntrack plugin diagram definition
+(c) 2011 Jo-Philipp Wich <xm@subsignal.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+]]--
+
+module("luci.statistics.rrdtool.definitions.conntrack",package.seeall)
+
+function rrdargs( graph, host, plugin, plugin_instance, dtype )
+       return {
+               title = "%H: Conntrack entries",
+               vlabel = "Count",
+               number_format = "%5.0lf",
+               data = {
+                       sources = {
+                               conntrack = { "entropy" }
+                       },
+                       options = {
+                               conntrack = { 
+                                       color = "0000ff",
+                                       title = "Tracked connections"
+                               }
+                       }
+               }
+       }
+end
index de94b3a6a2e17fd8974d336584fa9be95b8c5aa1..ea3f722a660bf7303755168972130ee2211f01fc 100644 (file)
@@ -131,3 +131,9 @@ config 'statistics' 'collectd_rrdtool'
        option 'RRARows' '100'
        option 'RRASingle' '1'
        option 'RRATimespans' '1hour 1day 1week 1month 1year'
+
+config 'statistics' 'collectd_memory'
+       option 'enable' '1'
+
+config 'statistics' 'collectd_conntrack'
+       option 'enable' '1'
index 97c3628abac905504da0465e46eb3c355e309112..8d43b8a0b1d0f7de87ea6d62039017057047b3d1 100755 (executable)
@@ -192,7 +192,6 @@ function _list_expand( c, l, nopad )
                                k = n:gsub("(%w+)s", "%1")
                        end
 
-                       
                        str = str .. _expand( c[n], k, nopad )
                end
        end
@@ -334,7 +333,11 @@ plugins = {
                { "Interfaces", "WatchAdds" }
        },
 
-       memory = { },
+       memory = { 
+               { },
+               { },
+               { }
+       },
 
        netlink = {
                { },