Merge ~xavpaice/charm-thruk-external-agent:feature/max_check_attempts into charm-thruk-external-agent:master

Proposed by Xav Paice
Status: Merged
Approved by: Celia Wang
Approved revision: 0aeb05899bf9a306beebe0b543e8ef2c728a0675
Merged at revision: 0aeb05899bf9a306beebe0b543e8ef2c728a0675
Proposed branch: ~xavpaice/charm-thruk-external-agent:feature/max_check_attempts
Merge into: charm-thruk-external-agent:master
Diff against target: 26 lines (+8/-0)
2 files modified
config.yaml (+7/-0)
hooks/actions.py (+1/-0)
Reviewer Review Type Date Requested Status
Celia Wang Approve
Linda Guo (community) Approve
Review via email: mp+397951@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Linda Guo (lihuiguo) wrote :

LGTM

review: Approve
Revision history for this message
Peter Sabaini (peter-sabaini) wrote :

Hey,

similarly to the comment on https://code.launchpad.net/~xavpaice/charm-graylog/+git/graylog-charm/+merge/397950 --

in general lgtm, but I believe charmhelpers.contrib.charmsupport.nrpe currently don't set a default (also cf. https://github.com/juju/charm-helpers/issues/564 ).

We'd need to handle defaults either here or in charmhelpers.

Personally I'd lean (explicit is better than implicit) to configure an explicit default=4 and make it type=int for the max_check_attempts in config.yaml but either here or in charmhelpers works

Revision history for this message
Xav Paice (xavpaice) wrote :

> Hey,
>
> similarly to the comment on https://code.launchpad.net/~xavpaice/charm-
> graylog/+git/graylog-charm/+merge/397950 --
>
> in general lgtm, but I believe charmhelpers.contrib.charmsupport.nrpe
> currently don't set a default (also cf. https://github.com/juju/charm-
> helpers/issues/564 ).
>
> We'd need to handle defaults either here or in charmhelpers.
>
> Personally I'd lean (explicit is better than implicit) to configure an
> explicit default=4 and make it type=int for the max_check_attempts in
> config.yaml but either here or in charmhelpers works

Worth checking the pattern with NTP, what we have done there is the same as here, the Nagios charm itself doesn't set the parameter at all if it's not listed and therefore uses the default in the service definition template.

Revision history for this message
Celia Wang (ziyiwang) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/config.yaml b/config.yaml
index 7818881..7c340fc 100644
--- a/config.yaml
+++ b/config.yaml
@@ -41,3 +41,10 @@ options:
41 Name and location of the remotely trusty ssl cert. Basename of this file41 Name and location of the remotely trusty ssl cert. Basename of this file
42 will be used as the basename of the chain file rooted at42 will be used as the basename of the chain file rooted at
43 /etc/ssl/certs.43 /etc/ssl/certs.
44 max_check_attempts:
45 default: ""
46 type: string
47 description: >
48 The maxiumum number of attempts to check the remote agent service before switching an
49 alert to HARD status rather than SOFT. Default for Nagios is 4, if this is set,
50 the default will be overwritten for the remote Thruk agent check only.
diff --git a/hooks/actions.py b/hooks/actions.py
index f3efdd7..d09c35d 100644
--- a/hooks/actions.py
+++ b/hooks/actions.py
@@ -56,6 +56,7 @@ def update_nrpe_config(service_name):
56 shortname=shortname,56 shortname=shortname,
57 description="Check Nagios PID via thruk agent",57 description="Check Nagios PID via thruk agent",
58 check_cmd=check_cmd,58 check_cmd=check_cmd,
59 max_check_attempts=hookenv.config("max_check_attempts"),
59 )60 )
60 nrpe_compat.write()61 nrpe_compat.write()
6162

Subscribers

People subscribed via source and target branches