diff options
author | Patrick Grimm <patrick@lunatiki.de> | 2012-02-19 15:11:23 +0000 |
---|---|---|
committer | Patrick Grimm <patrick@lunatiki.de> | 2012-02-19 15:11:23 +0000 |
commit | ad7aecad88399b917b6a96952f3645c475e73c59 (patch) | |
tree | d582023a76a305ef0150eaa670c92d9ca6fb012b /applications/luci-statistics/luasrc/statistics | |
parent | 2ff0ec12ac2acc140680f457f0699b88676d8cfb (diff) |
applications/luci-statistics: make host selectable if collectd-mod-network server is on
Diffstat (limited to 'applications/luci-statistics/luasrc/statistics')
9 files changed, 25 insertions, 14 deletions
diff --git a/applications/luci-statistics/luasrc/statistics/datatree.lua b/applications/luci-statistics/luasrc/statistics/datatree.lua index b494dc1084..d6de6fa217 100644 --- a/applications/luci-statistics/luasrc/statistics/datatree.lua +++ b/applications/luci-statistics/luasrc/statistics/datatree.lua @@ -192,3 +192,16 @@ function Instance.data_instances( self, plugin, instance, dtype ) return rv end + +function Instance.host_instances( self ) + local hosts_path = fs.glob(self._rrddir..'/*') + local hosts = { } + k = 1 + for v in hosts_path do + hosts[k] = fs.basename(v) + k=k+1 + end + + return hosts +end + diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-statistics/luasrc/statistics/rrdtool.lua index b540dd15f0..844c157d15 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool.lua @@ -34,11 +34,6 @@ function Graph.__init__( self, timespan, opts ) local uci = luci.model.uci.cursor() local sections = uci:get_all( "luci_statistics" ) - -- helper classes - self.colors = luci.statistics.rrdtool.colors.Instance() - self.tree = luci.statistics.datatree.Instance() - self.i18n = luci.statistics.i18n.Instance( self ) - -- options opts.timespan = timespan or sections.rrdtool.default_timespan or 900 opts.rrasingle = opts.rrasingle or ( sections.collectd_rrdtool.RRASingle == "1" ) @@ -49,6 +44,11 @@ function Graph.__init__( self, timespan, opts ) opts.rrdpath = opts.rrdpath:gsub("/$","") opts.imgpath = opts.imgpath:gsub("/$","") + -- helper classes + self.colors = luci.statistics.rrdtool.colors.Instance() + self.tree = luci.statistics.datatree.Instance(opts.host) + self.i18n = luci.statistics.i18n.Instance( self ) + -- rrdtool default args self.args = { "-a", "PNG", diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua index 12a1101b74..449a4e2147 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua @@ -15,7 +15,7 @@ $Id$ module("luci.statistics.rrdtool.definitions.conntrack",package.seeall) -function rrdargs( graph, host, plugin, plugin_instance, dtype ) +function rrdargs( graph, plugin, plugin_instance, dtype ) return { title = "%H: Conntrack entries", vlabel = "Count", diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua index 41bae391fe..adc3f284b2 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua @@ -15,7 +15,7 @@ $Id: cpu.lua 2274 2008-06-03 23:15:16Z jow $ module("luci.statistics.rrdtool.definitions.cpu",package.seeall) -function rrdargs( graph, host, plugin, plugin_instance, dtype ) +function rrdargs( graph, plugin, plugin_instance, dtype ) return { title = "%H: Processor usage on core #%pi", diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/dns.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/dns.lua index 4f328c3c02..94a148d810 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/dns.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/dns.lua @@ -13,7 +13,7 @@ You may obtain a copy of the License at module("luci.statistics.rrdtool.definitions.dns", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance ) +function rrdargs( graph, plugin, plugin_instance ) local traffic = { title = "%H: DNS traffic", vlabel = "Bit/s", diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/interface.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/interface.lua index 35bc25b56e..9b698d263a 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/interface.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/interface.lua @@ -15,7 +15,7 @@ $Id$ module("luci.statistics.rrdtool.definitions.interface", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance ) +function rrdargs( graph, plugin, plugin_instance ) -- -- traffic diagram diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua index 54c869f7f0..0c6eed9936 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua @@ -15,7 +15,7 @@ $Id$ module("luci.statistics.rrdtool.definitions.iwinfo", package.seeall) -function rrdargs( graph, host, plugin, plugin_instance ) +function rrdargs( graph, plugin, plugin_instance ) -- -- signal/noise diagram diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/memory.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/memory.lua index 093f9923b2..a1c65f56d7 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/memory.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/memory.lua @@ -11,7 +11,7 @@ You may obtain a copy of the License at module("luci.statistics.rrdtool.definitions.memory",package.seeall) -function rrdargs( graph, host, plugin, plugin_instance, dtype ) +function rrdargs( graph, plugin, plugin_instance, dtype ) return { title = "%H: Memory usage", diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua index 3ee39102e6..3ca2f03ec8 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions/olsrd.lua @@ -13,8 +13,6 @@ You may obtain a copy of the License at module("luci.statistics.rrdtool.definitions.olsrd", package.seeall) -local tree = luci.statistics.datatree.Instance() - function rrdargs( graph, plugin, plugin_instance, dtype ) local g = { } @@ -77,7 +75,7 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) } } - local instances = tree:data_instances(plugin, plugin_instance, "signal_quality") + local instances = graph.tree:data_instances(plugin, plugin_instance, "signal_quality") table.sort(instances) -- define one diagram per host, containing the rx and lq values |