示例#1
0
class RRDManager:
    def __init__(self, rootdir):
        self.rootdir = rootdir
        self.wrapper = RRDWrapper()

    def fetch(self, cluster, node, metric, start, end, step):
        filename = "%s/%s/%s/%s.rrd" % (self.rootdir, cluster, node, metric)
        data = self.wrapper.fetch(filename, start, end, step)
        (rstart, rend, rstep) = data[0]
        tsdata = []
        for i in range(len(data[2])):
            if data[2][i][0] is None:
                tsdata.append("%s %d 0 host=%s\n" % (metric, rstart, node))
            else:
                tsdata.append("%s %d %lf host=%s\n" %
                              (metric, rstart, data[2][i][0], node))
            rstart += rstep
        return tsdata
示例#2
0
class RRDManager:
    def __init__(self, rootdir):
        self.rootdir = rootdir
        self.wrapper = RRDWrapper()

    def fetch(self, cluster, node, metric, start, end, step):
        filename="%s/%s/%s/%s.rrd"%(self.rootdir, cluster, node, metric)
        data = self.wrapper.fetch(filename, start, end, step)
        (rstart, rend, rstep) = data[0]
        tsdata = []
        for i in range(len(data[2])):
            if data[2][i][0] is None:
                tsdata.append("%s %d 0 host=%s\n"%(metric, rstart, node))
            else:
                tsdata.append("%s %d %lf host=%s\n"%(metric, rstart,
                                                data[2][i][0], node))
            rstart += rstep
        return tsdata
示例#3
0
 def __init__(self, rootdir):
     self.rootdir = rootdir
     self.wrapper = RRDWrapper()
示例#4
0
 def __init__(self, rootdir):
     self.rootdir = rootdir
     self.wrapper = RRDWrapper()