def copy_vmware_logs(self): # Refactor to one method # move that to the config files = ['/var/log/vmkernel.log'] timestamp = time.time() for host in self.esxi_hosts: log.info("Collecting logs from {}".format(host)) ssh = SshUtil(host, self.user, self.password) for fn in files: log.info("Collecting {}".format(fn)) ssh.copy_file_from_host(fn, 'logs/{}'.format(fn + timestamp))
def copy_gateway_logs(self): # Refactor to one method # move that to the config files = ['/var/log/messages'] timestamp = time.time() for host in self.gateways: log.info("Collecting logs from {}".format(host)) ssh = SshUtil(host, self.gateway_user, self.gateway_password) for fn in files: log.info("Collecting {}".format(fn)) ssh.copy_file_from_host(fn, 'logs/{}'.format(fn + timestamp))
def copy_gateway_logs(self): # Refactor to one method # move that to the config files = ['/var/log/messages'] timestamp = time.time() for host, creds in self.gateways.items(): log.info("Collecting logs from {}".format(host)) ssh = SshUtil(host, creds[0], creds[1]) for fn in files: log.info("Collecting {}".format(fn)) save_name = fn.replace('/', '_') ssh.copy_file_from_host(fn, 'logs/{}'.format(save_name+"_"+host+"_"+str(timestamp)))