9abe49d9fa68d6fcc3eaf24e9e03aecb28b5abfa
[bottlenecks.git] / monitor / monitoring.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2017 Huawei Tech and others.
4 #
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
11 MONITOR_CONFIG="/home/opnfv/bottlenecks/monitor/config"
12 GRAFANA="/home/opnfv/bottlenecks/monitor/grafana"
13
14 # Node-Exporter
15 sudo docker run --name bottlenecks-node-exporter \
16   -d -p 9100:9100 \
17   -v "/proc:/host/proc:ro" \
18   -v "/sys:/host/sys:ro" \
19   -v "/:/rootfs:ro" \
20   --net="host" \
21   quay.io/prometheus/node-exporter:v0.14.0 \
22     -collector.procfs /host/proc \
23     -collector.sysfs /host/sys \
24     -collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
25
26 # Collectd
27 sudo docker run --name bottlenecks-collectd -d \
28   --privileged \
29   -v ${MONITOR_CONFIG}:/etc/collectd:ro \
30   -v /proc:/mnt/proc:ro \
31   fr3nd/collectd:5.5.0-1
32
33 # Collectd-Exporter
34 sudo docker run --name bottlenecks-collectd-exporter \
35   -d -p 9103:9103 \
36   -p 25826:25826/udp prom/collectd-exporter:0.3.1 \
37   -collectd.listen-address=":25826"
38
39 # Prometheus
40 sudo docker run --name bottlenecks-prometheus \
41   -d -p 9090:9090 \
42   -v ${MONITOR_CONFIG}/prometheus.yaml:/etc/prometheus/prometheus.yml \
43   prom/prometheus:v1.7.1
44
45 # Grafana
46 sudo  docker run --name bottlenecks-grafana \
47   -d -p 3000:3000 \
48   -v ${GRAFANA}/config/grafana.ini:/etc/grafana/grafana.ini \
49   grafana/grafana:4.5.0
50
51 # Cadvisor
52 sudo docker run \
53   --volume=/:/rootfs:ro \
54   --volume=/var/run:/var/run:rw \
55   --volume=/sys:/sys:ro \
56   --volume=/var/lib/docker/:/var/lib/docker:ro \
57   --volume=/dev/disk/:/dev/disk:ro \
58   --publish=8080:8080 \
59   --detach=true \
60   --name=cadvisor \
61   google/cadvisor:v0.25.0 \ -storage_driver=Prometheus
62
63 # Configure IP Address in barometer client configuration
64 python client_ip_configure.py barometer_client.conf
65
66 # Configure IP Address in barometer server configuration
67 python server_ip_configure.py barometer_collectd.conf
68
69 # Automate Collectd Client
70 python automate_collectd_client.py
71
72 # Automate Cadvisor Client
73 python automate_cadvisor_client.py
74
75 # Automate Barometer installation for jump server
76 bash ./barometer_install_script.sh
77
78 # Automate Barometer installation for compute/controller nodes
79 python barometer_automated_client_install.py
80
81 # Automate Prometheus Datasource and Grafana Dashboard creation
82 python automated_dashboard_datasource.py