Merge lp:~mthaddon/openstack-mojo-specs/mojo-nagios-check into lp:openstack-mojo-specs

Proposed by Tom Haddon
Status: Merged
Merged at revision: 285
Proposed branch: lp:~mthaddon/openstack-mojo-specs/mojo-nagios-check
Merge into: lp:openstack-mojo-specs
Diff against target: 83 lines (+4/-37)
4 files modified
helper/tests/run_nagios_checks.py (+0/-33)
specs/dev/full_nrpe/manifest (+1/-1)
specs/dev/nova_cc_legacy_neutron/utils/mojo_utils.py (+2/-2)
specs/dev/swift_nrpe/simple_nonha/manifest (+1/-1)
To merge this branch: bzr merge lp:~mthaddon/openstack-mojo-specs/mojo-nagios-check
Reviewer Review Type Date Requested Status
David Ames (community) Approve
Review via email: mp+310346@code.launchpad.net

Description of the change

Switch to using Mojo's built in nagios-check phase rather than maintaining a custom script. Note that this phase will throw an ERROR if any machines with services running don't have nagios checks configured, so you'd need to confirm that'll not break things before merging.

There's also a bunch of other options to consider when running this phase per https://mojo.canonical.com/readme.html#nagios-check

To post a comment you must log in.
Revision history for this message
David Ames (thedac) wrote :

In the OpenStack Charms team we rarely use nagios and our goal is to move toward tempest for the validation phase.
Having said that, it does make more sense to utilize the built in feature for when we do use nagios.

Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'helper/tests/run_nagios_checks.py'
2--- helper/tests/run_nagios_checks.py 2015-01-21 09:46:18 +0000
3+++ helper/tests/run_nagios_checks.py 1970-01-01 00:00:00 +0000
4@@ -1,33 +0,0 @@
5-#!/usr/bin/python
6-import sys
7-import utils.mojo_utils as mojo_utils
8-import logging
9-import argparse
10-
11-
12-def main(argv):
13- logging.basicConfig(level=logging.INFO)
14- parser = argparse.ArgumentParser()
15- default_service = 'all'
16- parser.add_argument("--service", default=default_service)
17- options = parser.parse_args()
18- service = mojo_utils.parse_mojo_arg(options, 'service')
19- if service == 'all':
20- units = mojo_utils.get_juju_units()
21- else:
22- units = mojo_utils.get_juju_units(service=service)
23- for unit in units:
24- logging.info('Running nagios check(s) on ' + unit)
25- cmd = "ls -l /etc/nagios/nrpe.d/* 2>/dev/null | wc -l"
26- check_count = mojo_utils.remote_run(unit, cmd)[0]
27- if int(check_count) > 0:
28- try:
29- cmd = "grep -Eoh '/usr.*' /etc/nagios/nrpe.d/* | bash -e"
30- mojo_utils.remote_run(unit, cmd)
31- except:
32- pass
33- else:
34- logging.warn('No nagios checks found on ' + unit)
35-
36-if __name__ == "__main__":
37- sys.exit(main(sys.argv))
38
39=== modified file 'specs/dev/full_nrpe/manifest'
40--- specs/dev/full_nrpe/manifest 2015-10-14 17:32:54 +0000
41+++ specs/dev/full_nrpe/manifest 2016-11-08 18:14:00 +0000
42@@ -19,6 +19,6 @@
43 # Create 1 * tiny cirros and 3 * small precise instances on the overcloud
44 verify config=simple_os_checks.py MACHINES='cirros:m1.tiny:1' CLOUDINIT_WAIT="300"
45
46-verify config=run_nagios_checks.py
47+nagios-check
48
49 # Success
50
51=== modified file 'specs/dev/nova_cc_legacy_neutron/utils/mojo_utils.py'
52--- specs/dev/nova_cc_legacy_neutron/utils/mojo_utils.py 2015-07-13 20:44:27 +0000
53+++ specs/dev/nova_cc_legacy_neutron/utils/mojo_utils.py 2016-11-08 18:14:00 +0000
54@@ -65,7 +65,7 @@
55 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
56 output = p.communicate()
57 if p.returncode != 0:
58- raise Exception('Error running nagios checks')
59+ raise Exception('Error running remote command')
60 return output
61
62
63@@ -76,7 +76,7 @@
64 dst = unit + ':/tmp/'
65 cmd = ['juju', 'scp', script, dst]
66 return subprocess.check_call(cmd)
67-
68+
69
70 def delete_unit(unit):
71 service = unit.split('/')[0]
72
73=== modified file 'specs/dev/swift_nrpe/simple_nonha/manifest'
74--- specs/dev/swift_nrpe/simple_nonha/manifest 2015-10-14 17:32:54 +0000
75+++ specs/dev/swift_nrpe/simple_nonha/manifest 2016-11-08 18:14:00 +0000
76@@ -5,6 +5,6 @@
77 script config=keystone_setup.py
78 verify config=swift_ring_status.py
79 verify config=test_obj_store.py
80-verify config=run_nagios_checks.py
81+nagios-check
82
83 # Success

Subscribers

People subscribed via source and target branches