Merge "Use 'meta' in the rabbitmq collectd plugin"
This commit is contained in:
commit
edf29e1753
@ -191,10 +191,24 @@ class RabbitMqPlugin(base.Base):
|
||||
|
||||
queue_name = ctl_stats[0]
|
||||
if self._matching_queue(queue_name):
|
||||
queue_name = ctl_stats[0][:self.MAX_QUEUE_IDENTIFIER_LENGTH]
|
||||
stats['%s.messages' % queue_name] = ctl_stats[1]
|
||||
stats['%s.memory' % queue_name] = ctl_stats[2]
|
||||
stats['%s.consumers' % queue_name] = ctl_stats[3]
|
||||
meta = {
|
||||
'queue': ctl_stats[0][:self.MAX_QUEUE_IDENTIFIER_LENGTH]
|
||||
}
|
||||
yield {
|
||||
'type_instance': 'queue_messages',
|
||||
'values': ctl_stats[1],
|
||||
'meta': meta
|
||||
}
|
||||
yield {
|
||||
'type_instance': 'queue_memory',
|
||||
'values': ctl_stats[2],
|
||||
'meta': meta
|
||||
}
|
||||
yield {
|
||||
'type_instance': 'queue_consumers',
|
||||
'values': ctl_stats[3],
|
||||
'meta': meta
|
||||
}
|
||||
|
||||
# we need to check if the list of synchronised slaves is
|
||||
# equal to the list of slaves.
|
||||
@ -238,8 +252,6 @@ class RabbitMqPlugin(base.Base):
|
||||
self.logger.warning('%s returned something strange.' %
|
||||
self.pmap_bin)
|
||||
|
||||
# TODO(pasquier-s): define and use own types instead of the generic
|
||||
# GAUGE type
|
||||
for k, v in stats.iteritems():
|
||||
yield {'type_instance': k, 'values': v}
|
||||
|
||||
|
@ -181,25 +181,10 @@ function process_message ()
|
||||
msg['Fields']['name'] = msg['Fields']['name'] .. sample['type_instance']
|
||||
end
|
||||
elseif metric_source == 'rabbitmq_info' then
|
||||
if sample['type_instance'] ~= 'consumers' and
|
||||
sample['type_instance'] ~= 'messages' and
|
||||
sample['type_instance'] ~= 'memory' and
|
||||
sample['type_instance'] ~= 'used_memory' and
|
||||
sample['type_instance'] ~= 'unmirrored_queues' and
|
||||
sample['type_instance'] ~= 'vm_memory_limit' and
|
||||
sample['type_instance'] ~= 'disk_free_limit' and
|
||||
sample['type_instance'] ~= 'disk_free' and
|
||||
sample['type_instance'] ~= 'remaining_memory' and
|
||||
sample['type_instance'] ~= 'remaining_disk' and
|
||||
(string.match(sample['type_instance'], '%.consumers$') or
|
||||
string.match(sample['type_instance'], '%.messages$') or
|
||||
string.match(sample['type_instance'], '%.memory$')) then
|
||||
local q, m = string.match(sample['type_instance'], '^(.+)%.([^.]+)$')
|
||||
msg['Fields']['name'] = 'rabbitmq_queue' .. sep .. m
|
||||
msg['Fields']['queue'] = q
|
||||
msg['Fields']['name'] = 'rabbitmq' .. sep .. sample['type_instance']
|
||||
if sample['meta'] and sample['meta']['queue'] then
|
||||
msg['Fields']['queue'] = sample['meta']['queue']
|
||||
msg['Fields']['tag_fields'] = { 'queue' }
|
||||
else
|
||||
msg['Fields']['name'] = 'rabbitmq' .. sep .. sample['type_instance']
|
||||
end
|
||||
elseif metric_source == 'nova' then
|
||||
if sample['plugin_instance'] == 'nova_services' or
|
||||
|
Loading…
Reference in New Issue
Block a user