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

Proposed by Xav Paice
Status: Merged
Approved by: Celia Wang
Approved revision: e0afc8728106324f9d87b552f74699b60545f59d
Merged at revision: e0afc8728106324f9d87b552f74699b60545f59d
Proposed branch: ~xavpaice/charm-graylog:feature/nrpe-max-retries
Merge into: charm-graylog:master
Diff against target: 38 lines (+11/-3)
2 files modified
src/config.yaml (+7/-0)
src/reactive/graylog.py (+4/-3)
Reviewer Review Type Date Requested Status
Celia Wang Approve
Peter Sabaini (community) Needs Information
Linda Guo (community) Approve
Review via email: mp+397950@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Linda Guo (lihuiguo) wrote :

looks good

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

Hey,

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

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

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.

Note the default is set in Nagios during install, and charmhelpers as been updated to ensure that the relation data does not contain max_check_attempts if it's not set, so that the default for Nagios itself can flow through. If we wanted to tune the default, it should be in the Nagios charm itself.

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/config.yaml b/src/config.yaml
2index 4313e4a..a4469ad 100644
3--- a/src/config.yaml
4+++ b/src/config.yaml
5@@ -139,3 +139,10 @@ options:
6 type: string
7 description: |
8 JVM Heap memory size (default 1G)
9+ max_check_attempts:
10+ default: ""
11+ type: string
12+ description: >
13+ The maxiumum number of attempts to check the via nrpe a 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 Graylog Health check only.
16diff --git a/src/reactive/graylog.py b/src/reactive/graylog.py
17index 4f4a9ee..dafb826 100644
18--- a/src/reactive/graylog.py
19+++ b/src/reactive/graylog.py
20@@ -1038,14 +1038,15 @@ def configure_nagios(nagios):
21 fname = os.path.join(nagios_plugins, os.path.basename(f))
22 host.write_file(fname, content.read(), perms=0o755)
23 nrpe_setup.add_check(
24- "graylog_health",
25- "Graylog Health check",
26- "{} --uncommitted-warning {} --uncommitted-critical {} {}".format(
27+ shortname="graylog_health",
28+ description="Graylog Health check",
29+ check_cmd="{} --uncommitted-warning {} --uncommitted-critical {} {}".format(
30 os.path.join(nagios_plugins, "check_graylog_health.py"),
31 conf.get("nagios_uncommitted_warn", 0),
32 conf.get("nagios_uncommitted_crit", 100),
33 api_url,
34 ),
35+ max_check_attempts=hookenv.config("max_check_attempts"),
36 )
37
38 nrpe_setup.write()

Subscribers

People subscribed via source and target branches

to all changes: