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
1diff --git a/config.yaml b/config.yaml
2index 7818881..7c340fc 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -41,3 +41,10 @@ options:
6 Name and location of the remotely trusty ssl cert. Basename of this file
7 will be used as the basename of the chain file rooted at
8 /etc/ssl/certs.
9+ max_check_attempts:
10+ default: ""
11+ type: string
12+ description: >
13+ The maxiumum number of attempts to check the remote agent 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 remote Thruk agent check only.
16diff --git a/hooks/actions.py b/hooks/actions.py
17index f3efdd7..d09c35d 100644
18--- a/hooks/actions.py
19+++ b/hooks/actions.py
20@@ -56,6 +56,7 @@ def update_nrpe_config(service_name):
21 shortname=shortname,
22 description="Check Nagios PID via thruk agent",
23 check_cmd=check_cmd,
24+ max_check_attempts=hookenv.config("max_check_attempts"),
25 )
26 nrpe_compat.write()
27

Subscribers

People subscribed via source and target branches