diff options
author | Yang Yu <Gabriel.yuyang@huawei.com> | 2018-05-02 16:52:11 +0800 |
---|---|---|
committer | Yu Yang (Gabriel) <Gabriel.yuyang@huawei.com> | 2018-05-03 08:19:30 +0000 |
commit | 3f3676124f276985a0eb8986f53683a39f353dc2 (patch) | |
tree | 226b177ff6e8a227368c2d765174ba9d4f875829 | |
parent | 14add4c9ee3c3114a92ee6c8cf6a6f677ec386a8 (diff) |
Restructure monitoring scripts
Restructure the monitoring scripts and modify the scripts to remove the
redundance
Change-Id: Ib4a5d7bea2dc455ec03ad61780b6caf06831daa8
Signed-off-by: Yang Yu <Gabriel.yuyang@huawei.com>
(cherry picked from commit cb67313c1e14b6eca057bdfc7722bc11506b7a2a)
-rw-r--r-- | monitor/barometer_install_client.sh | 5 | ||||
-rw-r--r-- | monitor/barometer_install_script.sh | 5 | ||||
-rw-r--r-- | monitor/config/barometer_client.conf (renamed from monitor/barometer_client.conf) | 4 | ||||
-rw-r--r-- | monitor/config/barometer_server.conf (renamed from monitor/barometer_collectd.conf) | 4 | ||||
-rw-r--r-- | monitor/config/collectd_client.conf (renamed from monitor/config/collectd-client.conf) | 0 | ||||
-rw-r--r-- | monitor/config/collectd_server.conf (renamed from monitor/config/collectd.conf) | 0 | ||||
-rw-r--r-- | monitor/config/grafana.ini (renamed from monitor/grafana/config/grafana.ini) | 0 | ||||
-rw-r--r-- | monitor/config/prometheus.yaml | 8 | ||||
-rw-r--r-- | monitor/dashboard/__init__.py (renamed from monitor/config/__init__.py) | 2 | ||||
-rw-r--r-- | monitor/dashboard/automated_dashboard_datasource.py (renamed from monitor/automated_dashboard_datasource.py) | 8 | ||||
-rw-r--r-- | monitor/dashboard/custom_dashboard.py (renamed from monitor/custom_dashboard.py) | 0 | ||||
-rw-r--r-- | monitor/dashboard/custom_query_dashboard.json (renamed from monitor/custom_query_dashboard.json) | 0 | ||||
-rw-r--r-- | monitor/dashboard/prometheus_system_rev1.json (renamed from monitor/grafana/dashboards/prometheus_system_rev1.json) | 40 | ||||
-rw-r--r-- | monitor/dashboard/prototype_dashboard_collapsible.json (renamed from monitor/prototype_dashboard_collapsible.json) | 8 | ||||
-rw-r--r-- | monitor/dashboard/prototype_prometheus_dashboard.json (renamed from monitor/prototype_prometheus_dashboard.json) | 0 | ||||
-rw-r--r-- | monitor/dispatch/__init__.py | 8 | ||||
-rw-r--r-- | monitor/dispatch/automate_barometer_client.py (renamed from monitor/barometer_automated_client_install.py) | 16 | ||||
-rw-r--r-- | monitor/dispatch/automate_cadvisor_client.py (renamed from monitor/automate_cadvisor_client.py) | 10 | ||||
-rw-r--r-- | monitor/dispatch/automate_collectd_client.py (renamed from monitor/automate_collectd_client.py) | 13 | ||||
-rw-r--r-- | monitor/dispatch/client_ip_configure.py (renamed from monitor/client_ip_configure.py) | 0 | ||||
-rw-r--r-- | monitor/dispatch/install_barometer_client.sh | 8 | ||||
-rw-r--r-- | monitor/dispatch/install_cadvisor_client.sh (renamed from monitor/cadvisor_install.sh) | 6 | ||||
-rw-r--r-- | monitor/dispatch/install_collectd_client.sh | 8 | ||||
-rw-r--r-- | monitor/dispatch/server_ip_configure.py (renamed from monitor/server_ip_configure.py) | 0 | ||||
-rw-r--r-- | monitor/install_collectd_client.sh | 8 | ||||
-rw-r--r-- | monitor/monitoring.sh | 105 |
26 files changed, 157 insertions, 109 deletions
diff --git a/monitor/barometer_install_client.sh b/monitor/barometer_install_client.sh deleted file mode 100644 index 2bf6cd8d..00000000 --- a/monitor/barometer_install_client.sh +++ /dev/null @@ -1,5 +0,0 @@ -docker pull opnfv/barometer -sudo docker run --name bottlenecks-barometer-client -tid --net=host -v `pwd`/../src/collectd_sample_configs:/opt/collectd/etc/collectd.conf.d \ --v /etc/barometer_config/barometer_client_collectd.conf:/src/barometer/src/collectd/collectd/src/collectd.conf \ --v /etc/barometer_config/barometer_client_collectd.conf:/opt/collectd/etc/collectd.conf \ --v /var/run:/var/run -v /tmp:/tmp --privileged opnfv/barometer /run_collectd.sh diff --git a/monitor/barometer_install_script.sh b/monitor/barometer_install_script.sh deleted file mode 100644 index b0abbb90..00000000 --- a/monitor/barometer_install_script.sh +++ /dev/null @@ -1,5 +0,0 @@ -docker pull opnfv/barometer -sudo docker run --name bottlenecks-barometer-server -tid --net=host -v `pwd`/../src/collectd_sample_configs:/opt/collectd/etc/collectd.conf.d \ --v /home/opnfv/bottlenecks/monitor/barometer_collectd.conf:/src/barometer/src/collectd/collectd/src/collectd.conf \ --v /etc/barometer_config/barometer_client_collectd.conf:/opt/collectd/etc/collectd.conf \ --v /var/run:/var/run -v /tmp:/tmp --privileged opnfv/barometer /run_collectd.sh diff --git a/monitor/barometer_client.conf b/monitor/config/barometer_client.conf index fc29e72c..54db3889 100644 --- a/monitor/barometer_client.conf +++ b/monitor/config/barometer_client.conf @@ -146,7 +146,7 @@ LoadPlugin write_http #</Plugin> <Plugin network> - Server "192.168.121.2" "25826" + Server "192.168.114.2" "25826" </Plugin> <Plugin ovs_events> @@ -167,7 +167,7 @@ LoadPlugin write_http <Plugin write_http> <Node "collectd_exporter"> - URL "http://192.168.121.2:9103/collectd-post" + URL "http://192.168.114.2:9103/collectd-post" Format "JSON" StoreRates false </Node> diff --git a/monitor/barometer_collectd.conf b/monitor/config/barometer_server.conf index ecb1261c..55ff96e0 100644 --- a/monitor/barometer_collectd.conf +++ b/monitor/config/barometer_server.conf @@ -146,7 +146,7 @@ LoadPlugin write_http #</Plugin> <Plugin network> - Listen "192.168.121.2" "25826" + Listen "192.168.114.2" "25826" </Plugin> <Plugin ovs_events> @@ -167,7 +167,7 @@ LoadPlugin write_http <Plugin write_http> <Node "collectd_exporter"> - URL "http://192.168.121.2:9103/collectd-post" + URL "http://192.168.114.2:9103/collectd-post" Format "JSON" StoreRates false </Node> diff --git a/monitor/config/collectd-client.conf b/monitor/config/collectd_client.conf index 96a2a690..96a2a690 100644 --- a/monitor/config/collectd-client.conf +++ b/monitor/config/collectd_client.conf diff --git a/monitor/config/collectd.conf b/monitor/config/collectd_server.conf index 6be610e5..6be610e5 100644 --- a/monitor/config/collectd.conf +++ b/monitor/config/collectd_server.conf diff --git a/monitor/grafana/config/grafana.ini b/monitor/config/grafana.ini index eb4055ca..eb4055ca 100644 --- a/monitor/grafana/config/grafana.ini +++ b/monitor/config/grafana.ini diff --git a/monitor/config/prometheus.yaml b/monitor/config/prometheus.yaml index 3736d8e4..b218711d 100644 --- a/monitor/config/prometheus.yaml +++ b/monitor/config/prometheus.yaml @@ -25,7 +25,7 @@ scrape_configs: scrape_interval: 5s static_configs: - - targets: ['192.168.121.2:9090'] + - targets: ['192.168.114.2:9090'] - job_name: 'cadvisor' @@ -33,7 +33,7 @@ scrape_configs: scrape_interval: 5s static_configs: - - targets: ['192.168.121.2:8080','10.1.0.50:8080','10.1.0.51:8080'] + - targets: ['192.168.114.2:8080','10.1.0.50:8080','10.1.0.51:8080','10.1.0.52:8080','10.1.0.53:8080','10.1.0.54:8080'] - job_name: 'collectd' @@ -41,7 +41,7 @@ scrape_configs: scrape_interval: 5s static_configs: - - targets: ['192.168.121.2:9103'] + - targets: ['192.168.114.2:9103'] - job_name: 'node' @@ -49,4 +49,4 @@ scrape_configs: scrape_interval: 5s static_configs: - - targets: ['192.168.121.2:9100'] + - targets: ['192.168.114.2:9100'] diff --git a/monitor/config/__init__.py b/monitor/dashboard/__init__.py index b124dfa9..a90f1d17 100644 --- a/monitor/config/__init__.py +++ b/monitor/dashboard/__init__.py @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 diff --git a/monitor/automated_dashboard_datasource.py b/monitor/dashboard/automated_dashboard_datasource.py index ee605049..48f9710c 100644 --- a/monitor/automated_dashboard_datasource.py +++ b/monitor/dashboard/automated_dashboard_datasource.py @@ -14,6 +14,7 @@ from oslo_serialization import jsonutils logger = logging.getLogger(__name__) +MONITOR_DASHBOARD = "/home/opnfv/bottlenecks/monitor/dashboard/" def _create_dashboard(ip, port, path): @@ -64,8 +65,7 @@ def post(url, data): ip_address = socket.gethostbyname(socket.gethostname()) _create_data_source(ip_address, 3000) -_create_dashboard(ip_address, 3000, '/var/lib/grafana/' + - 'dashboards/' + - 'prometheus_system_rev1.json') +# _create_dashboard(ip_address, 3000, +# MONITOR_DASHBOARD + 'prometheus_system_rev1.json') _create_dashboard(ip_address, 3000, - 'prototype_dashboard_collapsible.json') + MONITOR_DASHBOARD + 'prototype_dashboard_collapsible.json') diff --git a/monitor/custom_dashboard.py b/monitor/dashboard/custom_dashboard.py index 2a4f79cf..2a4f79cf 100644 --- a/monitor/custom_dashboard.py +++ b/monitor/dashboard/custom_dashboard.py diff --git a/monitor/custom_query_dashboard.json b/monitor/dashboard/custom_query_dashboard.json index 7f2e53a3..7f2e53a3 100644 --- a/monitor/custom_query_dashboard.json +++ b/monitor/dashboard/custom_query_dashboard.json diff --git a/monitor/grafana/dashboards/prometheus_system_rev1.json b/monitor/dashboard/prometheus_system_rev1.json index 99e98b4f..78d88e42 100644 --- a/monitor/grafana/dashboards/prometheus_system_rev1.json +++ b/monitor/dashboard/prometheus_system_rev1.json @@ -63,7 +63,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 1, "editable": true, "error": false, @@ -143,7 +143,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "editable": true, "error": false, "format": "none", @@ -222,7 +222,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)" ], - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -304,7 +304,7 @@ "rgba(237, 129, 40, 0.89)", "rgba(245, 54, 54, 0.9)" ], - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 0, "editable": true, "error": false, @@ -378,7 +378,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -464,7 +464,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -600,7 +600,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -729,7 +729,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -856,7 +856,7 @@ { "aliasColors": {}, "bars": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -948,7 +948,7 @@ { "aliasColors": {}, "bars": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1057,7 +1057,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1144,7 +1144,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1236,7 +1236,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1336,7 +1336,7 @@ { "aliasColors": {}, "bars": true, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1440,7 +1440,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1549,7 +1549,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1649,7 +1649,7 @@ { "aliasColors": {}, "bars": false, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "decimals": 2, "editable": true, "error": false, @@ -1853,7 +1853,7 @@ { "allFormat": "glob", "current": {}, - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "hide": 0, "includeAll": false, "label": "Host", @@ -1875,7 +1875,7 @@ "annotations": { "list": [ { - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "enable": false, "expr": "ALERTS{alias=\"$host\", alertstate=\"firing\"}", "iconColor": "rgb(252, 5, 0)", @@ -1885,7 +1885,7 @@ "titleFormat": "{{ alertname }}" }, { - "datasource": "${DS_PROMETHEUS}", + "datasource": "automated-ds", "enable": true, "expr": "ALERTS{alias=\"$host\",alertstate=\"pending\"}", "iconColor": "rgb(228, 242, 9)", diff --git a/monitor/prototype_dashboard_collapsible.json b/monitor/dashboard/prototype_dashboard_collapsible.json index aca25234..58882361 100644 --- a/monitor/prototype_dashboard_collapsible.json +++ b/monitor/dashboard/prototype_dashboard_collapsible.json @@ -7,7 +7,7 @@ "gnetId": 893, "graphTooltip": 1, "hideControls": false, - "id": 13, + "id": null, "links": [], "refresh": "15m", "rows": [ @@ -1983,8 +1983,8 @@ { "allValue": null, "current": { - "text": "192.168.121.2", - "value": "192.168.121.2" + "text": "192.168.114.2", + "value": "192.168.114.2" }, "datasource": "automated-ds", "hide": 0, @@ -2035,6 +2035,6 @@ ] }, "timezone": "browser", - "title": "Monitoring docker using Prometheus", + "title": "Collapsibe System Monitor using Prometheus", "version": 3 } diff --git a/monitor/prototype_prometheus_dashboard.json b/monitor/dashboard/prototype_prometheus_dashboard.json index 36c77c39..36c77c39 100644 --- a/monitor/prototype_prometheus_dashboard.json +++ b/monitor/dashboard/prototype_prometheus_dashboard.json diff --git a/monitor/dispatch/__init__.py b/monitor/dispatch/__init__.py new file mode 100644 index 00000000..a90f1d17 --- /dev/null +++ b/monitor/dispatch/__init__.py @@ -0,0 +1,8 @@ +############################################################################## +# Copyright (c) 2018 Huawei Technologies Co.,Ltd 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 +############################################################################## diff --git a/monitor/barometer_automated_client_install.py b/monitor/dispatch/automate_barometer_client.py index 9bb2c6b1..3a246028 100644 --- a/monitor/barometer_automated_client_install.py +++ b/monitor/dispatch/automate_barometer_client.py @@ -13,9 +13,9 @@ import utils.infra_setup.passwordless_SSH.ssh as ssh logger = logging.getLogger(__name__) barometer_client_install_sh =\ - "/home/opnfv/bottlenecks/monitor/barometer_install_client.sh" + "/home/opnfv/bottlenecks/monitor/dispatch/install_barometer_client.sh" barometer_client_install_conf =\ - "/home/opnfv/bottlenecks/monitor/barometer_client.conf" + "/home/opnfv/bottlenecks/monitor/config/barometer_client.conf" with open('/tmp/pod.yaml') as f: dataMap = yaml.safe_load(f) @@ -30,14 +30,22 @@ with open('/tmp/pod.yaml') as f: "cd /etc && mkdir barometer_config" ) if status: - raise Exception("Command failed with non-zero status.") + print Exception( + "Command: \"mkdir barometer_config\" failed.") logger.info(stdout.splitlines()) with open(barometer_client_install_conf) as stdin_file: ssh_d.run("cat > /etc/barometer_config/\ - barometer_client_collectd.conf", +barometer_client.conf", stdin=stdin_file) with open(barometer_client_install_sh) as stdin_file: ssh_d.run("cat > /etc/barometer_config/install.sh", stdin=stdin_file) + status, stdout, stderr = ssh_d.execute( + "sudo apt-get install -y docker.io" + ) + if status: + raise Exception("Command for installing docker failed.") + logger.info(stdout.splitlines()) + ssh_d.run("cd /etc/barometer_config/ && bash ./install.sh") diff --git a/monitor/automate_cadvisor_client.py b/monitor/dispatch/automate_cadvisor_client.py index f84892dd..3a65ff1d 100644 --- a/monitor/automate_cadvisor_client.py +++ b/monitor/dispatch/automate_cadvisor_client.py @@ -12,7 +12,8 @@ import yaml import utils.infra_setup.passwordless_SSH.ssh as ssh logger = logging.getLogger(__name__) -cadvisor_install_sh = "/home/opnfv/bottlenecks/monitor/cadvisor_install.sh" +cadvisor_client_install_sh =\ + "/home/opnfv/bottlenecks/monitor/dispatch/install_cadvisor_client.sh" with open('/tmp/pod.yaml') as f: dataMap = yaml.safe_load(f) @@ -27,13 +28,14 @@ with open('/tmp/pod.yaml') as f: "cd /etc && mkdir cadvisor_config" ) if status: - raise Exception("Command failed with non-zero status.") + print Exception( + "Command: \"mkdir cadvisor_config\" failed.") logger.info(stdout.splitlines()) - with open(cadvisor_install_sh) as stdin_file: + with open(cadvisor_client_install_sh) as stdin_file: ssh_d.run("cat > /etc/cadvisor_config/install.sh", stdin=stdin_file) status, stdout, stderr = ssh_d.execute( - "sudo apt-get install docker.io" + "sudo apt-get install -y docker.io" ) if status: raise Exception("Command for installing docker failed.") diff --git a/monitor/automate_collectd_client.py b/monitor/dispatch/automate_collectd_client.py index 8358cfc5..c4346e51 100644 --- a/monitor/automate_collectd_client.py +++ b/monitor/dispatch/automate_collectd_client.py @@ -13,7 +13,7 @@ import utils.infra_setup.passwordless_SSH.ssh as ssh logger = logging.getLogger(__name__) collectd_client_install_sh =\ - "/home/opnfv/bottlenecks/monitor/install_collectd_client.sh" + "/home/opnfv/bottlenecks/monitor/dispatch/install_collectd_client.sh" collectd_client_install_conf =\ "/home/opnfv/bottlenecks/monitor/config/collectd_client.conf" @@ -30,16 +30,19 @@ with open('/tmp/pod.yaml') as f: "cd /etc && mkdir collectd_config" ) if status: - raise Exception("Command failed with non-zero status.") + print Exception( + "Command: \"mkdir collectd_config\" failed.") logger.info(stdout.splitlines()) with open(collectd_client_install_sh) as stdin_file: ssh_d.run("cat > /etc/collectd_config/install.sh", stdin=stdin_file) with open(collectd_client_install_conf) as stdin_file: - ssh_d.run("cat > /etc/collectd_config/collectd.conf", - stdin=stdin_file) + ssh_d.run( + "cat > /etc/collectd_config/collectd_client.conf", + stdin=stdin_file + ) status, stdout, stderr = ssh_d.execute( - "sudo apt-get install docker.io" + "sudo apt-get install -y docker.io" ) if status: raise Exception("Command for installing docker failed.") diff --git a/monitor/client_ip_configure.py b/monitor/dispatch/client_ip_configure.py index 2a66f7b2..2a66f7b2 100644 --- a/monitor/client_ip_configure.py +++ b/monitor/dispatch/client_ip_configure.py diff --git a/monitor/dispatch/install_barometer_client.sh b/monitor/dispatch/install_barometer_client.sh new file mode 100644 index 00000000..491e8245 --- /dev/null +++ b/monitor/dispatch/install_barometer_client.sh @@ -0,0 +1,8 @@ +HOSTNAME=`hostname` + +docker pull opnfv/barometer +sudo docker run --name bottlenecks-barometer-${HOSTNAME} -tid --net=host \ + -v /etc/barometer_config/barometer_client.conf:/src/barometer/src/collectd/collectd/src/collectd.conf \ + -v /etc/barometer_config/barometer_client.conf:/opt/collectd/etc/collectd.conf \ + -v /var/run:/var/run -v /tmp:/tmp \ + --privileged opnfv/barometer /run_collectd.sh
\ No newline at end of file diff --git a/monitor/cadvisor_install.sh b/monitor/dispatch/install_cadvisor_client.sh index 524e24d8..bcd0e8a1 100644 --- a/monitor/cadvisor_install.sh +++ b/monitor/dispatch/install_cadvisor_client.sh @@ -1,4 +1,7 @@ +HOSTNAME=`hostname` + sudo docker run \ + --name=bottlenecks-cadvisor-${HOSTNAME} \ --volume=/:/rootfs:ro \ --volume=/var/run:/var/run:rw \ --volume=/sys:/sys:ro \ @@ -6,5 +9,4 @@ sudo docker run \ --volume=/dev/disk/:/dev/disk:ro \ --publish=8080:8080 \ --detach=true \ - --name=cadvisor \ - google/cadvisor:v0.25.0 \ -storage_driver=Prometheus + google/cadvisor:v0.25.0 diff --git a/monitor/dispatch/install_collectd_client.sh b/monitor/dispatch/install_collectd_client.sh new file mode 100644 index 00000000..4f081124 --- /dev/null +++ b/monitor/dispatch/install_collectd_client.sh @@ -0,0 +1,8 @@ +MONITOR_CONFIG="/etc/collectd_config" +HOSTNAME=`hostname` + +sudo docker run --name bottlenecks-collectd-${HOSTNAME} -d \ + --privileged \ + -v ${MONITOR_CONFIG}/collectd_client.conf:/etc/collectd/collectd.conf:ro \ + -v /proc:/mnt/proc:ro \ + fr3nd/collectd:5.5.0-1 diff --git a/monitor/server_ip_configure.py b/monitor/dispatch/server_ip_configure.py index 62aa6288..62aa6288 100644 --- a/monitor/server_ip_configure.py +++ b/monitor/dispatch/server_ip_configure.py diff --git a/monitor/install_collectd_client.sh b/monitor/install_collectd_client.sh deleted file mode 100644 index 3861f987..00000000 --- a/monitor/install_collectd_client.sh +++ /dev/null @@ -1,8 +0,0 @@ -MONITOR_CONFIG="/etc/collectd_config" - -# Collectd -sudo docker run --name bottlenecks-automated-collectd -d \ - --privileged \ - -v ${MONITOR_CONFIG}:/etc/collectd:ro \ - -v /proc:/mnt/proc:ro \ - fr3nd/collectd:5.5.0-1 diff --git a/monitor/monitoring.sh b/monitor/monitoring.sh index 9abe49d9..b42126b7 100644 --- a/monitor/monitoring.sh +++ b/monitor/monitoring.sh @@ -7,33 +7,41 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +set -e MONITOR_CONFIG="/home/opnfv/bottlenecks/monitor/config" -GRAFANA="/home/opnfv/bottlenecks/monitor/grafana" - -# Node-Exporter -sudo docker run --name bottlenecks-node-exporter \ - -d -p 9100:9100 \ - -v "/proc:/host/proc:ro" \ - -v "/sys:/host/sys:ro" \ - -v "/:/rootfs:ro" \ - --net="host" \ - quay.io/prometheus/node-exporter:v0.14.0 \ - -collector.procfs /host/proc \ - -collector.sysfs /host/sys \ - -collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)" - -# Collectd -sudo docker run --name bottlenecks-collectd -d \ - --privileged \ - -v ${MONITOR_CONFIG}:/etc/collectd:ro \ - -v /proc:/mnt/proc:ro \ - fr3nd/collectd:5.5.0-1 +DISPATCH="/home/opnfv/bottlenecks/monitor/dispatch" + +# INSTALL GRAFANA + PROMETHEUS + CADVISOR + BAROMETER on the JUMPERSERVER +# # Node-Exporter +# sudo docker run --name bottlenecks-node-exporter \ +# -d -p 9100:9100 \ +# -v "/proc:/host/proc:ro" \ +# -v "/sys:/host/sys:ro" \ +# -v "/:/rootfs:ro" \ +# --net="host" \ +# quay.io/prometheus/node-exporter:v0.14.0 \ +# -collector.procfs /host/proc \ +# -collector.sysfs /host/sys \ +# -collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)" + +# # Collectd +# # Configure IP Address in collectd server configuration +# python ${DISPATCH}/server_ip_configure.py ${MONITOR_CONFIG}/collectd_server.conf +# sudo docker run --name bottlenecks-collectd -d \ +# --privileged \ +# -v ${MONITOR_CONFIG}/collectd_server.conf:/etc/collectd/collectd.conf:ro \ +# -v /proc:/mnt/proc:ro \ +# fr3nd/collectd:5.5.0-1 + +echo == installation of monitoring module is started == + +set +e # Collectd-Exporter sudo docker run --name bottlenecks-collectd-exporter \ - -d -p 9103:9103 \ - -p 25826:25826/udp prom/collectd-exporter:0.3.1 \ + -d -p 9103:9103 -p 25826:25826/udp \ + prom/collectd-exporter:0.3.1 \ -collectd.listen-address=":25826" # Prometheus @@ -45,9 +53,14 @@ sudo docker run --name bottlenecks-prometheus \ # Grafana sudo docker run --name bottlenecks-grafana \ -d -p 3000:3000 \ - -v ${GRAFANA}/config/grafana.ini:/etc/grafana/grafana.ini \ + -v ${MONITOR_CONFIG}/grafana.ini:/etc/grafana/grafana.ini \ grafana/grafana:4.5.0 +# Automate Prometheus Datasource and Grafana Dashboard creation + +set -e +python dashboard/automated_dashboard_datasource.py +set +e # Cadvisor sudo docker run \ --volume=/:/rootfs:ro \ @@ -57,26 +70,40 @@ sudo docker run \ --volume=/dev/disk/:/dev/disk:ro \ --publish=8080:8080 \ --detach=true \ - --name=cadvisor \ - google/cadvisor:v0.25.0 \ -storage_driver=Prometheus - -# Configure IP Address in barometer client configuration -python client_ip_configure.py barometer_client.conf + --name=bottlenecks-cadvisor \ + google/cadvisor:v0.25.0 +set -e +# Barometer # Configure IP Address in barometer server configuration -python server_ip_configure.py barometer_collectd.conf +sleep 10 +python ${DISPATCH}/server_ip_configure.py ${MONITOR_CONFIG}/barometer_server.conf -# Automate Collectd Client -python automate_collectd_client.py +set +e +# Install on jumpserver +docker pull opnfv/barometer +sudo docker run --name bottlenecks-barometer -tid --net=host \ + -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 -# Automate Cadvisor Client -python automate_cadvisor_client.py -# Automate Barometer installation for jump server -bash ./barometer_install_script.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 -# Automate Barometer installation for compute/controller nodes -python barometer_automated_client_install.py +# Automate Barometer client installation +python ${DISPATCH}/automate_barometer_client.py -# Automate Prometheus Datasource and Grafana Dashboard creation -python automated_dashboard_datasource.py +# # Configure IP Address in collectd client configuration +# python ${DISPATCH}/client_ip_configure.py ${MONITOR_CONFIG}/collectd_client.conf +# # Automate Collectd Client installation +# python ${DISPATCH}/automate_collectd_client.py + +# Automate Cadvisor Client +python ${DISPATCH}/automate_cadvisor_client.py + +echo == installation of monitoring module is finished == |