diff --git a/celery/README.md b/celery/README.md index 9f739fbf..3333652f 100644 --- a/celery/README.md +++ b/celery/README.md @@ -9,12 +9,11 @@ from http://docs.celeryproject.org. Prerequisite ============ -Make sure Celery exposes it's API over HTTP e.g. - -curl http://localhost:8989/api/worker/ - -or similar needs to succeed for this module to work. +This version of the module works with Flower (https://github.com/mher/flower), +a web-based tool to monitor Celery workers and tasks. +Previous versions of this module worked with Celerymon, which has now been +obsoleted in favor of Flower (http://celery.readthedocs.org/en/latest/userguide/monitoring.html?highlight=flower#flower-real-time-celery-web-monitor). Install =============== diff --git a/celery/conf.d/celery.pyconf b/celery/conf.d/celery.pyconf index d8037778..9c957f09 100644 --- a/celery/conf.d/celery.pyconf +++ b/celery/conf.d/celery.pyconf @@ -2,9 +2,8 @@ modules { module { name = "ganglia_celery" language = "python" - # Don't forget the trailing slash on the URL param url { - value = "http://localhost:10000/api/worker/" + value = "http://localhost:10000/api/workers" } } diff --git a/celery/python_modules/ganglia_celery.py b/celery/python_modules/ganglia_celery.py index 3bd13377..647f14d9 100644 --- a/celery/python_modules/ganglia_celery.py +++ b/celery/python_modules/ganglia_celery.py @@ -38,7 +38,7 @@ def get_metrics(): res = urllib2.urlopen(req, None, 1) stats = res.read() metrics2 = json.loads(stats) - metrics = metrics2[0] + metrics = metrics2['celery@{}'.format(socket.gethostname())] metrics['status'] = "up" except StandardError, e: @@ -148,19 +148,26 @@ def metric_init(params): SERVER_STATUS_URL = params["url"] descriptors.append(create_desc(Desc_Skel, { - "name" : params["metrics_prefix"] + "_active", + "name" : params["metrics_prefix"] + "_running_tasks", "units" : "jobs", "description": "Number of active jobs", "call_back" : get_value })) descriptors.append(create_desc(Desc_Skel, { - "name" : params["metrics_prefix"] + "_processed", + "name" : params["metrics_prefix"] + "_completed_tasks", "units" : "jobs/s", "description": "Number of processed jobs", "call_back" : get_delta })) + descriptors.append(create_desc(Desc_Skel, { + "name" : params["metrics_prefix"] + "_concurrency", + "units" : "processes/s", + "description": "Number of worker processes", + "call_back" : get_value + })) + descriptors.append(create_desc(Desc_Skel, { "name" : params["metrics_prefix"] + "_status", "units" : "", @@ -183,7 +190,7 @@ def create_desc(skel, prop): if __name__ == '__main__': try: params = { - "url" : "http://localhost:8989/api/worker/", + "url" : "http://localhost:10000/api/workers", } metric_init(params)