Skip to content

Commit

Permalink
plugins/inputs/rabbitmq: add "cluster_nodes" and "running_nodes" fiel…
Browse files Browse the repository at this point in the history
…ds to the "rabbitmq_overview" measurement
  • Loading branch information
askainet committed Jan 19, 2018
1 parent 9971ca6 commit d9b0cd2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/inputs/rabbitmq/rabbitmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ type Node struct {
RunQueue int64 `json:"run_queue"`
SocketsTotal int64 `json:"sockets_total"`
SocketsUsed int64 `json:"sockets_used"`
Running int64 `json:"running"`
Running bool `json:"running"`
}

type Exchange struct {
Expand Down Expand Up @@ -337,6 +337,11 @@ func gatherNodes(r *RabbitMQ, acc telegraf.Accumulator) {
tags := map[string]string{"url": r.URL}
tags["node"] = node.Name

var running int64 = 0
if node.Running {
running = 1
}

fields := map[string]interface{}{
"disk_free": node.DiskFree,
"disk_free_limit": node.DiskFreeLimit,
Expand All @@ -349,7 +354,7 @@ func gatherNodes(r *RabbitMQ, acc telegraf.Accumulator) {
"run_queue": node.RunQueue,
"sockets_total": node.SocketsTotal,
"sockets_used": node.SocketsUsed,
"running": node.Running,
"running": running,
}
acc.AddFields("rabbitmq_node", fields, tags, now)
}
Expand Down

0 comments on commit d9b0cd2

Please sign in to comment.