Merge lp:~brad-marshall/charm-helpers/add-systemd-nagios-check into lp:charm-helpers

Proposed by Brad Marshall
Status: Needs review
Proposed branch: lp:~brad-marshall/charm-helpers/add-systemd-nagios-check
Merge into: lp:charm-helpers
Diff against target: 36 lines (+19/-0) (has conflicts)
1 file modified
charmhelpers/contrib/charmsupport/nrpe.py (+19/-0)
Text conflict in charmhelpers/contrib/charmsupport/nrpe.py
To merge this branch: bzr merge lp:~brad-marshall/charm-helpers/add-systemd-nagios-check
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Needs Fixing
Review via email: mp+294084@code.launchpad.net

Description of the change

Add systemd nagios check support

To post a comment you must log in.
Revision history for this message
Brad Marshall (brad-marshall) wrote :
572. By Brad Marshall

[brad-marshall] Handle the services.d and sysvinit script cases

Revision history for this message
Stuart Bishop (stub) wrote :

Tests need updating, probably with variations mocked to test the different code paths:

======================================================================
FAIL: tests.contrib.charmsupport.test_nrpe.NRPEMiscTestCase.test_add_init_service_checks
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/stub/charms/charm-helpers/trunk/tests/contrib/charmsupport/test_nrpe.py", line 316, in test_add_init_service_checks
    self.assertEqual(bill.checks[1].check_cmd, expect_cmds['haproxy'])
MismatchError: !=:
reference = ''
actual = '/usr/lib/nagios/plugins/check_status_file.py -f /var/lib/nagios/service-check-haproxy.txt'

review: Needs Fixing
Revision history for this message
Stuart Bishop (stub) wrote :

(otherwise looks good and landable)

573. By Brad Marshall

Tweak systemd check, and skip qemu-kvm service as well

Unmerged revisions

573. By Brad Marshall

Tweak systemd check, and skip qemu-kvm service as well

572. By Brad Marshall

[brad-marshall] Handle the services.d and sysvinit script cases

571. By Brad Marshall

[brad-marshall] Add support for systemd checks in add_init_service_checks. LP#1578922

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/charmsupport/nrpe.py'
2--- charmhelpers/contrib/charmsupport/nrpe.py 2016-07-29 10:15:48 +0000
3+++ charmhelpers/contrib/charmsupport/nrpe.py 2016-08-24 04:55:25 +0000
4@@ -339,6 +339,7 @@
5
6 upstart_init = '/etc/init/%s.conf' % svc
7 sysv_init = '/etc/init.d/%s' % svc
8+<<<<<<< TREE
9
10 if host.init_is_systemd():
11 nrpe.add_check(
12@@ -352,6 +353,24 @@
13 description='process check {%s}' % unit_name,
14 check_cmd='check_upstart_job %s' % svc
15 )
16+=======
17+ if os.path.exists('/run/systemd/system'):
18+ # Don't add a check for these services from neutron-gateway & nova-compute
19+ if svc not in ['ext-port', 'os-charm-phy-nic-mtu', 'qemu-kvm']:
20+ nrpe.add_check(
21+ shortname=svc,
22+ description='process check {%s}' % unit_name,
23+ check_cmd='check_systemd.py %s' % svc
24+ )
25+ elif os.path.exists(upstart_init):
26+ # Don't add a check for these services from neutron-gateway & nova-compute
27+ if svc not in ['ext-port', 'os-charm-phy-nic-mtu', 'qemu-kvm']:
28+ nrpe.add_check(
29+ shortname=svc,
30+ description='process check {%s}' % unit_name,
31+ check_cmd='check_upstart_job %s' % svc
32+ )
33+>>>>>>> MERGE-SOURCE
34 elif os.path.exists(sysv_init):
35 cronpath = '/etc/cron.d/nagios-service-check-%s' % svc
36 cron_file = ('*/5 * * * * root '

Subscribers

People subscribed via source and target branches