Ejemplo n.º 1
0
 def getArchiveData(self, fileName):
     try:
         fp = open(fileName)
     except IOError as e:
         print "Error while opening the file %s...%s" % (fileName, e)
         return
     lines = fp.readlines()
     for line in lines:
         rec = line.rstrip("\n").split(",")
         #print rec
         serviceHost = rec[0]
         serviceName = rec[1]
         # desc = rec[1]
         data = [int(rec[2]), int(rec[3])]  #rec[2:] # [ok,critical]
         #print data
         gData = graphData(serviceName, serviceHost, data=data)
         if self.gDataDict.has_key(rec[0] + '##' + rec[1]):
             gDataList = self.gDataDict[rec[0] + '##' + rec[1]]
             gDataList.append(gData)
         else:
             gDataList = []
             gDataList.append(gData)
             self.gDataDict[rec[0] + '##' + rec[1]] = gDataList
Ejemplo n.º 2
0
 def getArchiveData(self,fileName):
     try:
         fp = open(fileName)
     except IOError as e:
         print "Error while opening the file %s...%s" % (fileName,e)
         return
     lines = fp.readlines()
     for line in lines:
         rec = line.rstrip("\n").split(",")
         #print rec
         serviceHost = rec[0]
         serviceName = rec[1]
         # desc = rec[1]
         data = [int(rec[2]),int(rec[3])] #rec[2:] # [ok,critical]
         #print data
         gData = graphData(serviceName,serviceHost,data=data)
         if self.gDataDict.has_key(rec[0]+'##'+rec[1]):
             gDataList = self.gDataDict[rec[0]+'##'+rec[1]]
             gDataList.append(gData)
         else:
             gDataList = []
             gDataList.append(gData)
             self.gDataDict[rec[0]+'##'+rec[1]] = gDataList
Ejemplo n.º 3
0
    def getTimeLineData(self,fileName):
        try:
            fp = open(fileName)
        except IOError as e:
            print "Error while opening the file %s...%s" % (fileName,e)
            return
        lines = fp.readlines()

        #gDataDict = {}
        for line in lines:
            if line.startswith("starttime"):
                self.stime = line.rstrip("\n").split("##")[1]
                continue
            elif line.startswith("endtime"):
                self.etime = line.rstrip("\n").split("##")[1]
                continue
            rec = line.rstrip("\n").split(",")
            #print len(rec)
                              
            host = rec[0]
            service = rec[1]
            ts = rec[2]
            status = rec[3]
            if len(rec) >= 5:
                desc = rec[4]
            else:
                desc = " "
            gData = graphData(host,service,desc,status,ts)
            if self.gDataDict.has_key(rec[0]+"##"+rec[1]):
                gDataList = self.gDataDict[rec[0]+"##"+rec[1]]
                gDataList.append(gData)
            else:
                gDataList = []
                gDataList.append(gData)
                self.gDataDict[rec[0]+"##"+rec[1]] = gDataList
        #print "Start Time : %s --- End Time : %s " % (self.stime,self.etime)
        data_retriever.printgDataDict(self.gDataDict)
Ejemplo n.º 4
0
    def getTimeLineData(self, fileName):
        try:
            fp = open(fileName)
        except IOError as e:
            print "Error while opening the file %s...%s" % (fileName, e)
            return
        lines = fp.readlines()

        #gDataDict = {}
        for line in lines:
            if line.startswith("starttime"):
                self.stime = line.rstrip("\n").split("##")[1]
                continue
            elif line.startswith("endtime"):
                self.etime = line.rstrip("\n").split("##")[1]
                continue
            rec = line.rstrip("\n").split(",")
            #print len(rec)

            host = rec[0]
            service = rec[1]
            ts = rec[2]
            status = rec[3]
            if len(rec) >= 5:
                desc = rec[4]
            else:
                desc = " "
            gData = graphData(host, service, desc, status, ts)
            if self.gDataDict.has_key(rec[0] + "##" + rec[1]):
                gDataList = self.gDataDict[rec[0] + "##" + rec[1]]
                gDataList.append(gData)
            else:
                gDataList = []
                gDataList.append(gData)
                self.gDataDict[rec[0] + "##" + rec[1]] = gDataList
        #print "Start Time : %s --- End Time : %s " % (self.stime,self.etime)
        data_retriever.printgDataDict(self.gDataDict)