Merge ~barryprice/content-cache-charm/+git/content-cache-charm:master into content-cache-charm:master

Proposed by Barry Price
Status: Merged
Approved by: Haw Loeung
Approved revision: 766c7b73e28ea5490e53f123b498ab67f27a804f
Merged at revision: 55c25f92a32e3fdbc8c9a4f013045a374365a0fc
Proposed branch: ~barryprice/content-cache-charm/+git/content-cache-charm:master
Merge into: content-cache-charm:master
Diff against target: 352 lines (+115/-100)
2 files modified
reactive/content_cache.py (+15/-5)
tests/unit/test_content_cache.py (+100/-95)
Reviewer Review Type Date Requested Status
Haw Loeung Approve
Canonical IS Reviewers Pending
Review via email: mp+369850@code.launchpad.net

Commit message

Amend our nrpe add_check syntax to match charmhelpers recent change:

https://github.com/juju/charm-helpers/pull/311/

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
Haw Loeung (hloeung) wrote :

LGTM, +1

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

Change successfully merged at revision 55c25f92a32e3fdbc8c9a4f013045a374365a0fc

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/reactive/content_cache.py b/reactive/content_cache.py
2index ba8fa43..4459698 100644
3--- a/reactive/content_cache.py
4+++ b/reactive/content_cache.py
5@@ -297,7 +297,11 @@ def configure_nagios():
6 site=site, port=frontend_port, method=method, url=url, path=path, token=token, tls=tlsrev
7 )
8 )
9- nrpe_setup.add_check(check_name, '{} confirm obsolete TLS v{} denied'.format(site, tlsrev), cmd)
10+ nrpe_setup.add_check(
11+ shortname=check_name,
12+ description='{} confirm obsolete TLS v{} denied'.format(site, tlsrev),
13+ check_cmd=cmd,
14+ )
15
16 # Listen / frontend check
17 check_name = utils.generate_nagios_check_name(nagios_name, 'site', 'listen')
18@@ -309,7 +313,7 @@ def configure_nagios():
19 )
20 if 'nagios-expect' in loc_conf:
21 cmd = '{cmd} --expect="{expected}"'.format(cmd=cmd, expected=loc_conf['nagios-expect'])
22- nrpe_setup.add_check(check_name, '{} site listen check'.format(site), cmd)
23+ nrpe_setup.add_check(shortname=check_name, description='{} site listen check'.format(site), check_cmd=cmd)
24
25 # Cache layer check
26 check_name = utils.generate_nagios_check_name(nagios_name, 'site', 'cache')
27@@ -321,7 +325,7 @@ def configure_nagios():
28 )
29 if 'nagios-expect' in loc_conf:
30 cmd = '{cmd} --expect="{expected}"'.format(cmd=cmd, expected=loc_conf['nagios-expect'])
31- nrpe_setup.add_check(check_name, '{} cache check'.format(site), cmd)
32+ nrpe_setup.add_check(shortname=check_name, description='{} cache check'.format(site), check_cmd=cmd)
33
34 if backend_port:
35 # Backend proxy layer check; no token needs to be passed here as it's
36@@ -333,7 +337,9 @@ def configure_nagios():
37 site=site, backend_port=backend_port, method=method, url=url, path=path
38 )
39 )
40- nrpe_setup.add_check(check_name, '{} backend proxy check'.format(site), cmd)
41+ nrpe_setup.add_check(
42+ shortname=check_name, description='{} backend proxy check'.format(site), check_cmd=cmd
43+ )
44
45 nrpe_setup.write()
46 reactive.set_flag('nagios-nrpe.configured')
47@@ -358,7 +364,11 @@ def advertise_stats_endpoint():
48 def check_haproxy_alerts():
49 nrpe_setup = nrpe.NRPE(hostname=nrpe.get_nagios_hostname(), primary=True)
50 cmd = '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -p 9103 -u /metrics -r "haproxy_rate"'
51- nrpe_setup.add_check('haproxy_telegraf_metrics', 'Verify haproxy metrics are visible via telegraf subordinate', cmd)
52+ nrpe_setup.add_check(
53+ shortname='haproxy_telegraf_metrics',
54+ description='Verify haproxy metrics are visible via telegraf subordinate',
55+ check_cmd=cmd,
56+ )
57 nrpe_setup.write()
58 reactive.set_flag('nagios-nrpe-telegraf.configured')
59
60diff --git a/tests/unit/test_content_cache.py b/tests/unit/test_content_cache.py
61index eea9709..280ca2d 100644
62--- a/tests/unit/test_content_cache.py
63+++ b/tests/unit/test_content_cache.py
64@@ -319,21 +319,21 @@ site1.local:
65
66 want = [
67 mock.call(
68- 'site_site1_local_listen',
69- 'site1.local site listen check',
70- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site1.local -p 80 -j HEAD'
71+ shortname='site_site1_local_listen',
72+ description='site1.local site listen check',
73+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site1.local -p 80 -j HEAD'
74 ' -u http://site1.local/?token=1868572800_4eb30fc94f247635f7ed445083a4783862ad58de',
75 ),
76 mock.call(
77- 'site_site1_local_cache',
78- 'site1.local cache check',
79- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site1.local -p 6080 -j HEAD'
80+ shortname='site_site1_local_cache',
81+ description='site1.local cache check',
82+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site1.local -p 6080 -j HEAD'
83 ' -u http://site1.local/?token=1868572800_4eb30fc94f247635f7ed445083a4783862ad58de',
84 ),
85 mock.call(
86- 'site_site1_local_backend_proxy',
87- 'site1.local backend proxy check',
88- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site1.local -p 8080 -j HEAD'
89+ shortname='site_site1_local_backend_proxy',
90+ description='site1.local backend proxy check',
91+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site1.local -p 8080 -j HEAD'
92 ' -u http://site1.local/',
93 ),
94 ]
95@@ -341,81 +341,81 @@ site1.local:
96
97 want = [
98 mock.call(
99- 'site_site2_local_no_tls_1',
100- 'site2.local confirm obsolete TLS v1 denied',
101- '/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local'
102- ' -p 443 --ssl=1 --sni -j GET -u https://site2.local/check/',
103+ shortname='site_site2_local_no_tls_1',
104+ description='site2.local confirm obsolete TLS v1 denied',
105+ check_cmd='/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1'
106+ ' -H site2.local -p 443 --ssl=1 --sni -j GET -u https://site2.local/check/',
107 ),
108 mock.call(
109- 'site_site2_local_no_tls_1_1',
110- 'site2.local confirm obsolete TLS v1.1 denied',
111- '/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local'
112- ' -p 443 --ssl=1.1 --sni -j GET -u https://site2.local/check/',
113+ shortname='site_site2_local_no_tls_1_1',
114+ description='site2.local confirm obsolete TLS v1.1 denied',
115+ check_cmd='/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1'
116+ ' -H site2.local -p 443 --ssl=1.1 --sni -j GET -u https://site2.local/check/',
117 ),
118 mock.call(
119- 'site_site2_local_listen',
120- 'site2.local site listen check',
121- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 443 --ssl=1.2 --sni'
122+ shortname='site_site2_local_listen',
123+ description='site2.local site listen check',
124+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 443 --ssl=1.2 --sni'
125 ' -j GET -u https://site2.local/check/',
126 ),
127 mock.call(
128- 'site_site2_local_cache',
129- 'site2.local cache check',
130- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 6081 -j GET'
131+ shortname='site_site2_local_cache',
132+ description='site2.local cache check',
133+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 6081 -j GET'
134 ' -u https://site2.local/check/',
135 ),
136 mock.call(
137- 'site_site2_local_backend_proxy',
138- 'site2.local backend proxy check',
139- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 8081 -j GET'
140+ shortname='site_site2_local_backend_proxy',
141+ description='site2.local backend proxy check',
142+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 8081 -j GET'
143 ' -u https://site2.local/check/',
144 ),
145 mock.call(
146- 'site_site2_local_my_local_content_no_tls_1',
147- 'site2.local confirm obsolete TLS v1 denied',
148- '/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local'
149- ' -p 443 --ssl=1 --sni -j HEAD -u https://site2.local/my-local-content/',
150+ shortname='site_site2_local_my_local_content_no_tls_1',
151+ description='site2.local confirm obsolete TLS v1 denied',
152+ check_cmd='/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1'
153+ ' -H site2.local -p 443 --ssl=1 --sni -j HEAD -u https://site2.local/my-local-content/',
154 ),
155 mock.call(
156- 'site_site2_local_my_local_content_no_tls_1_1',
157- 'site2.local confirm obsolete TLS v1.1 denied',
158- '/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local'
159- ' -p 443 --ssl=1.1 --sni -j HEAD -u https://site2.local/my-local-content/',
160+ shortname='site_site2_local_my_local_content_no_tls_1_1',
161+ description='site2.local confirm obsolete TLS v1.1 denied',
162+ check_cmd='/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1'
163+ ' -H site2.local -p 443 --ssl=1.1 --sni -j HEAD -u https://site2.local/my-local-content/',
164 ),
165 mock.call(
166- 'site_site2_local_my_local_content_listen',
167- 'site2.local site listen check',
168- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 443 --ssl=1.2 --sni -j HEAD'
169- ' -u https://site2.local/my-local-content/',
170+ shortname='site_site2_local_my_local_content_listen',
171+ description='site2.local site listen check',
172+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 443 --ssl=1.2'
173+ ' --sni -j HEAD -u https://site2.local/my-local-content/',
174 ),
175 mock.call(
176- 'site_site2_local_my_local_content_cache',
177- 'site2.local cache check',
178- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 6081 -j HEAD'
179+ shortname='site_site2_local_my_local_content_cache',
180+ description='site2.local cache check',
181+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 6081 -j HEAD'
182 ' -u https://site2.local/my-local-content/',
183 ),
184 mock.call(
185- 'site_site2_local_my_local_content2_no_tls_1',
186- 'site2.local confirm obsolete TLS v1 denied',
187- '/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local'
188- ' -p 443 --ssl=1 --sni -j HEAD -u https://site2.local/my-local-content2/',
189+ shortname='site_site2_local_my_local_content2_no_tls_1',
190+ description='site2.local confirm obsolete TLS v1 denied',
191+ check_cmd='/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1'
192+ ' -H site2.local -p 443 --ssl=1 --sni -j HEAD -u https://site2.local/my-local-content2/',
193 ),
194 mock.call(
195- 'site_site2_local_my_local_content2_no_tls_1_1',
196- 'site2.local confirm obsolete TLS v1.1 denied',
197- '/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local'
198- ' -p 443 --ssl=1.1 --sni -j HEAD -u https://site2.local/my-local-content2/',
199+ shortname='site_site2_local_my_local_content2_no_tls_1_1',
200+ description='site2.local confirm obsolete TLS v1.1 denied',
201+ check_cmd='/usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_http -I 127.0.0.1'
202+ ' -H site2.local -p 443 --ssl=1.1 --sni -j HEAD -u https://site2.local/my-local-content2/',
203 ),
204 mock.call(
205- 'site_site2_local_my_local_content2_listen',
206- 'site2.local site listen check',
207- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 443 --ssl=1.2 --sni -j HEAD'
208- ' -u https://site2.local/my-local-content2/',
209+ shortname='site_site2_local_my_local_content2_listen',
210+ description='site2.local site listen check',
211+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 443 --ssl=1.2 --sni'
212+ ' -j HEAD -u https://site2.local/my-local-content2/',
213 ),
214 mock.call(
215- 'site_site2_local_my_local_content2_cache',
216- 'site2.local cache check',
217- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 6081 -j HEAD'
218+ shortname='site_site2_local_my_local_content2_cache',
219+ description='site2.local cache check',
220+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site2.local -p 6081 -j HEAD'
221 ' -u https://site2.local/my-local-content2/',
222 ),
223 ]
224@@ -423,21 +423,21 @@ site1.local:
225
226 want = [
227 mock.call(
228- 'site_site3_local_listen',
229- 'site3.local site listen check',
230- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site3.local -p 80 -j HEAD'
231+ shortname='site_site3_local_listen',
232+ description='site3.local site listen check',
233+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site3.local -p 80 -j HEAD'
234 ' -u http://site3.local/',
235 ),
236 mock.call(
237- 'site_site3_local_cache',
238- 'site3.local cache check',
239- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site3.local -p 6082 -j HEAD'
240+ shortname='site_site3_local_cache',
241+ description='site3.local cache check',
242+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site3.local -p 6082 -j HEAD'
243 ' -u http://site3.local/',
244 ),
245 mock.call(
246- 'site_site3_local_backend_proxy',
247- 'site3.local backend proxy check',
248- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site3.local -p 8082 -j HEAD'
249+ shortname='site_site3_local_backend_proxy',
250+ description='site3.local backend proxy check',
251+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site3.local -p 8082 -j HEAD'
252 ' -u http://site3.local/',
253 ),
254 ]
255@@ -445,27 +445,27 @@ site1.local:
256
257 want = [
258 mock.call(
259- 'site_site4_local_listen',
260- 'site4.local site listen check',
261- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 80 -j HEAD'
262+ shortname='site_site4_local_listen',
263+ description='site4.local site listen check',
264+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 80 -j HEAD'
265 ' -u http://site4.local/',
266 ),
267 mock.call(
268- 'site_site4_local_cache',
269- 'site4.local cache check',
270- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 6083 -j HEAD'
271+ shortname='site_site4_local_cache',
272+ description='site4.local cache check',
273+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 6083 -j HEAD'
274 ' -u http://site4.local/',
275 ),
276 mock.call(
277- 'site_site4_local_ubuntupool_listen',
278- 'site4.local site listen check',
279- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 80 -j HEAD'
280+ shortname='site_site4_local_ubuntupool_listen',
281+ description='site4.local site listen check',
282+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 80 -j HEAD'
283 ' -u http://site4.local/ubuntu/pool/',
284 ),
285 mock.call(
286- 'site_site4_local_ubuntupool_cache',
287- 'site4.local cache check',
288- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 6083 -j HEAD'
289+ shortname='site_site4_local_ubuntupool_cache',
290+ description='site4.local cache check',
291+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site4.local -p 6083 -j HEAD'
292 ' -u http://site4.local/ubuntu/pool/',
293 ),
294 ]
295@@ -473,34 +473,39 @@ site1.local:
296
297 want = [
298 mock.call(
299- 'site_site5_listen',
300- 'site5 site listen check',
301- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 80 -j HEAD' ' -u http://site5/',
302+ shortname='site_site5_listen',
303+ description='site5 site listen check',
304+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 80 -j HEAD' ' -u http://site5/',
305 ),
306 mock.call(
307- 'site_site5_cache',
308- 'site5 cache check',
309- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 6084 -j HEAD' ' -u http://site5/',
310+ shortname='site_site5_cache',
311+ description='site5 cache check',
312+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 6084 -j HEAD'
313+ ' -u http://site5/',
314 ),
315 mock.call(
316- 'site_site5_backend_proxy',
317- 'site5 backend proxy check',
318- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 8083 -j HEAD' ' -u http://site5/',
319+ shortname='site_site5_backend_proxy',
320+ description='site5 backend proxy check',
321+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 8083 -j HEAD'
322+ ' -u http://site5/',
323 ),
324 mock.call(
325- 'site_site5_auth_listen',
326- 'site5 site listen check',
327- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 80 -j HEAD' ' -u http://site5/auth',
328+ shortname='site_site5_auth_listen',
329+ description='site5 site listen check',
330+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 80 -j HEAD'
331+ ' -u http://site5/auth',
332 ),
333 mock.call(
334- 'site_site5_auth_cache',
335- 'site5 cache check',
336- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 6084 -j HEAD' ' -u http://site5/auth',
337+ shortname='site_site5_auth_cache',
338+ description='site5 cache check',
339+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 6084 -j HEAD'
340+ ' -u http://site5/auth',
341 ),
342 mock.call(
343- 'site_site5_auth_backend_proxy',
344- 'site5 backend proxy check',
345- '/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 8084 -j HEAD' ' -u http://site5/auth',
346+ shortname='site_site5_auth_backend_proxy',
347+ description='site5 backend proxy check',
348+ check_cmd='/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -H site5 -p 8084 -j HEAD'
349+ ' -u http://site5/auth',
350 ),
351 ]
352 self.assertFalse(nrpe_instance_mock.add_check.assert_has_calls(want, any_order=True))

Subscribers

People subscribed via source and target branches