Merge lp:~facundo/charms/trusty/tanuki-message-hub/add-nagios-support into lp:~tanuki/charms/trusty/tanuki-message-hub/trunk

Proposed by Facundo Batista
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 6
Merged at revision: 7
Proposed branch: lp:~facundo/charms/trusty/tanuki-message-hub/add-nagios-support
Merge into: lp:~tanuki/charms/trusty/tanuki-message-hub/trunk
Diff against target: 65 lines (+23/-2)
3 files modified
config.yaml (+5/-0)
hooks/actions.py (+17/-2)
hooks/services.py (+1/-0)
To merge this branch: bzr merge lp:~facundo/charms/trusty/tanuki-message-hub/add-nagios-support
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Review via email: mp+267552@code.launchpad.net

Commit message

Add support for nagios.

Description of the change

Add support for nagios.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-06-15 19:05:28 +0000
3+++ config.yaml 2015-08-10 17:28:08 +0000
4@@ -8,3 +8,8 @@
5 type: string
6 description: |
7 base64 encoded string with the config file for message-hub
8+ nagios_context:
9+ type: string
10+ default: ""
11+ description: |
12+ Used by the nrpe subordinate charms.
13
14=== modified file 'hooks/actions.py'
15--- hooks/actions.py 2015-07-22 15:15:27 +0000
16+++ hooks/actions.py 2015-08-10 17:28:08 +0000
17@@ -8,7 +8,8 @@
18 host,
19 )
20 from charmhelpers.core.services import helpers
21-from charmhelpers.payload import (archive, execd)
22+from charmhelpers.payload import archive, execd
23+from charmhelpers.contrib.charmsupport import nrpe
24
25
26 REQUIRED_PACKAGES = [
27@@ -92,7 +93,7 @@
28 host.add_group(WSGI_GROUP)
29 host.add_user_to_group(WSGI_USER, WSGI_GROUP)
30 if not os.path.exists(LOG_DIR):
31- host.mkdir(LOG_DIR, WSGI_USER, WSGI_GROUP, perms=0755)
32+ host.mkdir(LOG_DIR, WSGI_USER, WSGI_GROUP, perms=0o755)
33
34
35 def publish_website_relation_data(service_name):
36@@ -113,3 +114,17 @@
37 data = super(WebsiteRelation, self).provide_data()
38 data['port'] = 8000
39 return data
40+
41+
42+def nrpe_external_master_relation(service_name):
43+ """Configure the nrpe-external-master relation."""
44+ nrpe_compat = nrpe.NRPE()
45+
46+ nrpe_compat.add_check(
47+ shortname="check_app_http",
48+ description="Check app http",
49+ check_cmd="/usr/lib/nagios/plugins/check_http "
50+ "-I 127.0.0.1 -p 8000 -e ' 200 OK' -u '/nagios'",
51+ )
52+
53+ nrpe_compat.write()
54
55=== modified file 'hooks/services.py'
56--- hooks/services.py 2015-06-15 19:05:28 +0000
57+++ hooks/services.py 2015-08-10 17:28:08 +0000
58@@ -26,6 +26,7 @@
59 target='/etc/init/message-hub.conf'),
60 actions.publish_website_relation_data,
61 actions.log_start,
62+ actions.nrpe_external_master_relation,
63 ],
64 },
65 ])

Subscribers

People subscribed via source and target branches

to all changes: