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" \
107 quay.io/prometheus/node-exporter:v0.14.0 \
108 -collector.procfs /host/proc \
109 -collector.sysfs /host/sys \
110 -collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
113 sudo docker run --name bottlenecks-openstack-exporter \
115 -p 9104:9104 --env-file ${OPENSTACK_ENV} \
116 -d gabrielyuyang/openstack-exporter:1.0
119 sudo docker run --name bottlenecks-grafana \
121 -v ${MONITOR_CONFIG}/grafana.ini:/etc/grafana/grafana.ini \
122 grafana/grafana:4.5.0
123 # Automate Prometheus Datasource and Grafana Dashboard creation
127 python ${DISPATCH}/../dashboard/automated_dashboard_datasource.py
132 --volume=/:/rootfs:ro \
133 --volume=/var/run:/var/run:rw \
134 --volume=/sys:/sys:ro \
135 --volume=/var/lib/docker/:/var/lib/docker:ro \
136 --volume=/dev/disk/:/dev/disk:ro \
137 --publish=8080:8080 \
139 --name=bottlenecks-cadvisor \
140 google/cadvisor:v0.25.0
145 # Configure IP Address in barometer server configuration
147 python ${DISPATCH}/server_ip_configure.py ${MONITOR_CONFIG}/barometer_server.conf
150 # Install on jumpserver
151 docker pull opnfv/barometer
152 sudo docker run --name bottlenecks-barometer -d \
153 -v ${MONITOR_CONFIG}/barometer_server.conf:/src/barometer/src/collectd/collectd/src/collectd.conf \
154 -v ${MONITOR_CONFIG}/barometer_server.conf:/opt/collectd/etc/collectd.conf \
155 -v /var/run:/var/run \
157 --privileged opnfv/barometer /run_collectd.sh
159 # INSTALL BAROMETER + CADVISOR (+ COLLECTD) CLIENTS on COMPUTE/CONTROL NODES
160 # Configure IP Address in barometer client configuration
161 python ${DISPATCH}/client_ip_configure.py ${MONITOR_CONFIG}/barometer_client.conf
163 # Automate Barometer client installation
164 python ${DISPATCH}/install_clients.py \
165 -i ${INSTALLER_TYPE} -s ${barometer_client_install_sh} \
166 -c ${barometer_client_install_conf}
168 # # Configure IP Address in collectd client configuration
169 # python ${DISPATCH}/client_ip_configure.py ${MONITOR_CONFIG}/collectd_client.conf
170 # # Automate Collectd Client installation
171 # python ${DISPATCH}/automate_collectd_client.py
173 # Automate Cadvisor Client
174 python ${DISPATCH}/install_clients.py \
175 -i ${INSTALLER_TYPE} -s ${cadvisor_client_install_sh}
177 echo == installation of monitoring module is finished ==