← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/turnip:fix-celery-nagios-2 into turnip:master

 

Colin Watson has proposed merging ~cjwatson/turnip:fix-celery-nagios-2 into turnip:master.

Commit message:
charm: Cope with different celery command names

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/turnip/+git/turnip/+merge/392461

The command name for the running celery process can apparently be either "celery" or "python2" depending on exact details of process lifecycle.  Adjust our Nagios checks to cope with this.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/turnip:fix-celery-nagios-2 into turnip:master.
diff --git a/charm/turnip-celery/reactive/turnip-celery.py b/charm/turnip-celery/reactive/turnip-celery.py
index fd1b6f6..ea49f2c 100644
--- a/charm/turnip-celery/reactive/turnip-celery.py
+++ b/charm/turnip-celery/reactive/turnip-celery.py
@@ -84,8 +84,11 @@ def nrpe_available():
         ['/usr/lib/nagios/plugins/check_procs', '-c', '1:128',
          # We need some double-quoting here because
          # NrpeExternalMasterProvides.add_check just joins the argument list
-         # with spaces rather than doing appropriate shell quoting.
-         '-C', 'celery', '-a', "'-A turnip.tasks worker'"],
+         # with spaces rather than doing appropriate shell quoting.  Also
+         # note that ['-C', 'celery'] would be unsafe because the command
+         # name seems to be either celery or python2 depending on exact
+         # details of the process lifecycle.
+         '--ereg-argument-array', "'celery.*-A turnip.tasks worker'"],
         name='check_celery',
         description='Git celery check',
         context=config['nagios_context'])