From 8b726e7350ce100ebf15e2ad308188309b06e31c Mon Sep 17 00:00:00 2001 From: Laura Paduano Date: Wed, 5 Feb 2020 16:27:58 +0100 Subject: [PATCH] ceph-dashboard-* jobs: Install Prometheus and Alertmanager In order to test the alert configuration within the dashboard (e2e tests) we need to have Prometheus and Alertmanager running on the system. Added a new script which takes care of the installation and running Prometheus and Alertmanager in the background. Added the script only to the dashboard e2e Jenkins job (for the time being), the processes will be killed at the end of the job. Signed-off-by: Laura Paduano --- .../ceph-dashboard-pull-requests.yml | 2 ++ .../install-prometheus-and-alertmanager.sh | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 scripts/dashboard/install-prometheus-and-alertmanager.sh diff --git a/ceph-dashboard-pull-requests/config/definitions/ceph-dashboard-pull-requests.yml b/ceph-dashboard-pull-requests/config/definitions/ceph-dashboard-pull-requests.yml index 94f247a4e..ec4629a62 100644 --- a/ceph-dashboard-pull-requests/config/definitions/ceph-dashboard-pull-requests.yml +++ b/ceph-dashboard-pull-requests/config/definitions/ceph-dashboard-pull-requests.yml @@ -62,4 +62,6 @@ - shell: !include-raw: - ../../../scripts/dashboard/install-e2e-test-deps.sh + - ../../../scripts/dashboard/install-prometheus-and-alertmanager.sh - shell: "cd src/pybind/mgr/dashboard; timeout 7200 ./run-frontend-e2e-tests.sh" + - shell: pkill prometheus && pkill alertmanager diff --git a/scripts/dashboard/install-prometheus-and-alertmanager.sh b/scripts/dashboard/install-prometheus-and-alertmanager.sh new file mode 100644 index 000000000..9c27486bc --- /dev/null +++ b/scripts/dashboard/install-prometheus-and-alertmanager.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -ex + +# Install and run Prometheus +# Use $WORKSPACE dir since it will be wiped after the job has completed +cd $WORKSPACE +sudo mkdir prometheus +cd prometheus +sudo curl -LO https://github.com/prometheus/prometheus/releases/download/v2.15.2/prometheus-2.15.2.linux-amd64.tar.gz +sudo tar xf prometheus-2.15.2.linux-amd64.tar.gz +cd prometheus-2.15.2.linux-amd64 + +sudo ./prometheus & + +cd $WORKDIR + +# Install and run Alertmanager +sudo mkdir alertmanager +cd alertmanager +sudo curl -LO https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz +sudo tar xf alertmanager-0.20.0.linux-amd64.tar.gz +cd alertmanager-0.20.0.linux-amd64 + +sudo ./alertmanager & + +# "pkill prometheus" and "pkill alertmanager" must be executed in the Jenkins job that uses this script