def prepareMonitoring(self): # attribute setter... print 'Monitor:prepareMonitoring' self.resources = list() # list{MonitorResource} if self.processes == 'StackSync': folder_sync_client = 'stacksync_folder' if self.processes == 'OwnCloud': folder_sync_client = 'owncloud_folder' print "loggerId: ".format(self.logger_id) self.resources.append(MemoryMonitor(self.processes, self.logger_id, self.hostname)) self.resources.append(DiskMonitor(folder_sync_client, self.logger_id, self.hostname)) self.resources.append(CPUMonitor(self.processes, self.logger_id, self.hostname)) self.resources.append(NetworkMonitor('eth0', self.logger_id, self.hostname)) self.pcapCapturer = pcap_capture() x=0 for resource in self.resources: # MonitorResource x+=1 print x resource.prepareMonitoring()
def __init__(self): self.finish = False # Boolean self.interval = None# int, sleep interval self.filename = None# string self.processes = None# list{string} self.resources = None# list{MonitorResource} self.pcapCapturer = pcap_capture('eth0') self.pcapCapturer.daemon = True self.logger_id = None