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

Proposed by Jacek Nykis
Status: Merged
Approved by: Laurent Sesquès
Approved revision: no longer in the source branch.
Merged at revision: 110
Proposed branch: lp:~jacekn/mojo/mojo-specs
Merge into: lp:mojo/mojo-specs
Diff against target: 155 lines (+103/-25)
2 files modified
charm-testing/prometheus2/helpers (+17/-0)
charm-testing/prometheus2/post-deploy (+86/-25)
To merge this branch: bzr merge lp:~jacekn/mojo/mojo-specs
Reviewer Review Type Date Requested Status
Laurent Sesquès Approve
Review via email: mp+349005@code.launchpad.net

Commit message

Improve prometheus verification script. Add symlinks to allow upgrade-charm testing for prometheus-alertmanager, prometheus-blackbox-exporter, prometheus-pushgateway and prometheus-snmp-exporter

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Laurent Sesquès (sajoupa) wrote :

+1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 110

lp:~jacekn/mojo/mojo-specs updated
110. By Jacek Nykis

Improve prometheus verification script. Add symlinks to allow upgrade-charm testing for prometheus-alertmanager, prometheus-blackbox-exporter, prometheus-pushgateway and prometheus-snmp-exporter

Reviewed-on: https://code.launchpad.net/~jacekn/mojo/mojo-specs/+merge/349005
Reviewed-by: Laurent Sesques <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added symlink 'charm-testing/prometheus-alertmanager'
2=== target is u'prometheus2'
3=== added symlink 'charm-testing/prometheus-blackbox-exporter'
4=== target is u'prometheus2'
5=== added symlink 'charm-testing/prometheus-pushgateway'
6=== target is u'prometheus2'
7=== added symlink 'charm-testing/prometheus-snmp-exporter'
8=== target is u'prometheus2'
9=== added file 'charm-testing/prometheus2/helpers'
10--- charm-testing/prometheus2/helpers 1970-01-01 00:00:00 +0000
11+++ charm-testing/prometheus2/helpers 2018-07-05 14:12:29 +0000
12@@ -0,0 +1,17 @@
13+function get_units() {
14+ service=${1}
15+ INSTANCES=$(juju status --format=yaml ${service} 2>&1 | sed -nr '/^ {8}public-address/s/.*://p')
16+
17+ if [ -z "${INSTANCES}" ]; then
18+ echo "No ${service} instances found"
19+ exit 1
20+ fi
21+ echo ${INSTANCES}
22+}
23+
24+function fail() {
25+ echo "####################"
26+ echo "# E2E Check Failed #"
27+ echo "####################"
28+ exit 1
29+}
30
31=== modified file 'charm-testing/prometheus2/post-deploy'
32--- charm-testing/prometheus2/post-deploy 2018-06-28 12:27:42 +0000
33+++ charm-testing/prometheus2/post-deploy 2018-07-05 14:12:29 +0000
34@@ -1,35 +1,96 @@
35 #!/bin/bash
36
37-PROMETHEUS=$(juju status --format=yaml prometheus2 2>&1 | sed -nr '/^ {8}public-address/s/.*://p')
38-
39-if [ -z "${PROMETHEUS}" ]; then
40- echo "No prometheus2 instances"
41- exit 1
42-fi
43-
44-for UNIT in ${PROMETHEUS}; do
45-
46- echo "Calling unit to ensure it returns: 'up' metrics"
47- echo 'curl -f -s -S -v http://${UNIT}:9090/api/v1/query?query=up'
48+. helpers
49+
50+##################################
51+# prometheus2 verification
52+##################################
53+for UNIT in $(get_units prometheus2); do
54+ echo -e "####\n# Calling unit to ensure it returns: 'up' metrics"
55 curl -f -s -S -v http://${UNIT}:9090/api/v1/query?query=up
56 if [ $? -ne 0 ]; then
57- echo "####################"
58- echo "# E2E Check Failed #"
59- echo "####################"
60- exit 1
61+ fail
62 fi
63- echo "Calling unit to ensure telegraf targets were registered correctly"
64- echo 'curl -f -s -S -g http://${UNIT}:9090/api/v1/query?query=up{job=\"telegraf\"}|grep telegraf'
65+
66+ echo -e "\n####\n# Calling unit to ensure telegraf targets were registered correctly"
67 curl -f -s -S -g http://${UNIT}:9090/api/v1/query?query=up{job=\"telegraf\"}|grep telegraf
68 if [ $? -ne 0 ]; then
69- echo "####################"
70- echo "# E2E Check Failed #"
71- echo "####################"
72- exit 1
73- fi
74-done
75-
76-# If we are here it means no checks failed
77+ fail
78+ fi
79+
80+ echo -e "\n####\n# Calling unit to ensure pushgateway was registered correctly"
81+ curl -f -s -S -g http://${UNIT}:9090/api/v1/query?query=up{job=\"prometheus-pushgateway\"}|grep prometheus-pushgateway
82+ if [ $? -ne 0 ]; then
83+ fail
84+ fi
85+
86+ echo -e "\n####\n# Calling unit to ensure alertmanager was registered correctly"
87+ curl -f -s -S -g http://${UNIT}:9090/api/v1/query?query=prometheus_notifications_alertmanagers_discovered==1|grep value
88+ if [ $? -ne 0 ]; then
89+ fail
90+ fi
91+done
92+
93+##################################
94+# alertmanager
95+##################################
96+for UNIT in $(get_units prometheus-alertmanager); do
97+ echo -e "####\n# Checking alertmanager"
98+ curl -f -s -S -g http://${UNIT}:9093/metrics|grep alertmanager_build_info
99+ if [ $? -ne 0 ]; then
100+ fail
101+ fi
102+done
103+
104+##################################
105+# pushgateway
106+##################################
107+for UNIT in $(get_units prometheus-pushgateway); do
108+ echo -e "####\n# Checking pushgateway"
109+ curl -f -s -S -g http://${UNIT}:9091/metrics|grep pushgateway_build_info
110+ if [ $? -ne 0 ]; then
111+ fail
112+ fi
113+done
114+
115+##################################
116+# snmp-exporter
117+##################################
118+for UNIT in $(get_units prometheus-snmp-exporter); do
119+ echo -e "####\n# Checking snmp-exporter"
120+ curl -f -s -S -g http://${UNIT}:9116/metrics|grep snmp_exporter_build_info
121+ if [ $? -ne 0 ]; then
122+ fail
123+ fi
124+done
125+
126+##################################
127+# blackbox-exporter
128+##################################
129+for UNIT in $(get_units prometheus-blackbox-exporter); do
130+ echo -e "####\n# Checking blackbox-exporter"
131+ curl -f -s -S -g http://${UNIT}:9115/metrics|grep blackbox_exporter_build_info
132+ if [ $? -ne 0 ]; then
133+ fail
134+ fi
135+done
136+
137+##################################
138+# grafana
139+##################################
140+for UNIT in $(get_units grafana); do
141+ echo -e "####\n# Checking grafana"
142+ curl -f -s -S -g http://${UNIT}:3000/metrics|grep grafana_info
143+ if [ $? -ne 0 ]; then
144+ fail
145+ fi
146+ curl -f -s -S -g http://${UNIT}:3000/|grep "<title>Grafana</title>"
147+ if [ $? -ne 0 ]; then
148+ fail
149+ fi
150+done
151+
152+# If we are here it means all checks passed
153 echo "#####################"
154 echo "# E2E Checks Passed #"
155 echo "#####################"

Subscribers

People subscribed via source and target branches

to all changes: