-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
beanstalk | ||
=============== | ||
|
||
python module for ganglia 3.1. | ||
|
||
*NOTE*: [beanstalkc](https://github.com/earl/beanstalkc/) *must* be in your python path. | ||
|
||
This module connects to a [beanstalkd](http://kr.github.com/beanstalkd/) instance and grabs some metrics: | ||
|
||
* current-connections | ||
* total-jobs | ||
* current-jobs-ready | ||
* current-jobs-buried | ||
* current-jobs-delayed | ||
* current-waiting | ||
* job-timeouts | ||
* cmd-bury | ||
|
||
## AUTHOR | ||
|
||
Stephen Holiday <stephen.holiday@gmail.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
modules { | ||
module { | ||
name = "beanstalk" | ||
language = "python" | ||
} | ||
} | ||
collection_group { | ||
collect_every = 20 | ||
time_threshold = 90 | ||
metric { | ||
name = "current-connections" | ||
title = "Number of Current Connections to Beanstalkd" | ||
value_threshold = 0 | ||
} | ||
metric { | ||
name = "total-jobs" | ||
title = "Number of Beanstalkd Jobs" | ||
value_threshold = 0 | ||
} | ||
metric { | ||
name = "current-jobs-ready" | ||
title = "Number of Beanstalkd Jobs 'ready'" | ||
value_threshold = 0 | ||
} | ||
metric { | ||
name = "current-jobs-buried" | ||
title = "Number of Beanstalkd Jobs 'buried'" | ||
value_threshold = 0 | ||
} | ||
|
||
metric { | ||
name = "current-jobs-delayed" | ||
title = "Number of Beanstalkd Jobs 'delayed'" | ||
value_threshold = 0 | ||
} | ||
metric { | ||
name = "current-waiting" | ||
title = "Number of Beanstalkd Jobs 'waiting'" | ||
value_threshold = 0 | ||
} | ||
|
||
metric { | ||
name = "job-timeouts" | ||
title = "Number of Beanstalkd Jobs Timeouts" | ||
value_threshold = 0 | ||
} | ||
metric { | ||
name = "cmd-bury" | ||
title = "Number of Beanstalkd Burries" | ||
value_threshold = 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import beanstalkc | ||
|
||
def stat_handler(name): | ||
bean=beanstalkc.Connection(host='localhost',port=14711) | ||
return bean.stats()[name] | ||
|
||
def metric_init(params): | ||
global descriptors | ||
|
||
descriptors = [{'name': 'current-connections', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'connections', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Current Connections to Beanstalkd', | ||
'groups': 'beanstalkd'}, | ||
{'name': 'total-jobs', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'total jobs', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Beanstalkd Jobs', | ||
'groups': 'beanstalkd'}, | ||
{'name': 'current-jobs-ready', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'jobs', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Beanstalkd Jobs \'ready\'', | ||
'groups': 'beanstalkd'}, | ||
{'name': 'current-jobs-buried', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'jobs', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Beanstalkd Jobs \'buried\'', | ||
'groups': 'beanstalkd'}, | ||
{'name': 'current-jobs-delayed', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'jobs', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Beanstalkd Jobs \'delayed\'', | ||
'groups': 'beanstalkd'}, | ||
{'name': 'current-waiting', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'jobs', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Beanstalkd Jobs \'waiting\'', | ||
'groups': 'beanstalkd'}, | ||
{'name': 'job-timeouts', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'jobs', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Beanstalkd Jobs Timeouts', | ||
'groups': 'beanstalkd'}, | ||
{'name': 'cmd-bury', | ||
'call_back': stat_handler, | ||
'time_max': 90, | ||
'value_type': 'uint', | ||
'units': 'jobs', | ||
'slope': 'both', | ||
'format': '%u', | ||
'description': 'Number of Beanstalkd Burries', | ||
'groups': 'beanstalkd'} | ||
] | ||
|
||
return descriptors | ||
|
||
def metric_cleanup(): | ||
'''Clean up the metric module.''' | ||
pass | ||
|
||
#This code is for debugging and unit testing | ||
if __name__ == '__main__': | ||
metric_init(None) | ||
for d in descriptors: | ||
v = d['call_back'](d['name']) | ||
print 'value for %s is %u' % (d['name'], v) |