Merge "change the way to filter stats for vhost from http api response." into dev/experimental

This commit is contained in:
Jenkins 2014-10-08 19:18:46 +00:00 committed by Gerrit Code Review
commit e5f2906860

View File

@ -53,7 +53,7 @@ def get_stats():
# call http api instead of rabbitmqctl to collect statistics due to issue:
# https://github.com/phrawzty/rabbitmq-collectd-plugin/issues/5
try:
r = requests.get('%s/%s' % (RABBITMQ_API, VHOST),
r = requests.get('%s' % RABBITMQ_API,
auth=('%s' % USER, '%s' % PASS))
# p = subprocess.Popen([RABBITMQCTL_BIN, '-q', '-p', VHOST,
# 'list_queues', 'name', 'messages', 'memory', 'consumers'],
@ -83,6 +83,7 @@ def get_stats():
logger('err', 'No result found for this vhost')
return None
for i in resp:
if i['vhost'] == VHOST:
if "messages" in i:
stats['ctl_messages'] += i['messages']
stats['ctl_messages_%s' % i['name']] = i['messages']