applications/luci-statistics: make host selectable if collectd-mod-network server...
[project/luci.git] / applications / luci-statistics / luasrc / statistics / rrdtool.lua
index b540dd15f0de2b32678a9681e848a97de89223ad..844c157d15615823e6f42552523a1b3fe13df198 100644 (file)
@@ -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",