diff options
author | Yang Yu <Gabriel.yuyang@huawei.com> | 2018-05-02 16:52:11 +0800 |
---|---|---|
committer | Yu Yang (Gabriel) <Gabriel.yuyang@huawei.com> | 2018-05-03 08:19:30 +0000 |
commit | 3f3676124f276985a0eb8986f53683a39f353dc2 (patch) | |
tree | 226b177ff6e8a227368c2d765174ba9d4f875829 /monitor/automate_cadvisor_client.py | |
parent | 14add4c9ee3c3114a92ee6c8cf6a6f677ec386a8 (diff) |
Restructure monitoring scripts
Restructure the monitoring scripts and modify the scripts to remove the
redundance
Change-Id: Ib4a5d7bea2dc455ec03ad61780b6caf06831daa8
Signed-off-by: Yang Yu <Gabriel.yuyang@huawei.com>
(cherry picked from commit cb67313c1e14b6eca057bdfc7722bc11506b7a2a)
Diffstat (limited to 'monitor/automate_cadvisor_client.py')
-rw-r--r-- | monitor/automate_cadvisor_client.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/monitor/automate_cadvisor_client.py b/monitor/automate_cadvisor_client.py deleted file mode 100644 index f84892dd..00000000 --- a/monitor/automate_cadvisor_client.py +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################## -# Copyright (c) 2017 Huawei Tech and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import logging -import yaml -import utils.infra_setup.passwordless_SSH.ssh as ssh - -logger = logging.getLogger(__name__) -cadvisor_install_sh = "/home/opnfv/bottlenecks/monitor/cadvisor_install.sh" - -with open('/tmp/pod.yaml') as f: - dataMap = yaml.safe_load(f) - for x in dataMap: - for y in dataMap[x]: - if (y['role'] == 'Controller') or (y['role'] == 'Compute'): - ip = str(y['ip']) - user = str(y['user']) - pwd = str(y['password']) - ssh_d = ssh.SSH(user, host=ip, password=pwd) - status, stdout, stderr = ssh_d.execute( - "cd /etc && mkdir cadvisor_config" - ) - if status: - raise Exception("Command failed with non-zero status.") - logger.info(stdout.splitlines()) - with open(cadvisor_install_sh) as stdin_file: - ssh_d.run("cat > /etc/cadvisor_config/install.sh", - stdin=stdin_file) - status, stdout, stderr = ssh_d.execute( - "sudo apt-get install docker.io" - ) - if status: - raise Exception("Command for installing docker failed.") - logger.info(stdout.splitlines()) - ssh_d.run("cd /etc/cadvisor_config/ && bash ./install.sh") |