in moneo.py [0:0]
def deploy_manager(self, work_host_file, user=None, manager_host='localhost', export_AzInsight=False):
ssh_host = manager_host
if user:
ssh_host = "{}@{}".format(user, manager_host)
copy_path = "src/master/"
destination_dir = '/tmp/moneo-master'
print('-Copying files to manager-')
logging.info('Copying files to manager')
ssh_asking = '-o StrictHostKeyChecking=no'
cmd = "ssh {} {} 'rm -rf {}'".format(ssh_asking, ssh_host, destination_dir)
self.check_command_result(shell_cmd(cmd, 30))
cmd = "scp -r {} {}:{}".format(copy_path, ssh_host, '/tmp/')
self.check_command_result(shell_cmd(cmd, 30))
cmd = "ssh {} {} 'mv {} {}'".format(ssh_asking, ssh_host, '/tmp/master', destination_dir)
self.check_command_result(shell_cmd(cmd, 30))
print('--------------------------')
print('-Deploying Grafana and Prometheus docker containers to manager-')
logging.info('Deploying Grafana and Prometheus docker containers to manager')
cmd = "ssh {} {} 'sudo /tmp/moneo-master/managerLaunch.sh {} {}' \
".format(ssh_asking, ssh_host, work_host_file, manager_host)
self.check_command_result(shell_cmd(cmd, 60))
print('--------------------------')
if export_AzInsight:
print('-Starting Azure insights collector-')
logging.info('Starting Azure insights collector')
copy_path = "src/azinsights"
cmd = "scp {} -r {} {}:{}".format(ssh_asking, copy_path, ssh_host, destination_dir)
self.check_command_result(shell_cmd(cmd, 30))
copy_path = "./config.ini"
cmd = "scp {} -r {} {}:{}//azinsights".format(ssh_asking, copy_path, ssh_host, destination_dir)
self.check_command_result(shell_cmd(cmd, 30))
print('--------------------------')
print('-Deploying Complete-')