1 ##############################################################################
2 # Copyright (c) 2017 Huawei Tech and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
12 import utils.infra_setup.passwordless_SSH.ssh as ssh
14 logger = logging.getLogger(__name__)
15 collectd_client_install_sh =\
16 "/home/opnfv/bottlenecks/monitor/install_collectd_client.sh"
17 collectd_client_install_conf =\
18 "/home/opnfv/bottlenecks/monitor/config/collectd_client.conf"
20 with open('/tmp/pod.yaml') as f:
21 dataMap = yaml.safe_load(f)
24 if (y['role'] == 'Controller') or (y['role'] == 'Compute'):
27 pwd = str(y['password'])
28 ssh_d = ssh.SSH(user, host=ip, password=pwd)
29 status, stdout, stderr = ssh_d.execute(
30 "cd /etc && mkdir collectd_config"
33 raise Exception("Command failed with non-zero status.")
34 logger.info(stdout.splitlines())
35 with open(collectd_client_install_sh) as stdin_file:
36 ssh_d.run("cat > /etc/collectd_config/install.sh",
38 with open(collectd_client_install_conf) as stdin_file:
39 ssh_d.run("cat > /etc/collectd_config/collectd.conf",
41 status, stdout, stderr = ssh_d.execute(
42 "sudo apt-get install docker.io"
45 raise Exception("Command for installing docker failed.")
46 logger.info(stdout.splitlines())
47 ssh_d.run("cd /etc/collectd_config/ && bash ./install.sh")