def initialize(self): self.rabbitcom = Comm('10.10.0.134', 'logs', 'logs', '/', 'jobs', '', 'jobmon') # Server main loop while True: self.getJobs() time.sleep(4)
def run(self): self.rabbitcom = Comm('10.10.0.134','logs','logs','/','logs','logs','collector') self.connect = self.rabbitcom.ampq_connect() #credentials = pika.PlainCredentials("logs", "logs") #connection = pika.BlockingConnection(pika.ConnectionParameters(host=self._host,credentials=credentials)) #channel = connection.channel() #channel.queue_bind(exchange='logs',queue='logs') self.rabbitcom.channel.basic_consume(self.callback, "logs", no_ack=True) self.rabbitcom.channel.start_consuming()
def initialize(self): self.rabbitcom = Comm('10.10.0.134', 'logs', 'logs', '/', 'logs', '', 'sysmon') self.connect = self.rabbitcom.ampq_connect() # Pre-Compile our regex for the minimal performance gain self.dev_re = re.compile( '([A-Za-z0-9\.]+):\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)' ) self.meminfo_re = re.compile('([\w]+):\s(\d+)\s') self.proc_stats_re = re.compile('([A-Za-z0-9]+)\s+(\d+)') self.diskstatus_re = re.compile( '\s+(\d+)\s+(\d+)\s(\w+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)' ) # Server main loop while True: self.getProcesses() time.sleep(1)