Merge lp:~brad-marshall/charms/trusty/memcached/add-monitors-relation into lp:charms/trusty/memcached

Proposed by Brad Marshall on 2015-11-09
Status: Merged
Merge reported by: Adam Israel
Merged at revision: not available
Proposed branch: lp:~brad-marshall/charms/trusty/memcached/add-monitors-relation
Merge into: lp:charms/trusty/memcached
Diff against target: 94 lines (+32/-8)
3 files modified
hooks/memcached_hooks.py (+20/-7)
metadata.yaml (+6/-1)
monitors.yaml (+6/-0)
To merge this branch: bzr merge lp:~brad-marshall/charms/trusty/memcached/add-monitors-relation
Reviewer Review Type Date Requested Status
Adam Israel 2015-11-09 Approve on 2016-03-02
Konstantinos Tsakalozos Needs Fixing on 2015-12-10
Review Queue (community) automated testing Needs Fixing on 2015-11-12
Review via email: mp+276958@code.launchpad.net

Description of the Change

Add support for local-monitor interface, this will allow using the nrpe and nagios charms.

To post a comment you must log in.

charm_lint_check #13367 memcached for brad-marshall mp276958
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/13207679/
Build: http://10.245.162.77:8080/job/charm_lint_check/13367/

charm_unit_test #12504 memcached for brad-marshall mp276958
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/12504/

Peter Sabaini (peter-sabaini) wrote :

2 minor comments inline

charm_amulet_test #7821 memcached for brad-marshall mp276958
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13207715/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7821/

Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-lxc/1390/

review: Needs Fixing (automated testing)
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-aws/1400/

review: Needs Fixing (automated testing)
72. By Brad Marshall on 2015-11-23

[bradm] Fix lint warnings, tidy up comments

charm_lint_check #14250 memcached for brad-marshall mp276958
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/13463175/
Build: http://10.245.162.77:8080/job/charm_lint_check/14250/

charm_unit_test #13281 memcached for brad-marshall mp276958
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/13281/

Brad Marshall (brad-marshall) wrote :

Updated to fix the lint problems I caused, and some other minor issues. The test failures are pre-existing, nothing to do with my changes best I can tell.

charm_amulet_test #8013 memcached for brad-marshall mp276958
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/13476838/
Build: http://10.245.162.77:8080/job/charm_amulet_test/8013/

The charm tests fail because the firewall blocks port 11214 of memcached while the tests try to telnet there. The newly created bug https://bugs.launchpad.net/charms/+source/memcached/+bug/1525026 has all the details for this issue.

The above bug is not directly related to the patch proposed here. However, at this point there is no proper way to verify that we do not break something. Also, there is no test dedicated to the added functionality.

review: Needs Fixing
Adam Israel (aisrael) wrote :

Hi Brad,

I'm happy to report that the blocking bug, lp:1525026, has been addressed. With that in place, your tests now pass.

We'd still like to have tests for the new functionality, but I won't block on that.

Thanks for your work towards improving this charm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added symlink 'hooks/local-monitors-relation-changed'
2=== target is u'memcached_hooks.py'
3=== modified file 'hooks/memcached_hooks.py'
4--- hooks/memcached_hooks.py 2015-07-22 20:37:00 +0000
5+++ hooks/memcached_hooks.py 2015-11-23 00:13:51 +0000
6@@ -14,6 +14,7 @@
7 relation_get,
8 relation_set,
9 unit_get,
10+ hook_name,
11 Hooks,
12 UnregisteredHookError,
13 )
14@@ -287,6 +288,8 @@
15
16
17 @hooks.hook('nrpe-external-master-relation-changed')
18+@hooks.hook('monitors-relation-changed')
19+@hooks.hook('local-monitors-relation-changed')
20 @restart_on_change(RESTART_MAP)
21 def nrpe_external_master_relation_changed():
22
23@@ -296,9 +299,10 @@
24 ufw.service('5666', 'open')
25 open_port('5666')
26
27- # make sure rsync port is open for check collection by external master
28- ufw.service('873/tcp', 'open')
29- open_port('873')
30+ if ('nrpe-external-master' in hook_name()):
31+ # make sure rsync port is open for check collection by external master
32+ ufw.service('873/tcp', 'open')
33+ open_port('873')
34
35 if not os.path.isdir(LOCAL_NAGIOS_PLUGINS):
36 os.makedirs(LOCAL_NAGIOS_PLUGINS)
37@@ -319,10 +323,19 @@
38 templating.render('nrpe_check_memcached.cfg.tmpl',
39 '/etc/nagios/nrpe.d/check_memcached.cfg',
40 configs)
41- templating.render('nrpe_export.cfg.tmpl',
42- ('/var/lib/nagios/export/service__{}_check_'
43- 'memcached.cfg').format(nagios_hostname),
44- configs)
45+
46+ if ('nrpe-external-master' in hook_name()):
47+ templating.render('nrpe_export.cfg.tmpl',
48+ ('/var/lib/nagios/export/service__{}_check_'
49+ 'memcached.cfg').format(nagios_hostname),
50+ configs)
51+
52+ if ('monitors' in hook_name()):
53+ with open('monitors.yaml') as mon_file:
54+ mon_data = mon_file.read()
55+
56+ relation_set(monitors=mon_data, target_id=nagios_hostname,
57+ target_address=unit_get('private-address'))
58
59 service_reload('nagios-nrpe-server')
60
61
62=== added symlink 'hooks/monitors-relation-changed'
63=== target is u'memcached_hooks.py'
64=== modified file 'metadata.yaml'
65--- metadata.yaml 2015-02-12 22:13:27 +0000
66+++ metadata.yaml 2015-11-23 00:13:51 +0000
67@@ -14,9 +14,14 @@
68 interface: memcache
69 munin:
70 interface: munin-node
71+ monitors:
72+ interface: monitors
73+ local-monitors:
74+ interface: local-monitors
75+ scope: container
76 nrpe-external-master:
77 interface: nrpe-external-master
78 scope: container
79 peers:
80 cluster:
81- interface: memcached-replication
82\ No newline at end of file
83+ interface: memcached-replication
84
85=== added file 'monitors.yaml'
86--- monitors.yaml 1970-01-01 00:00:00 +0000
87+++ monitors.yaml 2015-11-23 00:13:51 +0000
88@@ -0,0 +1,6 @@
89+version: '0.3'
90+monitors:
91+ remote:
92+ nrpe:
93+ memcached:
94+ command: check_memcached

Subscribers

People subscribed via source and target branches