Merge lp:~cprov/charms/trusty/tanuki-spec-manager/negate-poller-check into lp:~tanuki/charms/trusty/tanuki-spec-manager/trunk

Proposed by Celso Providelo
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 28
Merged at revision: 28
Proposed branch: lp:~cprov/charms/trusty/tanuki-spec-manager/negate-poller-check
Merge into: lp:~tanuki/charms/trusty/tanuki-spec-manager/trunk
Diff against target: 47 lines (+21/-14)
1 file modified
hooks/actions.py (+21/-14)
To merge this branch: bzr merge lp:~cprov/charms/trusty/tanuki-spec-manager/negate-poller-check
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Review via email: mp+271823@code.launchpad.net

Commit message

Negate store-poller nagios check when it gets disabled.

Description of the change

Negate store-poller nagios check when it gets disabled.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2015-09-17 05:20:25 +0000
+++ hooks/actions.py 2015-09-21 14:53:31 +0000
@@ -323,22 +323,29 @@
323 check_cmd="/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -p 8000 -e ' 200 OK' -u '/nagios/postgres'",323 check_cmd="/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -p 8000 -e ' 200 OK' -u '/nagios/postgres'",
324 )324 )
325325
326 # Builds a nagios check command to verify `store-poller` log file age
327 # according the service configuration.
328 environment = hookenv.Config()['environment']
329 log_path = os.path.join(LOG_DIR, 'store-poller.log')
330 max_age_seconds = int(config['store_poller_nagios_file_age_max_minutes']) * 60
331 check_cmd = "/usr/lib/nagios/plugins/check_file_age -w {0} -c {0} -f {1}".format(
332 max_age_seconds,
333 log_path,
334 )
335
336 # If `store-poller` cronscript is enabled in this unit, ensure the log file
337 # exists. Otherwise 'negate' standard check (verifies cronscript is not running).
326 config_unit = config.get('store_poller_unit')338 config_unit = config.get('store_poller_unit')
327 local_unit = int(hookenv.local_unit().split('/')[-1])339 local_unit = int(hookenv.local_unit().split('/')[-1])
328
329 if local_unit == config_unit:340 if local_unit == config_unit:
330 environment = hookenv.Config()['environment']
331 log_path = os.path.join(LOG_DIR, 'store-poller.log')
332 # Create the file now, so the nagios check doesn't fail right after
333 # we've completed the deployment.
334 host.write_file(log_path,"", "www-data", "www-data", perms=0o660)341 host.write_file(log_path,"", "www-data", "www-data", perms=0o660)
335 max_age_seconds = int(config['store_poller_nagios_file_age_max_minutes']) * 60342 else:
336 nrpe_compat.add_check(343 check_cmd = "negate {}".format(check_cmd)
337 shortname="store_poller_check",344
338 description="Store poller check.",345 nrpe_compat.add_check(
339 check_cmd="/usr/lib/nagios/plugins/check_file_age -w {0} -c {0} -f {1}".format(346 shortname="store_poller_check",
340 max_age_seconds,347 description="Store poller check.",
341 log_path,348 check_cmd=check_cmd
342 )349 )
343 )350
344 nrpe_compat.write()351 nrpe_compat.write()

Subscribers

People subscribed via source and target branches

to all changes: