Add RabbitMQ slave_nodes and synchronized_slave_nodes metrics (#7084)

This commit is contained in:
Joao Gilberto Magalhães 2020-02-25 18:36:06 -06:00 committed by GitHub
parent 9d601d6d78
commit de16279d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 17 deletions

View File

@ -173,7 +173,9 @@ For additional details reference the [RabbitMQ Management HTTP Stats][management
- messages_ready (int, count) - messages_ready (int, count)
- messages_redeliver (int, count) - messages_redeliver (int, count)
- messages_redeliver_rate (float, messages per second) - messages_redeliver_rate (float, messages per second)
- messages_unack (integer, count) - messages_unack (int, count)
- slave_nodes (int, count)
- synchronised_slave_nodes (int, count)
+ rabbitmq_exchange + rabbitmq_exchange
- tags: - tags:

View File

@ -132,6 +132,8 @@ type Queue struct {
Durable bool Durable bool
AutoDelete bool `json:"auto_delete"` AutoDelete bool `json:"auto_delete"`
IdleSince string `json:"idle_since"` IdleSince string `json:"idle_since"`
SlaveNodes []string `json:"slave_nodes"`
SynchronisedSlaveNodes []string `json:"synchronised_slave_nodes"`
} }
// Node ... // Node ...
@ -588,6 +590,8 @@ func gatherQueues(r *RabbitMQ, acc telegraf.Accumulator) {
"consumers": queue.Consumers, "consumers": queue.Consumers,
"consumer_utilisation": queue.ConsumerUtilisation, "consumer_utilisation": queue.ConsumerUtilisation,
"idle_since": queue.IdleSince, "idle_since": queue.IdleSince,
"slave_nodes": len(queue.SlaveNodes),
"synchronised_slave_nodes": len(queue.SynchronisedSlaveNodes),
"memory": queue.Memory, "memory": queue.Memory,
// messages information // messages information
"message_bytes": queue.MessageBytes, "message_bytes": queue.MessageBytes,

View File

@ -98,6 +98,8 @@ func TestRabbitMQGeneratesMetrics(t *testing.T) {
"messages_redeliver": 33, "messages_redeliver": 33,
"messages_redeliver_rate": 2.5, "messages_redeliver_rate": 2.5,
"idle_since": "2015-11-01 8:22:14", "idle_since": "2015-11-01 8:22:14",
"slave_nodes": 1,
"synchronised_slave_nodes": 1,
} }
compareMetrics(t, queuesMetrics, acc, "rabbitmq_queue") compareMetrics(t, queuesMetrics, acc, "rabbitmq_queue")

View File

@ -109,6 +109,12 @@
"exclusive_consumer_tag": null, "exclusive_consumer_tag": null,
"effective_policy_definition": [], "effective_policy_definition": [],
"operator_policy": null, "operator_policy": null,
"policy": null "policy": null,
"slave_nodes":[
"rabbit@ip-10-1-2-118"
],
"synchronised_slave_nodes":[
"rabbit@ip-10-1-2-118"
]
} }
] ]