Bug fix with display & format function

community
Steve L. Nyemba 8 years ago
parent 7cf4dfeee5
commit 46d26ee095

@ -30,6 +30,9 @@ class Analysis:
return {"month":d.month,"year":d.year, "day":d.day,"hour":d.hour,"minute":d.minute} return {"month":d.month,"year":d.year, "day":d.day,"hour":d.hour,"minute":d.minute}
def getName(self): def getName(self):
return self.__class__.__name__ return self.__class__.__name__
def format(self,text):
return re.sub('([0-9]+[a-zA-Z]*)|[^a-zA-Z\s:]',' ',text).strip()
""" """
This class is designed to analyze environment variables. Environment variables can either be folders, files or simple values This class is designed to analyze environment variables. Environment variables can either be folders, files or simple values
@ -214,7 +217,7 @@ class DetailProcess(Analysis):
else: else:
return "crash" return "crash"
def format(self,row): def format(self,row):
r= {"memory_usage":row[0],"cpu_usage":row[1],"memory_available":row[2]/1000,"proc_count":row[3],"label":row[4]} r= {"memory_usage":row[0],"cpu_usage":row[1],"memory_available":row[2]/1000,"proc_count":row[3],"label":self.format(row[4])}
status = self.status(r) status = self.status(r)
r['status'] = status r['status'] = status
return r return r

@ -27,8 +27,6 @@ class ICollector(Thread) :
self.factory = DataSourceFactory() self.factory = DataSourceFactory()
self.init() self.init()
self.name = 'data-collector@'+self.id self.name = 'data-collector@'+self.id
def format(self,text):
return re.sub('([0-9]+[a-zA-Z]*)|[^a-zA-Z\s:]',' ',text).strip()
def init(self): def init(self):
@ -90,7 +88,7 @@ class ICollector(Thread) :
self.lock.acquire() self.lock.acquire()
store = self.factory.instance(type=write_class,args=read_args) store = self.factory.instance(type=write_class,args=read_args)
store.flush(size=200) store.flush(size=200)
label = self.format(label)
store.write(label=label,row=row) store.write(label=label,row=row)
self.lock.release() self.lock.release()
if 'MONITOR_CONFIG_PATH' in os.environ : if 'MONITOR_CONFIG_PATH' in os.environ :

Loading…
Cancel
Save