diff options
author | 2020-04-21 15:40:52 +0200 | |
---|---|---|
committer | 2020-04-23 10:57:59 +0200 | |
commit | 8838f2044f45451e2c7a86d374c2b3d39714405b (patch) | |
tree | 6208e6d33945c1da6748662c9e7a65e61fa42443 /tools/performance/cloud/snapshot-loader | |
parent | c61dcc75290d24ec0f0188b32e0ab0a7f15ea420 (diff) |
Add script for loading prometheus snapshots, improve grafana
1. Add scripts for loading prometheus snapshots locally
2. Improve Grafana dashboards for performance tests
3. Improve Grafana dashboards management (now there's one configmap
for all dashboards and to add new dashboard only needed change
is adding new json file in grafana/dashboards directory)
4. Add prometheus job for scraping node metrics and add deployment
yaml for node exporter
Issue-ID: DCAEGEN2-1576
Signed-off-by: Remigiusz Janeczek <remigiusz.janeczek@nokia.com>
Change-Id: I8870fd3291711b5dc09b76a7bf86ac4d13725237
Diffstat (limited to 'tools/performance/cloud/snapshot-loader')
6 files changed, 121 insertions, 0 deletions
diff --git a/tools/performance/cloud/snapshot-loader/.gitignore b/tools/performance/cloud/snapshot-loader/.gitignore new file mode 100644 index 00000000..9522d705 --- /dev/null +++ b/tools/performance/cloud/snapshot-loader/.gitignore @@ -0,0 +1 @@ +current-snapshot diff --git a/tools/performance/cloud/snapshot-loader/docker-compose.yml b/tools/performance/cloud/snapshot-loader/docker-compose.yml new file mode 100644 index 00000000..7a73d35f --- /dev/null +++ b/tools/performance/cloud/snapshot-loader/docker-compose.yml @@ -0,0 +1,25 @@ +version: "3.5" +services: + prometheus: + image: prom/prometheus + command: "--storage.tsdb.path=/snapshot/current-snapshot/ --config.file=/etc/prometheus/prometheus.yml" + user: root + ports: + - "9090:9090" + volumes: + - ./current-snapshot/:/snapshot/current-snapshot/ + - ./prometheus.yml:/etc/prometheus/prometheus.yml + + grafana: + image: grafana/grafana + ports: + - "3000:3000" + environment: + GF_AUTH_DISABLE_LOGIN_FORM: "true" + GF_AUTH_DISABLE_SIGNOUT_MENU: "true" + GF_AUTH_ANONYMOUS_ENABLED: "true" + GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin" + volumes: + - ./grafana/datasources:/etc/grafana/provisioning/datasources + - ./grafana/dashboards-providers:/etc/grafana/provisioning/dashboards + - ../grafana/dashboards:/var/lib/grafana/dashboards/hv-ves diff --git a/tools/performance/cloud/snapshot-loader/grafana/dashboards-providers/dashboard-providers.yaml b/tools/performance/cloud/snapshot-loader/grafana/dashboards-providers/dashboard-providers.yaml new file mode 100644 index 00000000..78da55c9 --- /dev/null +++ b/tools/performance/cloud/snapshot-loader/grafana/dashboards-providers/dashboard-providers.yaml @@ -0,0 +1,10 @@ +apiVersion: 1 + +providers: +- name: 'hv-ves-dashboards' + folder: '' + type: file + disableDeletion: false + updateIntervalSeconds: 10 + options: + path: /var/lib/grafana/dashboards/hv-ves
\ No newline at end of file diff --git a/tools/performance/cloud/snapshot-loader/grafana/datasources/prometheus.yaml b/tools/performance/cloud/snapshot-loader/grafana/datasources/prometheus.yaml new file mode 100644 index 00000000..80717b08 --- /dev/null +++ b/tools/performance/cloud/snapshot-loader/grafana/datasources/prometheus.yaml @@ -0,0 +1,11 @@ +apiVersion: 1 + +datasources: +- name: Prometheus + type: prometheus + access: proxy + url: http://prometheus:9090 + isDefault: true + editable: true + jsonData: + timeInterval: '5s' diff --git a/tools/performance/cloud/snapshot-loader/load-snapshot.sh b/tools/performance/cloud/snapshot-loader/load-snapshot.sh new file mode 100755 index 00000000..986c3c7f --- /dev/null +++ b/tools/performance/cloud/snapshot-loader/load-snapshot.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# ============LICENSE_START======================================================= +# dcaegen2-collectors-veshv +# ================================================================================ +# Copyright (C) 2020 NOKIA +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +SNAPSHOT_PATH=$1 +OPEN=$2 +if [ ! -d $SNAPSHOT_PATH ] || [ -v $SNAPSHOT_PATH ]; then + echo "Usage: ./load-snapshot.sh <PATH-TO-SNAPSHOT>" + echo "To automatically open links use: ./load-snapshot.sh <PATH-TO-SNAPSHOT> -o" + echo "Important: path to snapshot must point to prometheus timestamped folder" + echo "Example: ~/prometheus-snapshot/20200409T123412Z-2e3108dabb158644" + exit 1 +fi + +docker-compose down > /dev/null 2> /dev/null +mkdir -p current-snapshot +rm -rf current-snapshot > /dev/null 2> /dev/null +cp -r $SNAPSHOT_PATH/* ./current-snapshot/ +docker-compose up -d + +echo "Waiting for Grafana up..." +sleep 10 + +TIME=$(echo $SNAPSHOT_PATH | sed -r 's/(.*)Z-.*/\1/') +TIME=$(echo $TIME | sed -r 's/.*\/(.*)/\1/') +TIME=$(echo $TIME | sed -r 's/(.*)T(..)(..)(..)/\1 \2:\3:\4/') + +EPOCH_END=$(date +'%s' -u -d "$TIME") +EPOCH_DIFF_20MIN=1200 +EPOCH_START=$(expr $EPOCH_END - $EPOCH_DIFF_20MIN) +URL_TIME_ARG="from=${EPOCH_START}000&to=${EPOCH_END}000" + +GRAFANA_BASE_URL="http://localhost:3000/d/" +PROCESSING_DASHBOARD_URL=${GRAFANA_BASE_URL}"V94Kjlwmz/hv-ves-processing?orgId=1&"${URL_TIME_ARG} +PERFORMANCE_DASHBOARD_URL=${GRAFANA_BASE_URL}"ErPSMaIZk/performance-tests?orgId=1&"${URL_TIME_ARG} +KAFKA_PRODUCERS_DASHBOARD_URL=${GRAFANA_BASE_URL}"-28uHcjZk/kafka-and-producers-statistics?orgId=1&"${URL_TIME_ARG} +K8S_DASHBOARD_URL=${GRAFANA_BASE_URL}"RxjnWpjZk/k8s-metrics?orgId=1&"${URL_TIME_ARG} +CONNECTIONS_DASHBOARD_URL=${GRAFANA_BASE_URL}"bAy7xlwmk/hv-ves-connections?orgId=1&"${URL_TIME_ARG} +LATENCIES_DASHBOARD_URL=${GRAFANA_BASE_URL}"k22_V1qZk/latencies?orgId=1&"${URL_TIME_ARG} +echo "Dashboards:" +echo "HV-VES Processing:" ${PROCESSING_DASHBOARD_URL} +echo "Performance:" ${PERFORMANCE_DASHBOARD_URL} +echo "Kafka and producers statistics:" ${KAFKA_PRODUCERS_DASHBOARD_URL} +echo "K8s Metrics:" ${K8S_DASHBOARD_URL} +echo "Connections:" ${CONNECTIONS_DASHBOARD_URL} +echo "Latencies:" ${LATENCIES_DASHBOARD_URL} + +if [ "$OPEN" == "-o" ]; then + xdg-open ${PROCESSING_DASHBOARD_URL} + xdg-open ${PERFORMANCE_DASHBOARD_URL} + xdg-open ${KAFKA_PRODUCERS_DASHBOARD_URL} + xdg-open ${K8S_DASHBOARD_URL} + xdg-open ${CONNECTIONS_DASHBOARD_URL} + xdg-open ${LATENCIES_DASHBOARD_URL} +fi diff --git a/tools/performance/cloud/snapshot-loader/prometheus.yml b/tools/performance/cloud/snapshot-loader/prometheus.yml new file mode 100644 index 00000000..5239adc3 --- /dev/null +++ b/tools/performance/cloud/snapshot-loader/prometheus.yml @@ -0,0 +1,4 @@ +global: + scrape_interval: 5s + external_labels: + monitor: 'my-monitor' |