Skip to content

Instantly share code, notes, and snippets.

@wangbin
Forked from topfunky/gist:169876
Created December 27, 2010 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wangbin/756017 to your computer and use it in GitHub Desktop.
Save wangbin/756017 to your computer and use it in GitHub Desktop.
munin plugin for beanstalkd status, python version
# coding: utf-8
#!/usr/bin/env python
import sys
import beanstalkc
HOST = '127.0.0.1'
PORT = 14711
def main():
if len(sys.argv) > 1 and sys.argv[1] == 'config':
print '''graph_category Beanstalkd
graph_title Beanstalk Queue Size
graph_vlabel watching
watching.label Watching
graph_vlabel reserved
reserved.label Reserved
graph_vlabel ready
ready.label Ready
graph_vlabel using
using.label Using
graph_vlabel buried
buried.label Buried
graph_vlabel waiting
waiting.label Waiting
graph_vlabel delayed
delayed.label Delayed
graph_vlabel urgent
urgent.label Urgent'''
return
try:
beanstalk = beanstalkc.Connection(host=HOST, port=PORT, parse_yaml=False)
stats_tube = beanstalk.stats_tube('default').split('\n')[2:-1]
beanstalk.close()
for stats in stats_tube:
k, v = stats.split(':')
if k.startswith('current'):
print '%s.value ' %k.split('-')[-1], v
except beanstalkc.SocketError:
exit(-1)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment