X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-statistics%2Fluasrc%2Fstatistics%2Fdatatree.lua;h=5176a19a22b7ae1bc1cf3404d7179eac5dfaa986;hp=b1ae010f02b1e16443ad3f375b1e35355543c1a7;hb=d04f667383ec2894a5ecefde7ad9284d07563a67;hpb=7a3493b1f7d75a3945279115324cf2ff4da26b7b diff --git a/applications/luci-app-statistics/luasrc/statistics/datatree.lua b/applications/luci-app-statistics/luasrc/statistics/datatree.lua index b1ae010f0..5176a19a2 100644 --- a/applications/luci-app-statistics/luasrc/statistics/datatree.lua +++ b/applications/luci-app-statistics/luasrc/statistics/datatree.lua @@ -1,4 +1,4 @@ --- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich +-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. module("luci.statistics.datatree", package.seeall) @@ -13,9 +13,17 @@ local sections = uci:get_all("luci_statistics") Instance = util.class() function Instance.__init__( self, host ) - self._host = host or sections.collectd.Hostname or sys.hostname() - self._libdir = sections.collectd.PluginDir or "/usr/lib/collectd" - self._rrddir = sections.collectd_rrdtool.DataDir or "/tmp/rrd" + self._host = host or sys.hostname() + self._libdir = "/usr/lib/collectd" + self._rrddir = "/tmp/rrd" + + if sections and sections.collectd then + self._host = host or sections.collectd.Hostname or sys.hostname() + self._libdir = sections.collectd.PluginDir or "/usr/lib/collectd" + end + if sections and sections.collectd_rrdtool then + self._rrddir = sections.collectd_rrdtool.DataDir or "/tmp/rrd" + end self._libdir = self._libdir:gsub("/$","") self._rrddir = self._rrddir:gsub("/$","")