diff options
author | Rutuja Surve <rutuja.r.surve@gmail.com> | 2018-02-21 13:17:53 +0000 |
---|---|---|
committer | Rutuja Surve <rutuja.r.surve@gmail.com> | 2018-03-30 20:01:42 +0100 |
commit | 4b89af12f547bd8eebc01572e1b9a02f89c5fa7c (patch) | |
tree | e57d298aa778b79fed5a03ee88334526aa4f7fc0 /monitor/barometer_automated_client_install.py | |
parent | 5053b1c137d1d22678a416abbaf4dd4cce3e5285 (diff) |
Barometer automated installation script for jump server
and compute/controller nodes
JIRA: BOTTLENECK-182
Install barometer for collecting OVS and collectd statistics as
docker containers on all nodes
Change-Id: I8ae7e2bcbe95ab6e1224e08828c822d50367f616
Signed-off-by: Rutuja Surve <rutuja.r.surve@gmail.com>
Diffstat (limited to 'monitor/barometer_automated_client_install.py')
-rw-r--r-- | monitor/barometer_automated_client_install.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/monitor/barometer_automated_client_install.py b/monitor/barometer_automated_client_install.py new file mode 100644 index 00000000..7bbfa701 --- /dev/null +++ b/monitor/barometer_automated_client_install.py @@ -0,0 +1,36 @@ +############################################################################## +# Copyright (c) 2018 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 sys +import yaml +sys.path.insert(0, '/home/opnfv/bottlenecks/utils/infra_setup/passwordless_SSH/') +import ssh + +logger = logging.getLogger(__name__) +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 barometer-config") + if status: + raise Exception("Command failed with non-zero status.") + logger.info(stdout.splitlines()) + with open("/home/opnfv/bottlenecks/monitor/barometer_client.conf") as stdin_file: + ssh_d.run("cat > /etc/barometer-config/barometer_client_collectd.conf", stdin=stdin_file) + + with open("/home/opnfv/bottlenecks/monitor/barometer_install_client.sh") as stdin_file: + ssh_d.run("cat > /etc/barometer-config/install.sh", stdin=stdin_file) + + ssh_d.run("cd /etc/barometer-config/ && bash ./install.sh") |