Merge ~xavpaice/ntp-charm:feature/nrpe-max-retries into ntp-charm:master

Proposed by Xav Paice
Status: Merged
Approved by: Haw Loeung
Approved revision: 0d44ce873db2d1198c2585e554fe88d4735a05d0
Merged at revision: 7ad6065347772d705cf47e109985b5d3e1e630e1
Proposed branch: ~xavpaice/ntp-charm:feature/nrpe-max-retries
Merge into: ntp-charm:master
Diff against target: 34 lines (+12/-3)
2 files modified
config.yaml (+7/-0)
reactive/ntp.py (+5/-3)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Canonical IS Reviewers Pending
Review via email: mp+394511@code.launchpad.net

Commit message

Add config item and support for setting max_check_attempts for ntpmon checks.

Requires https://github.com/juju/charm-helpers/pull/539

To post a comment you must log in.
Revision history for this message
Xav Paice (xavpaice) wrote :

WIP until https://github.com/juju/charm-helpers/pull/539 lands, which is required for this change to work without an error.

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
Xav Paice (xavpaice) wrote :

cs:~xavpaice/ntp-3 is built with the current master of charmhelpers (including the necessary change).

Revision history for this message
Haw Loeung (hloeung) :
Revision history for this message
Haw Loeung (hloeung) :
Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

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

Change successfully merged at revision 7ad6065347772d705cf47e109985b5d3e1e630e1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/config.yaml b/config.yaml
2index b676deb..33919f6 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -85,3 +85,10 @@ options:
6 the appropriate package will be selected based on the operating system.
7 Please note that the use of ntp on Ubuntu bionic or later is not recommended as it
8 does not receive security updates.
9+ max_check_attempts:
10+ default: ""
11+ type: string
12+ description: >
13+ The maxiumum number of attempts to check the ntpmon service before switching an
14+ alert to HARD status rather than SOFT. Default for Nagios is 4, if this is set,
15+ the default will be overwritten for the ntpmon check only.
16diff --git a/reactive/ntp.py b/reactive/ntp.py
17index df2307d..dbc75a6 100755
18--- a/reactive/ntp.py
19+++ b/reactive/ntp.py
20@@ -289,10 +289,12 @@ def update_nrpe_config():
21 check_cmd = os.path.join(options['install-dir'], 'check_ntpmon.py') + ' --check ' + ' '.join(nagios_ntpmon_checks)
22 unitdata.kv().set('check_cmd', check_cmd)
23 nrpe_setup.add_check(
24- check_cmd=check_cmd,
25+ shortname='ntpmon',
26 description='Check NTPmon {}'.format(current_unit),
27- shortname="ntpmon",
28- )
29+ check_cmd=check_cmd,
30+ max_check_attempts=hookenv.config('max_check_attempts'),
31+ )
32+
33 nrpe_setup.write()
34 set_state('ntp.nrpe.configured')
35

Subscribers

People subscribed via source and target branches