2 ##############################################################################
3 # Copyright (c) 2017 Huawei Tech and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 MONITOR_CONFIG="/home/opnfv/bottlenecks/monitor/config"
11 DISPATCH="/home/opnfv/bottlenecks/monitor/dispatch"
12 OPENSTACK_ENV=${MONITOR_CONFIG}/openstack_exporter.conf
14 usage="Script to run the tests in Bottlenecks.
17 bash $(basename "$0") [-h|--help] [-i|--installer <installer typer>] [-o|--openstack-env <openstack env>]
20 -h|--help show the help text
21 -i|--installer specify the installer for the system to be monitored
25 -o|--opentack-env specify the openstack env file for openstack monitoring
26 defalt value is \"${MONITOR_CONFIG}/openstack_exporter.conf\"
29 $(basename "$0") -i compass"
33 logger -s -t "BOTTLENECKS INFO" "$*"
37 logger -s -t "BOTTLENECKS ERROR" "$*"
41 # Process input variables
60 error "unkown input options $1 $2"
68 barometer_client_install_sh="/home/opnfv/bottlenecks/monitor/dispatch/install_barometer_client.sh"
69 barometer_client_install_conf="/home/opnfv/bottlenecks/monitor/config/barometer_client.conf"
71 cadvisor_client_install_sh="/home/opnfv/bottlenecks/monitor/dispatch/install_cadvisor_client.sh"
73 collectd_client_install_sh="/home/opnfv/bottlenecks/monitor/dispatch/install_collectd_client.sh"
74 collectd_client_install_conf="/home/opnfv/bottlenecks/monitor/config/collectd_client.conf"
76 # INSTALL GRAFANA + PROMETHEUS + CADVISOR + BAROMETER on the JUMPERSERVER
78 echo == installation of monitoring module is started ==
81 # # Configure IP Address in collectd server configuration
82 # python ${DISPATCH}/server_ip_configure.py ${MONITOR_CONFIG}/collectd_server.conf
83 # sudo docker run --name bottlenecks-collectd -d \
85 # -v ${MONITOR_CONFIG}/collectd_server.conf:/etc/collectd/collectd.conf:ro \
86 # -v /proc:/mnt/proc:ro \
87 # fr3nd/collectd:5.5.0-1
91 sudo docker run --name bottlenecks-prometheus \
93 -v ${MONITOR_CONFIG}/prometheus.yaml:/etc/prometheus/prometheus.yml \
94 prom/prometheus:v1.7.1
97 sudo docker run --name bottlenecks-collectd-exporter \
98 -d -p 9103:9103 -p 25826:25826/udp \
99 prom/collectd-exporter:0.3.1 \
100 -collectd.listen-address=":25826"
102 sudo docker run --name bottlenecks-node-exporter \
104 -v "/proc:/host/proc:ro" \
105 -v "/sys:/host/sys:ro" \
108 quay.io/prometheus/node-exporter:v0.14.0 \
109 -collector.procfs /host/proc \
110 -collector.sysfs /host/sys \
111 -collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
114 sudo docker run --name bottlenecks-openstack-exporter \
116 -p 9104:9104 --env-file ${OPENSTACK_ENV} \
117 -d gabrielyuyang/openstack-exporter:1.0
120 sudo docker run --name bottlenecks-grafana \
122 -v ${MONITOR_CONFIG}/grafana.ini:/etc/grafana/grafana.ini \
123 grafana/grafana:4.5.0
124 # Automate Prometheus Datasource and Grafana Dashboard creation
128 python ${DISPATCH}/../dashboard/automated_dashboard_datasource.py
133 --volume=/:/rootfs:ro \
134 --volume=/var/run:/var/run:rw \
135 --volume=/sys:/sys:ro \
136 --volume=/var/lib/docker/:/var/lib/docker:ro \
137 --volume=/dev/disk/:/dev/disk:ro \
138 --publish=8080:8080 \
140 --name=bottlenecks-cadvisor \
141 google/cadvisor:v0.25.0
146 # Configure IP Address in barometer server configuration
148 python ${DISPATCH}/server_ip_configure.py ${MONITOR_CONFIG}/barometer_server.conf
151 # Install on jumpserver
152 docker pull opnfv/barometer
153 sudo docker run --name bottlenecks-barometer -d --net=host \
154 -v ${MONITOR_CONFIG}/barometer_server.conf:/src/barometer/src/collectd/collectd/src/collectd.conf \
155 -v ${MONITOR_CONFIG}/barometer_server.conf:/opt/collectd/etc/collectd.conf \
156 -v /var/run:/var/run \
158 --privileged opnfv/barometer /run_collectd.sh
161 # INSTALL BAROMETER + CADVISOR (+ COLLECTD) CLIENTS on COMPUTE/CONTROL NODES
162 # Configure IP Address in barometer client configuration
163 python ${DISPATCH}/client_ip_configure.py ${MONITOR_CONFIG}/barometer_client.conf
165 # Automate Barometer client installation
166 python ${DISPATCH}/install_clients.py \
167 -i ${INSTALLER_TYPE} -s ${barometer_client_install_sh} \
168 -c ${barometer_client_install_conf}
170 # # Configure IP Address in collectd client configuration
171 # python ${DISPATCH}/client_ip_configure.py ${MONITOR_CONFIG}/collectd_client.conf
172 # # Automate Collectd Client installation
173 # python ${DISPATCH}/automate_collectd_client.py
175 # Automate Cadvisor Client
176 python ${DISPATCH}/install_clients.py \
177 -i ${INSTALLER_TYPE} -s ${cadvisor_client_install_sh}
179 echo == installation of monitoring module is finished ==