Update collectd_rabbitmq_plugin for robustness
Change-Id: I6d0ab66222daf437754dcb54b980618808b81f9a
This commit is contained in:
parent
b2f2d2065b
commit
ea111dcef0
@ -51,62 +51,66 @@ def read(data=None):
|
|||||||
overview = cl.get_overview()
|
overview = cl.get_overview()
|
||||||
|
|
||||||
# Object counts
|
# Object counts
|
||||||
for metric_instance in \
|
for m_instance in \
|
||||||
['channels', 'connections', 'consumers', 'exchanges', 'queues']:
|
['channels', 'connections', 'consumers', 'exchanges', 'queues']:
|
||||||
|
if m_instance in overview['object_totals']:
|
||||||
metric = collectd.Values()
|
metric = collectd.Values()
|
||||||
metric.plugin = 'rabbitmq_monitoring'
|
metric.plugin = 'rabbitmq_monitoring'
|
||||||
metric.interval = INTERVAL
|
metric.interval = INTERVAL
|
||||||
metric.type = 'gauge'
|
metric.type = 'gauge'
|
||||||
metric.type_instance = metric_instance
|
metric.type_instance = m_instance
|
||||||
metric.values = [overview['object_totals'][metric_instance]]
|
metric.values = [overview['object_totals'][m_instance]]
|
||||||
metric.dispatch()
|
metric.dispatch()
|
||||||
|
|
||||||
# Aggregated Queue message stats
|
# Aggregated Queue message stats
|
||||||
for metric_instance in \
|
for m_instance in \
|
||||||
['messages', 'messages_ready', 'messages_unacknowledged']:
|
['messages', 'messages_ready', 'messages_unacknowledged']:
|
||||||
|
if m_instance in overview['queue_totals']:
|
||||||
metric = collectd.Values()
|
metric = collectd.Values()
|
||||||
metric.plugin = 'rabbitmq_monitoring'
|
metric.plugin = 'rabbitmq_monitoring'
|
||||||
metric.interval = INTERVAL
|
metric.interval = INTERVAL
|
||||||
metric.type = 'gauge'
|
metric.type = 'gauge'
|
||||||
metric.type_instance = 'queue_total-{}-count'.format(metric_instance)
|
metric.type_instance = 'queue_total-{}-count'.format(m_instance)
|
||||||
metric.values = [overview['queue_totals'][metric_instance]]
|
metric.values = [overview['queue_totals'][m_instance]]
|
||||||
metric.dispatch()
|
metric.dispatch()
|
||||||
|
|
||||||
metric = collectd.Values()
|
metric = collectd.Values()
|
||||||
metric.plugin = 'rabbitmq_monitoring'
|
metric.plugin = 'rabbitmq_monitoring'
|
||||||
metric.interval = INTERVAL
|
metric.interval = INTERVAL
|
||||||
metric.type = 'gauge'
|
metric.type = 'gauge'
|
||||||
metric.type_instance = 'queue_total-{}-rate'.format(metric_instance)
|
metric.type_instance = 'queue_total-{}-rate'.format(
|
||||||
|
m_instance)
|
||||||
metric.values = \
|
metric.values = \
|
||||||
[
|
[
|
||||||
overview['queue_totals']['{}_details'.format(metric_instance)]
|
overview['queue_totals']['{}_details'.format(m_instance)]
|
||||||
['rate']
|
['rate']
|
||||||
]
|
]
|
||||||
metric.dispatch()
|
metric.dispatch()
|
||||||
|
|
||||||
# Aggregated Message Stats
|
# Aggregated Message Stats
|
||||||
for metric_instance in \
|
for m_instance in \
|
||||||
[
|
[
|
||||||
'ack', 'confirm', 'deliver', 'deliver_get', 'deliver_no_ack',
|
'ack', 'confirm', 'deliver', 'deliver_get', 'deliver_no_ack',
|
||||||
'get', 'get_no_ack', 'publish', 'publish_in', 'publish_out',
|
'get', 'get_no_ack', 'publish', 'publish_in', 'publish_out',
|
||||||
'redeliver', 'return_unroutable'
|
'redeliver', 'return_unroutable'
|
||||||
]:
|
]:
|
||||||
|
if m_instance in overview['message_stats']:
|
||||||
metric = collectd.Values()
|
metric = collectd.Values()
|
||||||
metric.plugin = 'rabbitmq_monitoring'
|
metric.plugin = 'rabbitmq_monitoring'
|
||||||
metric.interval = INTERVAL
|
metric.interval = INTERVAL
|
||||||
metric.type = 'gauge'
|
metric.type = 'gauge'
|
||||||
metric.type_instance = 'message_total-{}-count'.format(metric_instance)
|
metric.type_instance = 'message_total-{}-count'.format(m_instance)
|
||||||
metric.values = [overview['message_stats'][metric_instance]]
|
metric.values = [overview['message_stats'][m_instance]]
|
||||||
metric.dispatch()
|
metric.dispatch()
|
||||||
|
|
||||||
metric = collectd.Values()
|
metric = collectd.Values()
|
||||||
metric.plugin = 'rabbitmq_monitoring'
|
metric.plugin = 'rabbitmq_monitoring'
|
||||||
metric.interval = INTERVAL
|
metric.interval = INTERVAL
|
||||||
metric.type = 'gauge'
|
metric.type = 'gauge'
|
||||||
metric.type_instance = 'message_total-{}-rate'.format(metric_instance)
|
metric.type_instance = 'message_total-{}-rate'.format(m_instance)
|
||||||
metric.values = \
|
metric.values = \
|
||||||
[
|
[
|
||||||
overview['message_stats']['{}_details'.format(metric_instance)]
|
overview['message_stats']['{}_details'.format(m_instance)]
|
||||||
['rate']
|
['rate']
|
||||||
]
|
]
|
||||||
metric.dispatch()
|
metric.dispatch()
|
||||||
|
Loading…
Reference in New Issue
Block a user