From 4535216267bf571468765819760b175d4461a0b1 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Fri, 31 Jan 2020 08:22:01 -0700 Subject: [PATCH] qa/workunits/cephadm/test_cephadm.sh: add missing monitoring tests add tests for node-exporter, prometheus, and grafana Signed-off-by: Michael Fritch --- qa/workunits/cephadm/test_cephadm.sh | 30 +++++++++++++++++++++++++++- src/cephadm/samples/grafana.json | 6 +++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/qa/workunits/cephadm/test_cephadm.sh b/qa/workunits/cephadm/test_cephadm.sh index ba1af134061..973d2c18a16 100755 --- a/qa/workunits/cephadm/test_cephadm.sh +++ b/qa/workunits/cephadm/test_cephadm.sh @@ -24,10 +24,13 @@ OSD_TO_CREATE=6 OSD_VG_NAME=${SCRIPT_NAME%.*} OSD_LV_NAME=${SCRIPT_NAME%.*} +CEPHADM_SRC_DIR=${SCRIPT_DIR}/../../../src/cephadm +CEPHADM_SAMPLES_DIR=${CEPHADM_SRC_DIR}/samples + [ -z "$SUDO" ] && SUDO=sudo if [ -z "$CEPHADM" ]; then - CEPHADM=${SCRIPT_DIR}/../../../src/cephadm/cephadm + CEPHADM=${CEPHADM_SRC_DIR}/cephadm fi # at this point, we need $CEPHADM set @@ -204,6 +207,31 @@ for id in `seq 0 $((--OSD_TO_CREATE))`; do $(hostname):/dev/$OSD_VG_NAME/$OSD_LV_NAME.$id done +# add node-exporter +$CEPHADM --image 'prom/node-exporter:latest' \ + deploy --name node-exporter.a --fsid $FSID +sleep 90 +out=$(curl 'http://localhost:9100') +echo $out | grep -q 'Node Exporter' + +# add prometheus +cat ${CEPHADM_SAMPLES_DIR}/prometheus.json | \ + $CEPHADM --image 'prom/prometheus:latest' \ + deploy --name prometheus.a --fsid $FSID \ + --config-json - +sleep 90 +out=$(curl 'localhost:9095/api/v1/query?query=up') +echo $out | jq -e '.["status"] == "success"' + +# add grafana +cat ${CEPHADM_SAMPLES_DIR}/grafana.json | \ + $CEPHADM --image 'pcuzner/ceph-grafana-el8:latest' \ + deploy --name grafana.a --fsid $FSID \ + --config-json - +sleep 90 +out=$(curl --insecure option 'https://localhost:3000') +echo $out | grep -q 'grafana' + ## run # WRITE ME diff --git a/src/cephadm/samples/grafana.json b/src/cephadm/samples/grafana.json index 36f6e43b6ad..bda4887cdbf 100644 --- a/src/cephadm/samples/grafana.json +++ b/src/cephadm/samples/grafana.json @@ -12,7 +12,7 @@ " cert_file = /etc/grafana/certs/cert_file", " cert_key = /etc/grafana/certs/cert_key", " http_port = 3000", - " http_addr = 10.90.90.150", + " http_addr = localhost", "[security]", " admin_user = admin", " admin_password = admin", @@ -28,7 +28,7 @@ " type: 'prometheus'", " access: 'proxy'", " orgId: 1", - " url: 'http://10.90.90.150:9095'", + " url: 'http://localhost:9095'", " basicAuth: false", " isDefault: true", " editable: false" @@ -85,4 +85,4 @@ "mEl75h1ToBX9yvnH39o50g==", "-----END PRIVATE KEY-----" ] -} \ No newline at end of file +} -- 2.39.5