summaryrefslogtreecommitdiffstats
path: root/monitor
diff options
context:
space:
mode:
authorYang (Gabriel) Yu <Gabriel.yuyang@huawei.com>2018-07-31 11:18:15 +0800
committerYang (Gabriel) Yu <Gabriel.yuyang@huawei.com>2018-08-01 17:07:00 +0800
commit328beca9b53e95d4f06c1cb117b33893c9c93ff5 (patch)
treef343eda995bc4fbdebc043e7fdac797e06726c46 /monitor
parent09df92d801b68dc42d7b9e39e3c718988b0c01c6 (diff)
Adapt monitor to apex
JIRA:BOTTLENECK-241 Change-Id: Ia44cbb72daaeff51189c182b042bbf4cc76aa02a Signed-off-by: Yang (Gabriel) Yu <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/dispatch/install_clients.py26
-rw-r--r--monitor/monitoring.sh3
2 files changed, 19 insertions, 10 deletions
diff --git a/monitor/dispatch/install_clients.py b/monitor/dispatch/install_clients.py
index ab7d0f5a..26174133 100644
--- a/monitor/dispatch/install_clients.py
+++ b/monitor/dispatch/install_clients.py
@@ -65,12 +65,16 @@ def main():
dataMap = yaml.safe_load(f)
for x in dataMap:
for y in dataMap[x]:
+ print("Installing {} in: {}".format(INSTALlATION_SCRIPT, y))
+ pwd = idkey = ''
if (y['role'].lower() == 'controller') or (
y['role'].lower() == 'compute'):
ip = str(y['ip'])
user = str(y['user'])
- pwd = str(y['password'])
- idkey = str(y['key_filename'])
+ if 'password' in y.keys():
+ pwd = str(y['password'])
+ if 'key_filename' in y.keys():
+ idkey = str(y['key_filename'])
if pwd:
ssh_d = ssh.SSH(user, host=ip, password=pwd)
@@ -78,18 +82,23 @@ def main():
idkey = "/tmp/id_rsa"
ssh_d = ssh.SSH(user, host=ip, key_filename=idkey)
status, stdout, stderr = ssh_d.execute(
- "cd /etc && mkdir " + CONFIG_DIR
+ "cd /etc && if [ ! -d " + CONFIG_DIR +
+ " ]; then sudo mkdir " + CONFIG_DIR + "; fi"
)
if status:
print Exception(
- "Command: \"mkdir {}\".format(CONFIG_DIR) failed.")
+ "Command: \"mkdir {}\"".format(CONFIG_DIR) +
+ " failed."
+ )
logger.info(stdout.splitlines())
if args.CLIENT_CONFIG:
with open(args.CLIENT_CONFIG) as stdin_file:
- ssh_d.run("cat > " + CONFIG_FILE,
+ ssh_d.run("sudo sh -c \"cat > " + CONFIG_FILE +
+ "\"",
stdin=stdin_file)
with open(args.INSTALlATION_SCRIPT) as stdin_file:
- ssh_d.run("cat > " + INSTALlATION_SCRIPT,
+ ssh_d.run("sudo sh -c \"cat > " + INSTALlATION_SCRIPT +
+ "\"",
stdin=stdin_file)
for u in os.uname():
@@ -102,7 +111,7 @@ def main():
)
else:
status, stdout, stderr = ssh_d.execute(
- "sudo yum install -y docker-io"
+ "sudo service docker start"
)
if status:
raise Exception(
@@ -110,7 +119,8 @@ def main():
logger.info(stdout.splitlines())
ssh_d.run(
- "cd /etc/{}/ && bash ./install.sh".format(CONFIG_DIR)
+ "cd /etc/{}/ && bash ./install.sh".format(CONFIG_DIR),
+ raise_on_error=False
)
diff --git a/monitor/monitoring.sh b/monitor/monitoring.sh
index 758f77ec..5442d331 100644
--- a/monitor/monitoring.sh
+++ b/monitor/monitoring.sh
@@ -149,14 +149,13 @@ python ${DISPATCH}/server_ip_configure.py ${MONITOR_CONFIG}/barometer_server.con
set +e
# Install on jumpserver
docker pull opnfv/barometer
-sudo docker run --name bottlenecks-barometer -d --net=host \
+sudo docker run --name bottlenecks-barometer -d \
-v ${MONITOR_CONFIG}/barometer_server.conf:/src/barometer/src/collectd/collectd/src/collectd.conf \
-v ${MONITOR_CONFIG}/barometer_server.conf:/opt/collectd/etc/collectd.conf \
-v /var/run:/var/run \
-v /tmp:/tmp \
--privileged opnfv/barometer /run_collectd.sh
-set -e
# INSTALL BAROMETER + CADVISOR (+ COLLECTD) CLIENTS on COMPUTE/CONTROL NODES
# Configure IP Address in barometer client configuration
python ${DISPATCH}/client_ip_configure.py ${MONITOR_CONFIG}/barometer_client.conf