Merge lp:~tcuthbert/mojo/mojo-specs into lp:mojo/mojo-specs

Proposed by Thomas Cuthbert
Status: Merged
Approved by: Haw Loeung
Approved revision: no longer in the source branch.
Merged at revision: 63
Proposed branch: lp:~tcuthbert/mojo/mojo-specs
Merge into: lp:mojo/mojo-specs
Diff against target: 62 lines (+47/-0)
3 files modified
charm-testing/prometheus/collect (+5/-0)
charm-testing/prometheus/deploy (+16/-0)
charm-testing/prometheus/post-deploy (+26/-0)
To merge this branch: bzr merge lp:~tcuthbert/mojo/mojo-specs
Reviewer Review Type Date Requested Status
Haw Loeung Approve
Review via email: mp+336416@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM, +1

review: Approve
lp:~tcuthbert/mojo/mojo-specs updated
63. By Haw Loeung

[tcuthbert] charm-testing: Initial commit of prometheus charm testing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'charm-testing/prometheus'
2=== added file 'charm-testing/prometheus/collect'
3--- charm-testing/prometheus/collect 1970-01-01 00:00:00 +0000
4+++ charm-testing/prometheus/collect 2018-01-23 00:08:31 +0000
5@@ -0,0 +1,5 @@
6+# Services, primary charms
7+prometheus cs:prometheus
8+
9+# subordinates
10+nrpe cs:nrpe
11
12=== added file 'charm-testing/prometheus/deploy'
13--- charm-testing/prometheus/deploy 1970-01-01 00:00:00 +0000
14+++ charm-testing/prometheus/deploy 2018-01-23 00:08:31 +0000
15@@ -0,0 +1,16 @@
16+prometheus:
17+ series: {{series}}
18+ services:
19+ prometheus:
20+ charm: prometheus
21+ expose: true
22+ options:
23+ prometheus_registration_authtoken: "testing"
24+ external_url: "http://prometheus.testing.local/"
25+ nrpe:
26+ charm: nrpe
27+ {% if series == "xenial" %}options:
28+ swap: '-w 90% -c 75% -n OK'{% endif %}
29+
30+ relations:
31+ - ["prometheus:nrpe-external-master", "nrpe:nrpe-external-master"]
32
33=== added file 'charm-testing/prometheus/post-deploy'
34--- charm-testing/prometheus/post-deploy 1970-01-01 00:00:00 +0000
35+++ charm-testing/prometheus/post-deploy 2018-01-23 00:08:31 +0000
36@@ -0,0 +1,26 @@
37+#!/bin/bash
38+
39+PROMETHEUS=$(juju status --format=yaml prometheus 2>&1 | sed -nr '/^ {8}public-address/s/.*://p')
40+
41+if [ -z "${PROMETHEUS}" ]; then
42+ echo "No prometheus instances"
43+ exit 1
44+fi
45+
46+for UNIT in ${PROMETHEUS}; do
47+
48+ echo "Calling unit to ensure it returns: 'up' metrics"
49+ echo 'curl -f -s -S -v http://${UNIT}:9090/api/v1/query?query=up'
50+ curl -f -s -S -v http://${UNIT}:9090/api/v1/query?query=up
51+ if [ $? -ne 0 ]; then
52+ echo "####################"
53+ echo "# E2E Check Failed #"
54+ echo "####################"
55+ exit 1
56+ fi
57+done
58+
59+# If we are here it means no checks failed
60+echo "####################"
61+echo "# E2E Check Passed #"
62+echo "####################"

Subscribers

People subscribed via source and target branches

to all changes: