From 478711c229d51fe69c4ab8824966c5e13dfd9f5f Mon Sep 17 00:00:00 2001 From: Lukasz Jagiello Date: Mon, 25 Jan 2016 19:17:58 +0000 Subject: [PATCH] RabbitMQ plugin - extra fields: Extra fields describing size of all message bodies in the queue. * message_bytes * message_bytes_ready * message_bytes_unacknowledged * message_bytes_ram * message_bytes_persistent More information about each field: https://www.rabbitmq.com/man/rabbitmqctl.1.man.html --- plugins/inputs/rabbitmq/rabbitmq.go | 16 +++++++++++++--- plugins/inputs/rabbitmq/rabbitmq_test.go | 6 ++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/rabbitmq/rabbitmq.go b/plugins/inputs/rabbitmq/rabbitmq.go index c062b3164..03079755c 100644 --- a/plugins/inputs/rabbitmq/rabbitmq.go +++ b/plugins/inputs/rabbitmq/rabbitmq.go @@ -57,9 +57,14 @@ type ObjectTotals struct { } type QueueTotals struct { - Messages int64 - MessagesReady int64 `json:"messages_ready"` - MessagesUnacknowledged int64 `json:"messages_unacknowledged"` + Messages int64 + MessagesReady int64 `json:"messages_ready"` + MessagesUnacknowledged int64 `json:"messages_unacknowledged"` + MessageBytes int64 `json:"message_bytes"` + MessageBytesReady int64 `json:"message_bytes_ready"` + MessageBytesUnacknowledged int64 `json:"message_bytes_unacknowledged"` + MessageRam int64 `json:"message_bytes_ram"` + MessagePersistent int64 `json:"message_bytes_persistent"` } type Queue struct { @@ -270,6 +275,11 @@ func gatherQueues(r *RabbitMQ, acc inputs.Accumulator, errChan chan error) { "consumer_utilisation": queue.ConsumerUtilisation, "memory": queue.Memory, // messages information + "message_bytes": queue.MessageBytes, + "message_bytes_ready": queue.MessageBytesReady, + "message_bytes_unacked": queue.MessageBytesUnacknowledged, + "message_bytes_ram": queue.MessageRam, + "message_bytes_persist": queue.MessagePersistent, "messages": queue.Messages, "messages_ready": queue.MessagesReady, "messages_unack": queue.MessagesUnacknowledged, diff --git a/plugins/inputs/rabbitmq/rabbitmq_test.go b/plugins/inputs/rabbitmq/rabbitmq_test.go index 4bdc980db..b8a9f6ebd 100644 --- a/plugins/inputs/rabbitmq/rabbitmq_test.go +++ b/plugins/inputs/rabbitmq/rabbitmq_test.go @@ -407,6 +407,12 @@ func TestRabbitMQGeneratesMetrics(t *testing.T) { "messages_ready", "messages_unacked", + "message_bytes", + "message_bytes_ready", + "message_bytes_unacked", + "message_bytes_ram", + "message_bytes_persist", + "messages_acked", "messages_delivered", "messages_published",