@cryptotaxi247 / netdata-1 / commits / 2023ee01d

feat(go.d/rabbitmq): add cluster support (#18965)

Ilya Mashchenko committed Nov 8, 2024 at 16:42 UTC 2023ee01d864bad62cbf12046f1e7f5307720937
21 files changed +2938 -1616
src/go/plugin/go.d/modules/rabbitmq/cache.go new
+98
@@ -0,0 +1,98 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package rabbitmq
4 +
5 +func newCache() *cache {
6 + return &cache{
7 + nodes: make(map[string]*nodeCacheItem),
8 + vhosts: make(map[string]*vhostCacheItem),
9 + queues: make(map[string]*queueCacheItem),
10 + }
11 +}
12 +
13 +type (
14 + cache struct {
15 + overview struct{ hasCharts bool }
16 + nodes map[string]*nodeCacheItem
17 + vhosts map[string]*vhostCacheItem
18 + queues map[string]*queueCacheItem
19 + }
20 + nodeCacheItem struct {
21 + name string
22 + seen bool
23 + hasCharts bool
24 + peers map[string]*peerCacheItem
25 + }
26 + peerCacheItem struct {
27 + name string
28 + node string
29 + seen bool
30 + hasCharts bool
31 + }
32 + vhostCacheItem struct {
33 + name string
34 + seen bool
35 + hasCharts bool
36 + }
37 + queueCacheItem struct {
38 + name string
39 + node string
40 + vhost string
41 + typ string
42 + seen bool
43 + hasCharts bool
44 + }
45 +)
46 +
47 +func (c *cache) resetSeen() {
48 + for _, v := range c.nodes {
49 + v.seen = false
50 + for _, v := range v.peers {
51 + v.seen = false
52 + }
53 + }
54 + for _, v := range c.vhosts {
55 + v.seen = false
56 + }
57 + for _, v := range c.queues {
58 + v.seen = false
59 + }
60 +}
61 +
62 +func (c *cache) getNode(node apiNodeResp) *nodeCacheItem {
63 + v, ok := c.nodes[node.Name]
64 + if !ok {
65 + v = &nodeCacheItem{name: node.Name, peers: make(map[string]*peerCacheItem)}
66 + c.nodes[node.Name] = v
67 + }
68 + return v
69 +}
70 +
71 +func (c *cache) getNodeClusterPeer(node apiNodeResp, peer apiClusterPeer) *peerCacheItem {
72 + n := c.getNode(node)
73 + v, ok := n.peers[peer.Name]
74 + if !ok {
75 + v = &peerCacheItem{node: node.Name, name: peer.Name}
76 + n.peers[peer.Name] = v
77 + }
78 + return v
79 +}
80 +
81 +func (c *cache) getQueue(q apiQueueResp) *queueCacheItem {
82 + key := q.Node + "_" + q.Vhost + "_" + q.Name
83 + v, ok := c.queues[key]
84 + if !ok {
85 + v = &queueCacheItem{node: q.Node, name: q.Name, vhost: q.Vhost, typ: q.Type}
86 + c.queues[key] = v
87 + }
88 + return v
89 +}
90 +
91 +func (c *cache) getVhost(vhost string) *vhostCacheItem {
92 + v, ok := c.vhosts[vhost]
93 + if !ok {
94 + v = &vhostCacheItem{name: vhost}
95 + c.vhosts[vhost] = v
96 + }
97 + return v
98 +}
src/go/plugin/go.d/modules/rabbitmq/charts.go
+338 -113
@@ -4,6 +4,7 @@ package rabbitmq
4
5 import (
6 "fmt"
7 + "maps"
8 "strings"
9
10 "github.com/netdata/netdata/go/plugins/plugin/go.d/agent/module"
@@ -12,53 +13,38 @@ import (
13 const (
14 prioMessagesCount = module.Priority + iota
15 prioMessagesRate
15 -
16 prioObjectsCount
17 -
17 prioConnectionChurnRate
18 prioChannelChurnRate
19 prioQueueChurnRate
20
22 - prioFileDescriptorsCount
23 - prioSocketsCount
24 - prioErlangProcessesCount
25 - prioErlangRunQueueProcessesCount
26 - prioMemoryUsage
27 - prioDiskSpaceFreeSize
21 + prioNodeAvailStatus
22 + prioNodeMemAlarmStatus
23 + prioNodeDiskFreeAlarmStatus
24 + prioNodeFileDescriptorsUsage
25 + prioNodeSocketsUsage
26 + prioNodeErlangProcessesUsage
27 + prioNodeErlangRunQueueProcessesCount
28 + prioNodeMemoryUsage
29 + prioNodeDiskSpaceFreeSize
30 + prioNodeClusterLinkPeerTraffic
31 + prioNodeUptime
32
33 prioVhostMessagesCount
34 prioVhostMessagesRate
35 + prioVhostStatus
36
37 prioQueueMessagesCount
38 prioQueueMessagesRate
39 )
40
36 -var baseCharts = module.Charts{
41 +var overviewCharts = module.Charts{
42 chartMessagesCount.Copy(),
43 chartMessagesRate.Copy(),
39 -
44 chartObjectsCount.Copy(),
41 -
45 chartConnectionChurnRate.Copy(),
46 chartChannelChurnRate.Copy(),
47 chartQueueChurnRate.Copy(),
45 -
46 - chartFileDescriptorsCount.Copy(),
47 - chartSocketsCount.Copy(),
48 - chartErlangProcessesCount.Copy(),
49 - chartErlangRunQueueProcessesCount.Copy(),
50 - chartMemoryUsage.Copy(),
51 - chartDiskSpaceFreeSize.Copy(),
52 -}
53 -
54 -var chartsTmplVhost = module.Charts{
55 - chartTmplVhostMessagesCount.Copy(),
56 - chartTmplVhostMessagesRate.Copy(),
57 -}
58 -
59 -var chartsTmplQueue = module.Charts{
60 - chartTmplQueueMessagesCount.Copy(),
61 - chartTmplQueueMessagesRate.Copy(),
48 }
49
50 var (
@@ -91,6 +77,7 @@ var (
77 {ID: "message_stats_deliver", Name: "deliver", Algo: module.Incremental},
78 {ID: "message_stats_deliver_no_ack", Name: "deliver_no_ack", Algo: module.Incremental},
79 {ID: "message_stats_get", Name: "get", Algo: module.Incremental},
80 + {ID: "message_stats_get_empty", Name: "get_empty", Algo: module.Incremental},
81 {ID: "message_stats_get_no_ack", Name: "get_no_ack", Algo: module.Incremental},
82 {ID: "message_stats_deliver_get", Name: "deliver_get", Algo: module.Incremental},
83 {ID: "message_stats_redeliver", Name: "redeliver", Algo: module.Incremental},
@@ -152,84 +139,172 @@ var (
139 }
140 )
141
142 +var nodeChartsTmpl = module.Charts{
143 + nodeAvailStatusChartTmpl.Copy(),
144 + nodeMemAlarmStatusChartTmpl.Copy(),
145 + nodeDiskFreeAlarmStatusChartTmpl.Copy(),
146 + nodeFileDescriptorsUsageChartTmpl.Copy(),
147 + nodeSocketsUsageChartTmpl.Copy(),
148 + nodeErlangProcessesUsageChartTmpl.Copy(),
149 + nodeErlangRunQueueProcessesCountChartTmpl.Copy(),
150 + nodeMemoryUsageChartTmpl.Copy(),
151 + nodeDiskSpaceFreeSizeChartTmpl.Copy(),
152 + nodeUptimeChartTmpl.Copy(),
153 +}
154 +
155 var (
156 - chartFileDescriptorsCount = module.Chart{
157 - ID: "file_descriptors_count",
158 - Title: "File descriptors",
156 + nodeAvailStatusChartTmpl = module.Chart{
157 + ID: "node_%s_avail_status",
158 + Title: "Node Availability Status",
159 + Units: "status",
160 + Fam: "node status",
161 + Ctx: "rabbitmq.node_avail_status",
162 + Type: module.Line,
163 + Priority: prioNodeAvailStatus,
164 + Dims: module.Dims{
165 + {ID: "node_%s_avail_status_running", Name: "running"},
166 + {ID: "node_%s_avail_status_down", Name: "down"},
167 + },
168 + }
169 + nodeMemAlarmStatusChartTmpl = module.Chart{
170 + ID: "node_%s_mem_alarm_status",
171 + Title: "Node Memory Alarm Status",
172 + Units: "status",
173 + Fam: "node status",
174 + Ctx: "rabbitmq.node_mem_alarm_status",
175 + Type: module.Line,
176 + Priority: prioNodeMemAlarmStatus,
177 + Dims: module.Dims{
178 + {ID: "node_%s_mem_alarm_status_clear", Name: "clear"},
179 + {ID: "node_%s_mem_alarm_status_triggered", Name: "triggered"},
180 + },
181 + }
182 + nodeDiskFreeAlarmStatusChartTmpl = module.Chart{
183 + ID: "node_%s_disk_free_alarm_status",
184 + Title: "Node Disk Free Alarm Status",
185 + Units: "status",
186 + Fam: "node status",
187 + Ctx: "rabbitmq.node_disk_free_alarm_status",
188 + Type: module.Line,
189 + Priority: prioNodeDiskFreeAlarmStatus,
190 + Dims: module.Dims{
191 + {ID: "node_%s_disk_free_alarm_status_clear", Name: "clear"},
192 + {ID: "node_%s_disk_free_alarm_status_triggered", Name: "triggered"},
193 + },
194 + }
195 + nodeFileDescriptorsUsageChartTmpl = module.Chart{
196 + ID: "node_%s_file_descriptors_usage",
197 + Title: "Node File Descriptors Usage",
198 Units: "fd",
160 - Fam: "node stats",
161 - Ctx: "rabbitmq.file_descriptors_count",
199 + Fam: "node fds",
200 + Ctx: "rabbitmq.node_file_descriptors_usage",
201 Type: module.Stacked,
163 - Priority: prioFileDescriptorsCount,
202 + Priority: prioNodeFileDescriptorsUsage,
203 Dims: module.Dims{
165 - {ID: "fd_total", Name: "available"},
166 - {ID: "fd_used", Name: "used"},
204 + {ID: "node_%s_fds_used", Name: "used"},
205 },
206 }
169 - chartSocketsCount = module.Chart{
170 - ID: "sockets_used_count",
171 - Title: "Used sockets",
207 + nodeSocketsUsageChartTmpl = module.Chart{
208 + ID: "node_%s_sockets_used_usage",
209 + Title: "Node Sockets Usage",
210 Units: "sockets",
173 - Fam: "node stats",
174 - Ctx: "rabbitmq.sockets_count",
211 + Fam: "node sockets",
212 + Ctx: "rabbitmq.node_sockets_usage",
213 Type: module.Stacked,
176 - Priority: prioSocketsCount,
214 + Priority: prioNodeSocketsUsage,
215 Dims: module.Dims{
178 - {ID: "sockets_total", Name: "available"},
179 - {ID: "sockets_used", Name: "used"},
216 + {ID: "node_%s_sockets_used", Name: "used"},
217 },
218 }
182 - chartErlangProcessesCount = module.Chart{
183 - ID: "erlang_processes_count",
184 - Title: "Erlang processes",
219 + nodeErlangProcessesUsageChartTmpl = module.Chart{
220 + ID: "node_%s_erlang_processes_usage",
221 + Title: "Node Erlang Processes Usage",
222 Units: "processes",
186 - Fam: "node stats",
187 - Ctx: "rabbitmq.erlang_processes_count",
223 + Fam: "node erlang",
224 + Ctx: "rabbitmq.node_erlang_processes_usage",
225 Type: module.Stacked,
189 - Priority: prioErlangProcessesCount,
226 + Priority: prioNodeErlangProcessesUsage,
227 Dims: module.Dims{
191 - {ID: "proc_available", Name: "available"},
192 - {ID: "proc_used", Name: "used"},
228 + {ID: "node_%s_procs_used", Name: "used"},
229 },
230 }
195 - chartErlangRunQueueProcessesCount = module.Chart{
196 - ID: "erlang_run_queue_processes_count",
197 - Title: "Erlang run queue",
231 + nodeErlangRunQueueProcessesCountChartTmpl = module.Chart{
232 + ID: "node_%s_erlang_run_queue_processes_count",
233 + Title: "Node Erlang Run Queue",
234 Units: "processes",
199 - Fam: "node stats",
200 - Ctx: "rabbitmq.erlang_run_queue_processes_count",
201 - Priority: prioErlangRunQueueProcessesCount,
235 + Fam: "node erlang",
236 + Ctx: "rabbitmq.node_erlang_run_queue_processes_count",
237 + Priority: prioNodeErlangRunQueueProcessesCount,
238 Dims: module.Dims{
203 - {ID: "run_queue", Name: "length"},
239 + {ID: "node_%s_run_queue", Name: "length"},
240 },
241 }
206 - chartMemoryUsage = module.Chart{
207 - ID: "memory_usage",
208 - Title: "Memory",
242 + nodeMemoryUsageChartTmpl = module.Chart{
243 + ID: "node_%s_memory_usage",
244 + Title: "Node Memory Usage",
245 Units: "bytes",
210 - Fam: "node stats",
211 - Ctx: "rabbitmq.memory_usage",
212 - Priority: prioMemoryUsage,
246 + Fam: "node mem",
247 + Ctx: "rabbitmq.node_memory_usage",
248 + Priority: prioNodeMemoryUsage,
249 + Type: module.Area,
250 Dims: module.Dims{
214 - {ID: "mem_used", Name: "used"},
251 + {ID: "node_%s_mem_used", Name: "used"},
252 },
253 }
217 - chartDiskSpaceFreeSize = module.Chart{
218 - ID: "disk_space_free_size",
219 - Title: "Free disk space",
254 + nodeDiskSpaceFreeSizeChartTmpl = module.Chart{
255 + ID: "node_%s_disk_space_free_size",
256 + Title: "Node Disk Free Space",
257 Units: "bytes",
221 - Fam: "node stats",
222 - Ctx: "rabbitmq.disk_space_free_size",
258 + Fam: "node disk",
259 + Ctx: "rabbitmq.node_disk_space_free_size",
260 + Type: module.Area,
261 + Priority: prioNodeDiskSpaceFreeSize,
262 + Dims: module.Dims{
263 + {ID: "node_%s_disk_free_bytes", Name: "free"},
264 + },
265 + }
266 + nodeUptimeChartTmpl = module.Chart{
267 + ID: "node_%s_uptime",
268 + Title: "Node Uptime",
269 + Units: "seconds",
270 + Fam: "node uptime",
271 + Ctx: "rabbitmq.node_uptime",
272 + Type: module.Line,
273 + Priority: prioNodeUptime,
274 + Dims: module.Dims{
275 + {ID: "node_%s_uptime", Name: "uptime"},
276 + },
277 + }
278 +)
279 +
280 +var nodeClusterPeerChartsTmpl = module.Charts{
281 + nodeClusterLinkPeerTrafficChartTmpl.Copy(),
282 +}
283 +
284 +var (
285 + nodeClusterLinkPeerTrafficChartTmpl = module.Chart{
286 + ID: "node_%s_peer_%s_cluster_link_traffic",
287 + Title: "Node Cluster Link Peer Traffic",
288 + Units: "bytes/s",
289 + Fam: "node cluster link",
290 + Ctx: "rabbitmq.node_peer_cluster_link_traffic",
291 Type: module.Area,
224 - Priority: prioDiskSpaceFreeSize,
292 + Priority: prioNodeClusterLinkPeerTraffic,
293 Dims: module.Dims{
226 - {ID: "disk_free", Name: "free"},
294 + {ID: "node_%s_peer_%s_cluster_link_recv_bytes", Name: "received", Algo: module.Incremental},
295 + {ID: "node_%s_peer_%s_cluster_link_send_bytes", Name: "sent", Mul: -1, Algo: module.Incremental},
296 },
297 }
298 )
299
300 +var vhostChartsTmpl = module.Charts{
301 + vhostMessageCountChartTmpl.Copy(),
302 + vhostMessagesRateChartTmpl.Copy(),
303 + vhostStatusChartTmpl.Copy(),
304 +}
305 +
306 var (
232 - chartTmplVhostMessagesCount = module.Chart{
307 + vhostMessageCountChartTmpl = module.Chart{
308 ID: "vhost_%s_message_count",
309 Title: "Vhost messages",
310 Units: "messages",
@@ -242,7 +317,7 @@ var (
317 {ID: "vhost_%s_messages_unacknowledged", Name: "unacknowledged"},
318 },
319 }
245 - chartTmplVhostMessagesRate = module.Chart{
320 + vhostMessagesRateChartTmpl = module.Chart{
321 ID: "vhost_%s_message_stats",
322 Title: "Vhost messages rate",
323 Units: "messages/s",
@@ -261,11 +336,30 @@ var (
336 {ID: "vhost_%s_message_stats_return_unroutable", Name: "return_unroutable", Algo: module.Incremental},
337 },
338 }
339 + vhostStatusChartTmpl = module.Chart{
340 + ID: "vhost_%s_status",
341 + Title: "Vhost Status",
342 + Units: "status",
343 + Fam: "vhost status",
344 + Ctx: "rabbitmq.vhost_status",
345 + Type: module.Line,
346 + Priority: prioVhostStatus,
347 + Dims: module.Dims{
348 + {ID: "vhost_%s_status_running", Name: "running"},
349 + {ID: "vhost_%s_status_stopped", Name: "stopped"},
350 + {ID: "vhost_%s_status_partial", Name: "partial"},
351 + },
352 + }
353 )
354
355 +var queueChartsTmpl = module.Charts{
356 + queueMessagesCountChartTmpl.Copy(),
357 + queueMessagesRateChartTmpl.Copy(),
358 +}
359 +
360 var (
267 - chartTmplQueueMessagesCount = module.Chart{
268 - ID: "queue_%s_vhost_%s_message_count",
361 + queueMessagesCountChartTmpl = module.Chart{
362 + ID: "queue_%s_vhost_%s_node_%s_message_count",
363 Title: "Queue messages",
364 Units: "messages",
365 Fam: "queue messages",
@@ -273,14 +367,14 @@ var (
367 Type: module.Stacked,
368 Priority: prioQueueMessagesCount,
369 Dims: module.Dims{
276 - {ID: "queue_%s_vhost_%s_messages_ready", Name: "ready"},
277 - {ID: "queue_%s_vhost_%s_messages_unacknowledged", Name: "unacknowledged"},
278 - {ID: "queue_%s_vhost_%s_messages_paged_out", Name: "paged_out"},
279 - {ID: "queue_%s_vhost_%s_messages_persistent", Name: "persistent"},
370 + {ID: "queue_%s_vhost_%s_node_%s_messages_ready", Name: "ready"},
371 + {ID: "queue_%s_vhost_%s_node_%s_messages_unacknowledged", Name: "unacknowledged"},
372 + {ID: "queue_%s_vhost_%s_node_%s_messages_paged_out", Name: "paged_out"},
373 + {ID: "queue_%s_vhost_%s_node_%s_messages_persistent", Name: "persistent"},
374 },
375 }
282 - chartTmplQueueMessagesRate = module.Chart{
283 - ID: "queue_%s_vhost_%s_message_stats",
376 + queueMessagesRateChartTmpl = module.Chart{
377 + ID: "queue_%s_vhost_%s_node_%s_message_stats",
378 Title: "Queue messages rate",
379 Units: "messages/s",
380 Fam: "queue messages",
@@ -288,57 +382,180 @@ var (
382 Type: module.Stacked,
383 Priority: prioQueueMessagesRate,
384 Dims: module.Dims{
291 - {ID: "queue_%s_vhost_%s_message_stats_ack", Name: "ack", Algo: module.Incremental},
292 - {ID: "queue_%s_vhost_%s_message_stats_confirm", Name: "confirm", Algo: module.Incremental},
293 - {ID: "queue_%s_vhost_%s_message_stats_deliver", Name: "deliver", Algo: module.Incremental},
294 - {ID: "queue_%s_vhost_%s_message_stats_get", Name: "get", Algo: module.Incremental},
295 - {ID: "queue_%s_vhost_%s_message_stats_get_no_ack", Name: "get_no_ack", Algo: module.Incremental},
296 - {ID: "queue_%s_vhost_%s_message_stats_publish", Name: "publish", Algo: module.Incremental},
297 - {ID: "queue_%s_vhost_%s_message_stats_redeliver", Name: "redeliver", Algo: module.Incremental},
298 - {ID: "queue_%s_vhost_%s_message_stats_return_unroutable", Name: "return_unroutable", Algo: module.Incremental},
385 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_ack", Name: "ack", Algo: module.Incremental},
386 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_confirm", Name: "confirm", Algo: module.Incremental},
387 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_deliver", Name: "deliver", Algo: module.Incremental},
388 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_get", Name: "get", Algo: module.Incremental},
389 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_get_no_ack", Name: "get_no_ack", Algo: module.Incremental},
390 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_publish", Name: "publish", Algo: module.Incremental},
391 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_redeliver", Name: "redeliver", Algo: module.Incremental},
392 + {ID: "queue_%s_vhost_%s_node_%s_message_stats_return_unroutable", Name: "return_unroutable", Algo: module.Incremental},
393 },
394 }
395 )
396
303 -func (r *RabbitMQ) addVhostCharts(name string) {
304 - charts := chartsTmplVhost.Copy()
397 +func (r *RabbitMQ) updateCharts() {
398 + if !r.cache.overview.hasCharts {
399 + r.cache.overview.hasCharts = true
400 + r.addOverviewCharts()
401 + }
402 +
403 + maps.DeleteFunc(r.cache.nodes, func(_ string, node *nodeCacheItem) bool {
404 + if !node.seen {
405 + r.removeNodeCharts(node)
406 + return true
407 + }
408 + if !node.hasCharts {
409 + node.hasCharts = true
410 + r.addNodeCharts(node)
411 + }
412 + maps.DeleteFunc(node.peers, func(_ string, peer *peerCacheItem) bool {
413 + if !peer.seen {
414 + r.removeNodeClusterPeerCharts(peer)
415 + return true
416 + }
417 + if !peer.hasCharts {
418 + peer.hasCharts = true
419 + r.addNodeClusterPeerCharts(peer)
420 + }
421 + return false
422 + })
423 + return false
424 + })
425 +
426 + maps.DeleteFunc(r.cache.vhosts, func(_ string, vhost *vhostCacheItem) bool {
427 + if !vhost.seen {
428 + r.removeVhostCharts(vhost)
429 + return true
430 + }
431 + if !vhost.hasCharts {
432 + vhost.hasCharts = true
433 + r.addVhostCharts(vhost)
434 + }
435 + return false
436 + })
437 +
438 + maps.DeleteFunc(r.cache.queues, func(_ string, queue *queueCacheItem) bool {
439 + if !queue.seen {
440 + r.removeQueueCharts(queue)
441 + return true
442 + }
443 + if !queue.hasCharts {
444 + queue.hasCharts = true
445 + r.addQueueCharts(queue)
446 + }
447 + return false
448 + })
449 +}
450 +
451 +func (r *RabbitMQ) addOverviewCharts() {
452 + charts := overviewCharts.Copy()
453 +
454 + for _, chart := range *charts {
455 + chart.Labels = []module.Label{
456 + {Key: "cluster_id", Value: r.clusterId},
457 + {Key: "cluster_name", Value: r.clusterName},
458 + }
459 + }
460 +
461 + if err := r.Charts().Add(*charts...); err != nil {
462 + r.Warningf("failed to add overview charts: %v", err)
463 + }
464 +}
465 +
466 +func (r *RabbitMQ) addNodeCharts(node *nodeCacheItem) {
467 + charts := nodeChartsTmpl.Copy()
468
469 for _, chart := range *charts {
307 - chart.ID = fmt.Sprintf(chart.ID, forbiddenCharsReplacer.Replace(name))
470 + chart.ID = cleanChartId(fmt.Sprintf(chart.ID, node.name))
471 chart.Labels = []module.Label{
309 - {Key: "vhost", Value: name},
472 + {Key: "cluster_id", Value: r.clusterId},
473 + {Key: "cluster_name", Value: r.clusterName},
474 + {Key: "node", Value: node.name},
475 }
476 for _, dim := range chart.Dims {
312 - dim.ID = fmt.Sprintf(dim.ID, name)
477 + dim.ID = fmt.Sprintf(dim.ID, node.name)
478 }
479 }
480
481 if err := r.Charts().Add(*charts...); err != nil {
317 - r.Warning(err)
482 + r.Warningf("failed to add node charts: %v", err)
483 }
484 }
485
321 -func (r *RabbitMQ) removeVhostCharts(vhost string) {
322 - px := fmt.Sprintf("vhost_%s_", forbiddenCharsReplacer.Replace(vhost))
323 - for _, chart := range *r.Charts() {
324 - if strings.HasPrefix(chart.ID, px) {
325 - chart.MarkRemove()
326 - chart.MarkNotCreated()
486 +func (r *RabbitMQ) removeNodeCharts(node *nodeCacheItem) {
487 + px := fmt.Sprintf("node_%s_", node.name)
488 + r.removeCharts(px)
489 +}
490 +
491 +func (r *RabbitMQ) addNodeClusterPeerCharts(peer *peerCacheItem) {
492 + charts := nodeClusterPeerChartsTmpl.Copy()
493 +
494 + for _, chart := range *charts {
495 + chart.ID = cleanChartId(fmt.Sprintf(chart.ID, peer.node, peer.name))
496 + chart.Labels = []module.Label{
497 + {Key: "cluster_id", Value: r.clusterId},
498 + {Key: "cluster_name", Value: r.clusterName},
499 + {Key: "node", Value: peer.node},
500 + {Key: "peer", Value: peer.name},
501 + }
502 + for _, dim := range chart.Dims {
503 + dim.ID = fmt.Sprintf(dim.ID, peer.node, peer.name)
504 + }
505 + }
506 +
507 + if err := r.Charts().Add(*charts...); err != nil {
508 + r.Warningf("failed to add node cluster peer charts: %v", err)
509 + }
510 +
511 +}
512 +
513 +func (r *RabbitMQ) removeNodeClusterPeerCharts(peer *peerCacheItem) {
514 + px := fmt.Sprintf("node_%s_peer_%s_", peer.node, peer.name)
515 + r.removeCharts(px)
516 +}
517 +
518 +func (r *RabbitMQ) addVhostCharts(vhost *vhostCacheItem) {
519 + charts := vhostChartsTmpl.Copy()
520 +
521 + for _, chart := range *charts {
522 + chart.ID = cleanChartId(fmt.Sprintf(chart.ID, vhost.name))
523 + chart.Labels = []module.Label{
524 + {Key: "cluster_id", Value: r.clusterId},
525 + {Key: "cluster_name", Value: r.clusterName},
526 + {Key: "vhost", Value: vhost.name},
527 + }
528 + for _, dim := range chart.Dims {
529 + dim.ID = fmt.Sprintf(dim.ID, vhost.name)
530 }
531 }
532 +
533 + if err := r.Charts().Add(*charts...); err != nil {
534 + r.Warningf("failed to add vhost charts: %v", err)
535 + }
536 +}
537 +
538 +func (r *RabbitMQ) removeVhostCharts(vhost *vhostCacheItem) {
539 + px := fmt.Sprintf("vhost_%s_", vhost.name)
540 + r.removeCharts(px)
541 }
542
331 -func (r *RabbitMQ) addQueueCharts(queue, vhost string) {
332 - charts := chartsTmplQueue.Copy()
543 +func (r *RabbitMQ) addQueueCharts(q *queueCacheItem) {
544 + charts := queueChartsTmpl.Copy()
545
546 for _, chart := range *charts {
335 - chart.ID = fmt.Sprintf(chart.ID, forbiddenCharsReplacer.Replace(queue), forbiddenCharsReplacer.Replace(vhost))
547 + chart.ID = fmt.Sprintf(chart.ID, q.name, q.vhost, q.node)
548 + chart.ID = cleanChartId(chart.ID)
549 chart.Labels = []module.Label{
337 - {Key: "queue", Value: queue},
338 - {Key: "vhost", Value: vhost},
550 + {Key: "cluster_id", Value: r.clusterId},
551 + {Key: "cluster_name", Value: r.clusterName},
552 + {Key: "node", Value: q.node},
553 + {Key: "queue", Value: q.name},
554 + {Key: "vhost", Value: q.vhost},
555 + {Key: "type", Value: q.typ},
556 }
557 for _, dim := range chart.Dims {
341 - dim.ID = fmt.Sprintf(dim.ID, queue, vhost)
558 + dim.ID = fmt.Sprintf(dim.ID, q.name, q.vhost, q.node)
559 }
560 }
561
@@ -347,14 +564,22 @@ func (r *RabbitMQ) addQueueCharts(queue, vhost string) {
564 }
565 }
566
350 -func (r *RabbitMQ) removeQueueCharts(queue, vhost string) {
351 - px := fmt.Sprintf("queue_%s_vhost_%s_", forbiddenCharsReplacer.Replace(queue), forbiddenCharsReplacer.Replace(vhost))
567 +func (r *RabbitMQ) removeQueueCharts(q *queueCacheItem) {
568 + px := fmt.Sprintf("queue_%s_vhost_%s_node_%s_", q.name, q.vhost, q.node)
569 + r.removeCharts(px)
570 +}
571 +
572 +func (r *RabbitMQ) removeCharts(prefix string) {
573 + prefix = cleanChartId(prefix)
574 for _, chart := range *r.Charts() {
353 - if strings.HasPrefix(chart.ID, px) {
575 + if strings.HasPrefix(chart.ID, prefix) {
576 chart.MarkRemove()
577 chart.MarkNotCreated()
578 }
579 }
580 }
581
360 -var forbiddenCharsReplacer = strings.NewReplacer(" ", "_", ".", "_")
582 +func cleanChartId(id string) string {
583 + r := strings.NewReplacer(" ", "_", ".", "_")
584 + return r.Replace(id)
585 +}
src/go/plugin/go.d/modules/rabbitmq/collect.go
+52 -116
@@ -3,160 +3,96 @@
3 package rabbitmq
4
5 import (
6 + "encoding/json"
7 "fmt"
7 - "path/filepath"
8 + "net/http"
9 + "strings"
10
9 - "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/stm"
11 "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
12 )
13
13 -const (
14 - urlPathAPIOverview = "/api/overview"
15 - urlPathAPINodes = "/api/nodes/"
16 - urlPathAPIVhosts = "/api/vhosts"
17 - urlPathAPIQueues = "/api/queues"
18 -)
19 -
20 -// TODO: there is built-in prometheus collector since v3.8.0 (https://www.rabbitmq.com/prometheus.html).
21 -// Should use it (in addition?), it is the recommended option according to the docs.
14 func (r *RabbitMQ) collect() (map[string]int64, error) {
15 + if r.clusterName == "" {
16 + id, name, err := r.getClusterMeta()
17 + if err != nil {
18 + return nil, err
19 + }
20 + r.clusterId = id
21 + r.clusterName = name
22 + }
23 +
24 + r.cache.resetSeen()
25 +
26 mx := make(map[string]int64)
27
25 - if err := r.collectOverviewStats(mx); err != nil {
28 + if err := r.collectOverview(mx); err != nil {
29 return nil, err
30 }
28 - if err := r.collectNodeStats(mx); err != nil {
31 + if err := r.collectNodes(mx); err != nil {
32 return mx, err
33 }
31 - if err := r.collectVhostsStats(mx); err != nil {
34 + if err := r.collectVhosts(mx); err != nil {
35 return mx, err
36 }
37 if r.CollectQueues {
35 - if err := r.collectQueuesStats(mx); err != nil {
38 + if err := r.collectQueues(mx); err != nil {
39 return mx, err
40 }
41 }
42
43 + r.updateCharts()
44 +
45 return mx, nil
46 }
47
43 -func (r *RabbitMQ) collectOverviewStats(mx map[string]int64) error {
44 - req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPIOverview)
48 +func (r *RabbitMQ) getClusterMeta() (id string, name string, err error) {
49 + req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPIDefinitions)
50 if err != nil {
46 - return fmt.Errorf("failed to create overview stats request: %w", err)
51 + return "", "", fmt.Errorf("failed to create definitions request: %w", err)
52 }
53
49 - var stats overviewStats
50 - if err := web.DoHTTP(r.httpClient).RequestJSON(req, &stats); err != nil {
51 - return err
52 - }
54 + var resp apiDefinitionsResp
55
54 - if r.nodeName == "" {
55 - r.nodeName = stats.Node
56 + if err := r.webClient().RequestJSON(req, &resp); err != nil {
57 + return "", "", err
58 }
59
58 - for k, v := range stm.ToMap(stats) {
59 - mx[k] = v
60 + if resp.RabbitmqVersion == "" {
61 + return "", "", fmt.Errorf("unexpected response: rabbitmq version is empty")
62 }
63
62 - return nil
63 -}
64 -
65 -func (r *RabbitMQ) collectNodeStats(mx map[string]int64) error {
66 - if r.nodeName == "" {
67 - return nil
68 - }
64 + id = "unknown"
65 + name = "unset"
66
70 - req, err := web.NewHTTPRequestWithPath(r.RequestConfig, filepath.Join(urlPathAPINodes, r.nodeName))
71 - if err != nil {
72 - return fmt.Errorf("failed to create node stats request: %w", err)
73 - }
74 -
75 - var stats nodeStats
76 - if err := web.DoHTTP(r.httpClient).RequestJSON(req, &stats); err != nil {
77 - return err
78 - }
79 -
80 - for k, v := range stm.ToMap(stats) {
81 - mx[k] = v
67 + for _, v := range resp.GlobalParams {
68 + switch v.Name {
69 + case "cluster_name":
70 + name, _ = v.Value.(string)
71 + case "internal_cluster_id":
72 + id, _ = v.Value.(string)
73 + id = strings.TrimPrefix(id, "rabbitmq-cluster-id-")
74 + }
75 }
83 - mx["proc_available"] = stats.ProcTotal - stats.ProcUsed
76
85 - return nil
77 + return id, name, nil
78 }
79
88 -func (r *RabbitMQ) collectVhostsStats(mx map[string]int64) error {
89 - req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPIVhosts)
90 - if err != nil {
91 - return fmt.Errorf("failed to create vhosts stats request: %w", err)
92 - }
93 -
94 - var stats []vhostStats
95 - if err := web.DoHTTP(r.httpClient).RequestJSON(req, &stats); err != nil {
96 - return err
97 - }
98 -
99 - seen := make(map[string]bool)
100 -
101 - for _, vhost := range stats {
102 - seen[vhost.Name] = true
103 - for k, v := range stm.ToMap(vhost) {
104 - mx[fmt.Sprintf("vhost_%s_%s", vhost.Name, k)] = v
105 - }
106 - }
107 -
108 - for name := range seen {
109 - if !r.vhosts[name] {
110 - r.vhosts[name] = true
111 - r.Debugf("new vhost name='%s': creating charts", name)
112 - r.addVhostCharts(name)
80 +func (r *RabbitMQ) webClient() *web.Client {
81 + return web.DoHTTP(r.httpClient).OnNokCode(func(resp *http.Response) (bool, error) {
82 + var msg struct {
83 + Error string `json:"error"`
84 + Reason string `json:"reason"`
85 }
114 - }
115 - for name := range r.vhosts {
116 - if !seen[name] {
117 - delete(r.vhosts, name)
118 - r.Debugf("stale vhost name='%s': removing charts", name)
119 - r.removeVhostCharts(name)
86 + if err := json.NewDecoder(resp.Body).Decode(&msg); err == nil && msg.Error != "" {
87 + return false, fmt.Errorf("err '%s', reason '%s'", msg.Error, msg.Reason)
88 }
121 - }
122 -
123 - return nil
89 + return false, nil
90 + })
91 }
92
126 -func (r *RabbitMQ) collectQueuesStats(mx map[string]int64) error {
127 - req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPIQueues)
128 - if err != nil {
129 - return fmt.Errorf("failed to create queues stats request: %w", err)
130 - }
131 -
132 - var stats []queueStats
133 - if err := web.DoHTTP(r.httpClient).RequestJSON(req, &stats); err != nil {
134 - return err
93 +func boolToInt(b bool) int64 {
94 + if b {
95 + return 1
96 }
136 -
137 - seen := make(map[string]queueCache)
138 -
139 - for _, queue := range stats {
140 - seen[queue.Name+"|"+queue.Vhost] = queueCache{name: queue.Name, vhost: queue.Vhost}
141 - for k, v := range stm.ToMap(queue) {
142 - mx[fmt.Sprintf("queue_%s_vhost_%s_%s", queue.Name, queue.Vhost, k)] = v
143 - }
144 - }
145 -
146 - for key, queue := range seen {
147 - if _, ok := r.queues[key]; !ok {
148 - r.queues[key] = queue
149 - r.Debugf("new queue name='%s', vhost='%s': creating charts", queue.name, queue.vhost)
150 - r.addQueueCharts(queue.name, queue.vhost)
151 - }
152 - }
153 - for key, queue := range r.queues {
154 - if _, ok := seen[key]; !ok {
155 - delete(r.queues, key)
156 - r.Debugf("stale queue name='%s', vhost='%s': removing charts", queue.name, queue.vhost)
157 - r.removeQueueCharts(queue.name, queue.vhost)
158 - }
159 - }
160 -
161 - return nil
97 + return 0
98 }
src/go/plugin/go.d/modules/rabbitmq/collect_nodes.go new
+61
@@ -0,0 +1,61 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package rabbitmq
4 +
5 +import (
6 + "fmt"
7 +
8 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
9 +)
10 +
11 +func (r *RabbitMQ) collectNodes(mx map[string]int64) error {
12 + req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPINodes)
13 + if err != nil {
14 + return fmt.Errorf("failed to create node stats request: %w", err)
15 + }
16 +
17 + var resp []apiNodeResp
18 +
19 + if err := r.webClient().RequestJSON(req, &resp); err != nil {
20 + return err
21 + }
22 +
23 + for _, node := range resp {
24 + r.cache.getNode(node).seen = true
25 +
26 + px := fmt.Sprintf("node_%s_", node.Name)
27 +
28 + mx[px+"avail_status_running"] = boolToInt(node.Running)
29 + mx[px+"avail_status_down"] = boolToInt(!node.Running)
30 +
31 + if !node.Running || node.OsPid == "" {
32 + continue
33 + }
34 +
35 + mx[px+"mem_alarm_status_clear"] = boolToInt(!node.MemAlarm)
36 + mx[px+"mem_alarm_status_triggered"] = boolToInt(node.MemAlarm)
37 + mx[px+"disk_free_alarm_status_clear"] = boolToInt(!node.DiskFreeAlarm)
38 + mx[px+"disk_free_alarm_status_triggered"] = boolToInt(node.DiskFreeAlarm)
39 +
40 + mx[px+"fds_available"] = node.FDTotal - node.FDUsed
41 + mx[px+"fds_used"] = node.FDUsed
42 + mx[px+"mem_available"] = node.MemLimit - node.MemUsed
43 + mx[px+"mem_used"] = node.MemUsed
44 + mx[px+"sockets_available"] = node.SocketsTotal - node.SocketsUsed
45 + mx[px+"sockets_used"] = node.SocketsUsed
46 + mx[px+"procs_available"] = node.ProcTotal - node.ProcUsed
47 + mx[px+"procs_used"] = node.ProcUsed
48 + mx[px+"disk_free_bytes"] = node.DiskFree
49 + mx[px+"run_queue"] = node.RunQueue
50 + mx[px+"uptime"] = node.Uptime / 1000 // ms to seconds
51 +
52 + for _, peer := range node.ClusterLinks {
53 + r.cache.getNodeClusterPeer(node, peer).seen = true
54 +
55 + mx[px+"peer_"+peer.Name+"_cluster_link_recv_bytes"] = peer.RecvBytes
56 + mx[px+"peer_"+peer.Name+"_cluster_link_send_bytes"] = peer.SendBytes
57 + }
58 + }
59 +
60 + return nil
61 +}
src/go/plugin/go.d/modules/rabbitmq/collect_overview.go new
+29
@@ -0,0 +1,29 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package rabbitmq
4 +
5 +import (
6 + "fmt"
7 +
8 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/stm"
9 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
10 +)
11 +
12 +func (r *RabbitMQ) collectOverview(mx map[string]int64) error {
13 + req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPIOverview)
14 + if err != nil {
15 + return fmt.Errorf("failed to create overview stats request: %w", err)
16 + }
17 +
18 + var resp apiOverviewResp
19 +
20 + if err := r.webClient().RequestJSON(req, &resp); err != nil {
21 + return err
22 + }
23 +
24 + for k, v := range stm.ToMap(resp) {
25 + mx[k] = v
26 + }
27 +
28 + return nil
29 +}
src/go/plugin/go.d/modules/rabbitmq/collect_queues.go new
+35
@@ -0,0 +1,35 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package rabbitmq
4 +
5 +import (
6 + "fmt"
7 +
8 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/stm"
9 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
10 +)
11 +
12 +func (r *RabbitMQ) collectQueues(mx map[string]int64) error {
13 + req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPIQueues)
14 + if err != nil {
15 + return fmt.Errorf("failed to create queues stats request: %w", err)
16 + }
17 +
18 + var resp []apiQueueResp
19 +
20 + if err := r.webClient().RequestJSON(req, &resp); err != nil {
21 + return err
22 + }
23 +
24 + for _, q := range resp {
25 + r.cache.getQueue(q).seen = true
26 +
27 + px := fmt.Sprintf("queue_%s_vhost_%s_node_%s_", q.Name, q.Vhost, q.Node)
28 +
29 + for k, v := range stm.ToMap(q) {
30 + mx[px+k] = v
31 + }
32 + }
33 +
34 + return nil
35 +}
src/go/plugin/go.d/modules/rabbitmq/collect_vhosts.go new
+64
@@ -0,0 +1,64 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package rabbitmq
4 +
5 +import (
6 + "fmt"
7 +
8 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/stm"
9 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
10 +)
11 +
12 +func (r *RabbitMQ) collectVhosts(mx map[string]int64) error {
13 + req, err := web.NewHTTPRequestWithPath(r.RequestConfig, urlPathAPIVhosts)
14 + if err != nil {
15 + return fmt.Errorf("failed to create vhosts stats request: %w", err)
16 + }
17 +
18 + var resp []apiVhostResp
19 +
20 + if err := r.webClient().RequestJSON(req, &resp); err != nil {
21 + return err
22 + }
23 +
24 + for _, vhost := range resp {
25 + r.cache.getVhost(vhost.Name).seen = true
26 +
27 + px := fmt.Sprintf("vhost_%s_", vhost.Name)
28 +
29 + for k, v := range stm.ToMap(vhost) {
30 + mx[px+k] = v
31 + }
32 +
33 + for _, v := range []string{"running", "stopped", "partial"} {
34 + mx[px+"status_"+v] = 0
35 + }
36 + mx[px+"status_"+getVhostStatus(vhost)] = 1
37 + }
38 +
39 + return nil
40 +}
41 +
42 +func getVhostStatus(vhost apiVhostResp) string {
43 + // https://github.com/rabbitmq/rabbitmq-server/blob/c8394095990c2eb9e2f4b142e7816a653c9e5011/deps/rabbitmq_management/priv/www/js/formatters.js#L1058
44 +
45 + var ok, nok int
46 +
47 + for _, v := range vhost.ClusterState {
48 + switch v {
49 + case "stopped", "nodedown":
50 + nok++
51 + case "running":
52 + ok++
53 + }
54 + }
55 +
56 + switch {
57 + case nok == 0:
58 + return "running"
59 + case ok == 0:
60 + return "stopped"
61 + default:
62 + return "partial"
63 + }
64 +}
src/go/plugin/go.d/modules/rabbitmq/metadata.yaml
+106 -29
@@ -27,8 +27,9 @@ modules:
27 It collects data using an HTTP-based API provided by the [management plugin](https://www.rabbitmq.com/management.html).
28 The following endpoints are used:
29
30 + - `/api/definitions` (one-time retrieval, used to obtain the cluster ID and name)
31 - `/api/overview`
31 - - `/api/node/{node_name}`
32 + - `/api/nodes`
33 - `/api/vhosts`
34 - `/api/queues` (disabled by default)
35 method_description: ""
@@ -176,9 +177,13 @@ modules:
177 description: ""
178 availability: []
179 scopes:
179 - - name: global
180 - description: These metrics refer to the entire monitored application.
181 - labels: []
180 + - name: cluster
181 + description: These metrics refer to the RabbitMQ Cluster.
182 + labels:
183 + - name: cluster_id
184 + description: Unique identifier for the cluster, automatically assigned by RabbitMQ.
185 + - name: cluster_name
186 + description: User-defined name of the cluster as set using `rabbitmqctl set_cluster_name`. If not set, it will be "unset".
187 metrics:
188 - name: rabbitmq.messages_count
189 description: Messages
@@ -200,6 +205,7 @@ modules:
205 - name: deliver
206 - name: deliver_no_ack
207 - name: get
208 + - name: get_empty
209 - name: get_no_ack
210 - name: deliver_get
211 - name: redeliver
@@ -236,55 +242,112 @@ modules:
242 - name: created
243 - name: deleted
244 - name: declared
239 - - name: rabbitmq.file_descriptors_count
240 - description: File descriptors
245 + - name: node
246 + description: These metrics refer to the RabbitMQ node.
247 + labels:
248 + - name: cluster_id
249 + description: Unique identifier for the cluster, automatically assigned by RabbitMQ.
250 + - name: cluster_name
251 + description: User-defined name of the cluster as set using `rabbitmqctl set_cluster_name <NAME>`. If not set, it will be "unset".
252 + - name: node
253 + description: Name of the node.
254 + metrics:
255 + - name: rabbitmq.node_avail_status
256 + description: Node Availability Status
257 + unit: status
258 + chart_type: line
259 + dimensions:
260 + - name: running
261 + - name: down
262 + - name: rabbitmq.node_mem_alarm_status
263 + description: Node Memory Alarm Status
264 + unit: status
265 + chart_type: line
266 + dimensions:
267 + - name: clear
268 + - name: triggered
269 + - name: rabbitmq.node_disk_free_alarm_status
270 + description: Node Disk Free Alarm Status
271 + unit: status
272 + chart_type: line
273 + dimensions:
274 + - name: clear
275 + - name: triggered
276 + - name: rabbitmq.node_file_descriptors_usage
277 + description: Node File Descriptors Usage
278 unit: fd
242 - chart_type: stacked
279 + chart_type: line
280 dimensions:
244 - - name: available
281 - name: used
246 - - name: rabbitmq.sockets_count
247 - description: Used sockets
282 + - name: rabbitmq.node_sockets_usage
283 + description: Node Sockets Usage
284 unit: sockets
249 - chart_type: stacked
285 + chart_type: line
286 dimensions:
251 - - name: available
287 - name: used
253 - - name: rabbitmq.erlang_processes_count
254 - description: Erlang processes
288 + - name: rabbitmq.node_erlang_processes_usage
289 + description: Node Erlang Processes Usage
290 unit: processes
256 - chart_type: stacked
291 + chart_type: line
292 dimensions:
258 - - name: available
293 - name: used
260 - - name: rabbitmq.erlang_run_queue_processes_count
261 - description: Erlang run queue
294 + - name: rabbitmq.node_erlang_run_queue_processes_count
295 + description: Node Erlang Run Queue
296 unit: processes
297 chart_type: line
298 dimensions:
299 - name: length
266 - - name: rabbitmq.memory_usage
267 - description: Memory
300 + - name: rabbitmq.node_memory_usage
301 + description: Node Memory Usage
302 unit: bytes
269 - chart_type: line
303 + chart_type: area
304 dimensions:
305 - name: used
272 - - name: rabbitmq.disk_space_free_size
273 - description: Free disk space
306 + - name: rabbitmq.node_disk_space_free_size
307 + description: Node Disk Free Space
308 unit: bytes
275 - chart_type: line
309 + chart_type: area
310 dimensions:
311 - name: free
312 + - name: rabbitmq.node_uptime
313 + description: Node Uptime
314 + unit: seconds
315 + chart_type: line
316 + dimensions:
317 + - name: uptime
318 + - name: cluster peer
319 + description: These metrics refer to the RabbiMQ cluster peer.
320 + labels:
321 + - name: cluster_id
322 + description: Unique identifier for the cluster, automatically assigned by RabbitMQ.
323 + - name: cluster_name
324 + description: User-defined name of the cluster as set using `rabbitmqctl set_cluster_name <NAME>`. If not set, it will be "unset".
325 + - name: node
326 + description: Name of the node.
327 + - name: peer
328 + description: Name of the remote node in the cluster.
329 + metrics:
330 + - name: rabbitmq.node_peer_cluster_link_traffic
331 + description: Node Cluster Link Peer Traffic
332 + unit: bytes/s
333 + chart_type: area
334 + dimensions:
335 + - name: received
336 + - name: sent
337 - name: vhost
338 description: These metrics refer to the virtual host.
339 labels:
340 + - name: cluster_id
341 + description: Unique identifier for the cluster, automatically assigned by RabbitMQ.
342 + - name: cluster_name
343 + description: User-defined name of the cluster as set using `rabbitmqctl set_cluster_name <NAME>`. If not set, it will be "unset".
344 - name: vhost
282 - description: virtual host name
345 + description: Name of the virtual host.
346 metrics:
347 - name: rabbitmq.vhost_messages_count
348 description: Vhost messages
349 unit: messages
287 - chart_type: line
350 + chart_type: stacked
351 dimensions:
352 - name: ready
353 - name: unacknowledged
@@ -305,18 +368,32 @@ modules:
368 - name: deliver_get
369 - name: redeliver
370 - name: return_unroutable
371 + - name: rabbitmq.vhost_status
372 + description: Vhost Status
373 + unit: status
374 + chart_type: line
375 + dimensions:
376 + - name: running
377 + - name: stopped
378 + - name: partial
379 - name: queue
380 description: These metrics refer to the virtual host queue.
381 labels:
382 + - name: cluster_id
383 + description: Unique identifier for the cluster, automatically assigned by RabbitMQ.
384 + - name: cluster_name
385 + description: User-defined name of the cluster as set using `rabbitmqctl set_cluster_name <NAME>`. If not set, it will be "unset".
386 + - name: node
387 + description: Name of the node.
388 - name: vhost
312 - description: virtual host name
389 + description: Name of the virtual host.
390 - name: queue
314 - description: queue name
391 + description: Name of the queue.
392 metrics:
393 - name: rabbitmq.queue_messages_count
394 description: Queue messages
395 unit: messages
319 - chart_type: line
396 + chart_type: stacked
397 dimensions:
398 - name: ready
399 - name: unacknowledged
src/go/plugin/go.d/modules/rabbitmq/metrics.go deleted
-82
@@ -1,82 +0,0 @@
1 -// SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -package rabbitmq
4 -
5 -// https://www.rabbitmq.com/monitoring.html#cluster-wide-metrics
6 -type overviewStats struct {
7 - ObjectTotals struct {
8 - Consumers int64 `json:"consumers" stm:"consumers"`
9 - Queues int64 `json:"queues" stm:"queues"`
10 - Exchanges int64 `json:"exchanges" stm:"exchanges"`
11 - Connections int64 `json:"connections" stm:"connections"`
12 - Channels int64 `json:"channels" stm:"channels"`
13 - } `json:"object_totals" stm:"object_totals"`
14 - ChurnRates struct {
15 - ChannelClosed int64 `json:"channel_closed" stm:"channel_closed"`
16 - ChannelCreated int64 `json:"channel_created" stm:"channel_created"`
17 - ConnectionClosed int64 `json:"connection_closed" stm:"connection_closed"`
18 - ConnectionCreated int64 `json:"connection_created" stm:"connection_created"`
19 - QueueCreated int64 `json:"queue_created" stm:"queue_created"`
20 - QueueDeclared int64 `json:"queue_declared" stm:"queue_declared"`
21 - QueueDeleted int64 `json:"queue_deleted" stm:"queue_deleted"`
22 - } `json:"churn_rates" stm:"churn_rates"`
23 - QueueTotals struct {
24 - Messages int64 `json:"messages" stm:"messages"`
25 - MessagesReady int64 `json:"messages_ready" stm:"messages_ready"`
26 - MessagesUnacknowledged int64 `json:"messages_unacknowledged" stm:"messages_unacknowledged"`
27 - } `json:"queue_totals" stm:"queue_totals"`
28 - MessageStats messageStats `json:"message_stats" stm:"message_stats"`
29 - Node string
30 -}
31 -
32 -// https://www.rabbitmq.com/monitoring.html#node-metrics
33 -type nodeStats struct {
34 - FDTotal int64 `json:"fd_total" stm:"fd_total"`
35 - FDUsed int64 `json:"fd_used" stm:"fd_used"`
36 - MemLimit int64 `json:"mem_limit" stm:"mem_limit"`
37 - MemUsed int64 `json:"mem_used" stm:"mem_used"`
38 - SocketsTotal int64 `json:"sockets_total" stm:"sockets_total"`
39 - SocketsUsed int64 `json:"sockets_used" stm:"sockets_used"`
40 - ProcTotal int64 `json:"proc_total" stm:"proc_total"`
41 - ProcUsed int64 `json:"proc_used" stm:"proc_used"`
42 - DiskFree int64 `json:"disk_free" stm:"disk_free"`
43 - RunQueue int64 `json:"run_queue" stm:"run_queue"`
44 -}
45 -
46 -type vhostStats struct {
47 - Name string `json:"name"`
48 - Messages int64 `json:"messages" stm:"messages"`
49 - MessagesReady int64 `json:"messages_ready" stm:"messages_ready"`
50 - MessagesUnacknowledged int64 `json:"messages_unacknowledged" stm:"messages_unacknowledged"`
51 - MessageStats messageStats `json:"message_stats" stm:"message_stats"`
52 -}
53 -
54 -// https://www.rabbitmq.com/monitoring.html#queue-metrics
55 -type queueStats struct {
56 - Name string `json:"name"`
57 - Vhost string `json:"vhost"`
58 - State string `json:"state"`
59 - Type string `json:"type"`
60 - Messages int64 `json:"messages" stm:"messages"`
61 - MessagesReady int64 `json:"messages_ready" stm:"messages_ready"`
62 - MessagesUnacknowledged int64 `json:"messages_unacknowledged" stm:"messages_unacknowledged"`
63 - MessagesPagedOut int64 `json:"messages_paged_out" stm:"messages_paged_out"`
64 - MessagesPersistent int64 `json:"messages_persistent" stm:"messages_persistent"`
65 - MessageStats messageStats `json:"message_stats" stm:"message_stats"`
66 -}
67 -
68 -// https://rawcdn.githack.com/rabbitmq/rabbitmq-server/v3.11.5/deps/rabbitmq_management/priv/www/api/index.html
69 -type messageStats struct {
70 - Ack int64 `json:"ack" stm:"ack"`
71 - Publish int64 `json:"publish" stm:"publish"`
72 - PublishIn int64 `json:"publish_in" stm:"publish_in"`
73 - PublishOut int64 `json:"publish_out" stm:"publish_out"`
74 - Confirm int64 `json:"confirm" stm:"confirm"`
75 - Deliver int64 `json:"deliver" stm:"deliver"`
76 - DeliverNoAck int64 `json:"deliver_no_ack" stm:"deliver_no_ack"`
77 - Get int64 `json:"get" stm:"get"`
78 - GetNoAck int64 `json:"get_no_ack" stm:"get_no_ack"`
79 - DeliverGet int64 `json:"deliver_get" stm:"deliver_get"`
80 - Redeliver int64 `json:"redeliver" stm:"redeliver"`
81 - ReturnUnroutable int64 `json:"return_unroutable" stm:"return_unroutable"`
82 -}
src/go/plugin/go.d/modules/rabbitmq/rabbitmq.go
+6 -9
@@ -40,9 +40,9 @@ func New() *RabbitMQ {
40 },
41 CollectQueues: false,
42 },
43 - charts: baseCharts.Copy(),
44 - vhosts: make(map[string]bool),
45 - queues: make(map[string]queueCache),
43 +
44 + charts: &module.Charts{},
45 + cache: newCache(),
46 }
47 }
48
@@ -61,12 +61,9 @@ type (
61
62 httpClient *http.Client
63
64 - nodeName string
65 - vhosts map[string]bool
66 - queues map[string]queueCache
67 - }
68 - queueCache struct {
69 - name, vhost string
64 + clusterName string
65 + clusterId string
66 + cache *cache
67 }
68 )
69
src/go/plugin/go.d/modules/rabbitmq/rabbitmq_test.go
+276 -215
@@ -6,7 +6,6 @@ import (
6 "net/http"
7 "net/http/httptest"
8 "os"
9 - "path/filepath"
9 "testing"
10
11 "github.com/netdata/netdata/go/plugins/plugin/go.d/agent/module"
@@ -20,20 +19,22 @@ var (
19 dataConfigJSON, _ = os.ReadFile("testdata/config.json")
20 dataConfigYAML, _ = os.ReadFile("testdata/config.yaml")
21
23 - dataOverviewStats, _ = os.ReadFile("testdata/v3.11.5/api-overview.json")
24 - dataNodeStats, _ = os.ReadFile("testdata/v3.11.5/api-nodes-node.json")
25 - dataVhostsStats, _ = os.ReadFile("testdata/v3.11.5/api-vhosts.json")
26 - dataQueuesStats, _ = os.ReadFile("testdata/v3.11.5/api-queues.json")
22 + dataClusterDefinitions, _ = os.ReadFile("testdata/v4.0.3/cluster/definitions.json")
23 + dataClusterOverview, _ = os.ReadFile("testdata/v4.0.3/cluster/overview.json")
24 + dataClusterNodes, _ = os.ReadFile("testdata/v4.0.3/cluster/nodes.json")
25 + dataClusterVhosts, _ = os.ReadFile("testdata/v4.0.3/cluster/vhosts.json")
26 + dataClusterQueues, _ = os.ReadFile("testdata/v4.0.3/cluster/queues.json")
27 )
28
29 func Test_testDataIsValid(t *testing.T) {
30 for name, data := range map[string][]byte{
31 - "dataConfigJSON": dataConfigJSON,
32 - "dataConfigYAML": dataConfigYAML,
33 - "dataOverviewStats": dataOverviewStats,
34 - "dataNodeStats": dataNodeStats,
35 - "dataVhostsStats": dataVhostsStats,
36 - "dataQueuesStats": dataQueuesStats,
31 + "dataConfigJSON": dataConfigJSON,
32 + "dataConfigYAML": dataConfigYAML,
33 + "dataClusterDefinitions": dataClusterDefinitions,
34 + "dataClusterOverview": dataClusterOverview,
35 + "dataClusterNodes": dataClusterNodes,
36 + "dataClusterVhosts": dataClusterVhosts,
37 + "dataClusterQueues": dataClusterQueues,
38 } {
39 require.NotNil(t, data, name)
40 }
@@ -64,13 +65,13 @@ func TestRabbitMQ_Init(t *testing.T) {
65
66 for name, test := range tests {
67 t.Run(name, func(t *testing.T) {
67 - rabbit := New()
68 - rabbit.Config = test.config
68 + rmq := New()
69 + rmq.Config = test.config
70
71 if test.wantFail {
71 - assert.Error(t, rabbit.Init())
72 + assert.Error(t, rmq.Init())
73 } else {
73 - assert.NoError(t, rabbit.Init())
74 + assert.NoError(t, rmq.Init())
75 }
76 })
77 }
@@ -83,10 +84,10 @@ func TestRabbitMQ_Charts(t *testing.T) {
84 func TestRabbitMQ_Cleanup(t *testing.T) {
85 assert.NotPanics(t, New().Cleanup)
86
86 - rabbit := New()
87 - require.NoError(t, rabbit.Init())
87 + rmq := New()
88 + require.NoError(t, rmq.Init())
89
89 - assert.NotPanics(t, rabbit.Cleanup)
90 + assert.NotPanics(t, rmq.Cleanup)
91 }
92
93 func TestRabbitMQ_Check(t *testing.T) {
@@ -94,22 +95,22 @@ func TestRabbitMQ_Check(t *testing.T) {
95 prepare func() (*RabbitMQ, func())
96 wantFail bool
97 }{
97 - "success on valid response": {wantFail: false, prepare: caseSuccessAllRequests},
98 + "success on valid response": {wantFail: false, prepare: caseClusterOk},
99 "fails on invalid response": {wantFail: true, prepare: caseInvalidDataResponse},
100 "fails on 404": {wantFail: true, prepare: case404},
101 }
102
103 for name, test := range tests {
104 t.Run(name, func(t *testing.T) {
104 - rabbit, cleanup := test.prepare()
105 + rmq, cleanup := test.prepare()
106 defer cleanup()
107
107 - require.NoError(t, rabbit.Init())
108 + require.NoError(t, rmq.Init())
109
110 if test.wantFail {
110 - assert.Error(t, rabbit.Check())
111 + assert.Error(t, rmq.Check())
112 } else {
112 - assert.NoError(t, rabbit.Check())
113 + assert.NoError(t, rmq.Check())
114 }
115 })
116 }
@@ -121,197 +122,277 @@ func TestRabbitMQ_Collect(t *testing.T) {
122 wantCollected map[string]int64
123 wantCharts int
124 }{
124 - "success on valid response": {
125 - prepare: caseSuccessAllRequests,
126 - wantCharts: len(baseCharts) + len(chartsTmplVhost)*3 + len(chartsTmplQueue)*4,
125 + "case cluster ok ": {
126 + prepare: caseClusterOk,
127 + wantCharts: len(overviewCharts) +
128 + len(nodeClusterPeerChartsTmpl)*2 +
129 + len(nodeChartsTmpl)*2 +
130 + len(vhostChartsTmpl)*2 +
131 + len(queueChartsTmpl)*4,
132 wantCollected: map[string]int64{
128 - "churn_rates_channel_closed": 0,
129 - "churn_rates_channel_created": 0,
130 - "churn_rates_connection_closed": 0,
131 - "churn_rates_connection_created": 0,
132 - "churn_rates_queue_created": 6,
133 - "churn_rates_queue_declared": 6,
134 - "churn_rates_queue_deleted": 2,
135 - "disk_free": 189799186432,
136 - "fd_total": 1048576,
137 - "fd_used": 43,
138 - "mem_limit": 6713820774,
139 - "mem_used": 172720128,
140 - "message_stats_ack": 0,
141 - "message_stats_confirm": 0,
142 - "message_stats_deliver": 0,
143 - "message_stats_deliver_get": 0,
144 - "message_stats_deliver_no_ack": 0,
145 - "message_stats_get": 0,
146 - "message_stats_get_no_ack": 0,
147 - "message_stats_publish": 0,
148 - "message_stats_publish_in": 0,
149 - "message_stats_publish_out": 0,
150 - "message_stats_redeliver": 0,
151 - "message_stats_return_unroutable": 0,
152 - "object_totals_channels": 0,
153 - "object_totals_connections": 0,
154 - "object_totals_consumers": 0,
155 - "object_totals_exchanges": 21,
156 - "object_totals_queues": 4,
157 - "proc_available": 1048135,
158 - "proc_total": 1048576,
159 - "proc_used": 441,
160 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_ack": 0,
161 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_confirm": 0,
162 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_deliver": 0,
163 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_deliver_get": 0,
164 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_deliver_no_ack": 0,
165 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_get": 0,
166 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_get_no_ack": 0,
167 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_publish": 0,
168 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_publish_in": 0,
169 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_publish_out": 0,
170 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_redeliver": 0,
171 - "queue_MyFirstQueue_vhost_mySecondVhost_message_stats_return_unroutable": 0,
172 - "queue_MyFirstQueue_vhost_mySecondVhost_messages": 1,
173 - "queue_MyFirstQueue_vhost_mySecondVhost_messages_paged_out": 1,
174 - "queue_MyFirstQueue_vhost_mySecondVhost_messages_persistent": 1,
175 - "queue_MyFirstQueue_vhost_mySecondVhost_messages_ready": 1,
176 - "queue_MyFirstQueue_vhost_mySecondVhost_messages_unacknowledged": 1,
177 - "queue_myFirstQueue_vhost_/_message_stats_ack": 0,
178 - "queue_myFirstQueue_vhost_/_message_stats_confirm": 0,
179 - "queue_myFirstQueue_vhost_/_message_stats_deliver": 0,
180 - "queue_myFirstQueue_vhost_/_message_stats_deliver_get": 0,
181 - "queue_myFirstQueue_vhost_/_message_stats_deliver_no_ack": 0,
182 - "queue_myFirstQueue_vhost_/_message_stats_get": 0,
183 - "queue_myFirstQueue_vhost_/_message_stats_get_no_ack": 0,
184 - "queue_myFirstQueue_vhost_/_message_stats_publish": 0,
185 - "queue_myFirstQueue_vhost_/_message_stats_publish_in": 0,
186 - "queue_myFirstQueue_vhost_/_message_stats_publish_out": 0,
187 - "queue_myFirstQueue_vhost_/_message_stats_redeliver": 0,
188 - "queue_myFirstQueue_vhost_/_message_stats_return_unroutable": 0,
189 - "queue_myFirstQueue_vhost_/_messages": 1,
190 - "queue_myFirstQueue_vhost_/_messages_paged_out": 1,
191 - "queue_myFirstQueue_vhost_/_messages_persistent": 1,
192 - "queue_myFirstQueue_vhost_/_messages_ready": 1,
193 - "queue_myFirstQueue_vhost_/_messages_unacknowledged": 1,
194 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_ack": 0,
195 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_confirm": 0,
196 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_deliver": 0,
197 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_deliver_get": 0,
198 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_deliver_no_ack": 0,
199 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_get": 0,
200 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_get_no_ack": 0,
201 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_publish": 0,
202 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_publish_in": 0,
203 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_publish_out": 0,
204 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_redeliver": 0,
205 - "queue_myFirstQueue_vhost_myFirstVhost_message_stats_return_unroutable": 0,
206 - "queue_myFirstQueue_vhost_myFirstVhost_messages": 1,
207 - "queue_myFirstQueue_vhost_myFirstVhost_messages_paged_out": 1,
208 - "queue_myFirstQueue_vhost_myFirstVhost_messages_persistent": 1,
209 - "queue_myFirstQueue_vhost_myFirstVhost_messages_ready": 1,
210 - "queue_myFirstQueue_vhost_myFirstVhost_messages_unacknowledged": 1,
211 - "queue_mySecondQueue_vhost_/_message_stats_ack": 0,
212 - "queue_mySecondQueue_vhost_/_message_stats_confirm": 0,
213 - "queue_mySecondQueue_vhost_/_message_stats_deliver": 0,
214 - "queue_mySecondQueue_vhost_/_message_stats_deliver_get": 0,
215 - "queue_mySecondQueue_vhost_/_message_stats_deliver_no_ack": 0,
216 - "queue_mySecondQueue_vhost_/_message_stats_get": 0,
217 - "queue_mySecondQueue_vhost_/_message_stats_get_no_ack": 0,
218 - "queue_mySecondQueue_vhost_/_message_stats_publish": 0,
219 - "queue_mySecondQueue_vhost_/_message_stats_publish_in": 0,
220 - "queue_mySecondQueue_vhost_/_message_stats_publish_out": 0,
221 - "queue_mySecondQueue_vhost_/_message_stats_redeliver": 0,
222 - "queue_mySecondQueue_vhost_/_message_stats_return_unroutable": 0,
223 - "queue_mySecondQueue_vhost_/_messages": 1,
224 - "queue_mySecondQueue_vhost_/_messages_paged_out": 1,
225 - "queue_mySecondQueue_vhost_/_messages_persistent": 1,
226 - "queue_mySecondQueue_vhost_/_messages_ready": 1,
227 - "queue_mySecondQueue_vhost_/_messages_unacknowledged": 1,
228 - "queue_totals_messages": 0,
229 - "queue_totals_messages_ready": 0,
230 - "queue_totals_messages_unacknowledged": 0,
231 - "run_queue": 1,
232 - "sockets_total": 943629,
233 - "sockets_used": 0,
234 - "vhost_/_message_stats_ack": 0,
235 - "vhost_/_message_stats_confirm": 0,
236 - "vhost_/_message_stats_deliver": 0,
237 - "vhost_/_message_stats_deliver_get": 0,
238 - "vhost_/_message_stats_deliver_no_ack": 0,
239 - "vhost_/_message_stats_get": 0,
240 - "vhost_/_message_stats_get_no_ack": 0,
241 - "vhost_/_message_stats_publish": 0,
242 - "vhost_/_message_stats_publish_in": 0,
243 - "vhost_/_message_stats_publish_out": 0,
244 - "vhost_/_message_stats_redeliver": 0,
245 - "vhost_/_message_stats_return_unroutable": 0,
246 - "vhost_/_messages": 1,
247 - "vhost_/_messages_ready": 1,
248 - "vhost_/_messages_unacknowledged": 1,
249 - "vhost_myFirstVhost_message_stats_ack": 0,
250 - "vhost_myFirstVhost_message_stats_confirm": 0,
251 - "vhost_myFirstVhost_message_stats_deliver": 0,
252 - "vhost_myFirstVhost_message_stats_deliver_get": 0,
253 - "vhost_myFirstVhost_message_stats_deliver_no_ack": 0,
254 - "vhost_myFirstVhost_message_stats_get": 0,
255 - "vhost_myFirstVhost_message_stats_get_no_ack": 0,
256 - "vhost_myFirstVhost_message_stats_publish": 0,
257 - "vhost_myFirstVhost_message_stats_publish_in": 0,
258 - "vhost_myFirstVhost_message_stats_publish_out": 0,
259 - "vhost_myFirstVhost_message_stats_redeliver": 0,
260 - "vhost_myFirstVhost_message_stats_return_unroutable": 0,
261 - "vhost_myFirstVhost_messages": 1,
262 - "vhost_myFirstVhost_messages_ready": 1,
263 - "vhost_myFirstVhost_messages_unacknowledged": 1,
264 - "vhost_mySecondVhost_message_stats_ack": 0,
265 - "vhost_mySecondVhost_message_stats_confirm": 0,
266 - "vhost_mySecondVhost_message_stats_deliver": 0,
267 - "vhost_mySecondVhost_message_stats_deliver_get": 0,
268 - "vhost_mySecondVhost_message_stats_deliver_no_ack": 0,
269 - "vhost_mySecondVhost_message_stats_get": 0,
270 - "vhost_mySecondVhost_message_stats_get_no_ack": 0,
271 - "vhost_mySecondVhost_message_stats_publish": 0,
272 - "vhost_mySecondVhost_message_stats_publish_in": 0,
273 - "vhost_mySecondVhost_message_stats_publish_out": 0,
274 - "vhost_mySecondVhost_message_stats_redeliver": 0,
275 - "vhost_mySecondVhost_message_stats_return_unroutable": 0,
276 - "vhost_mySecondVhost_messages": 1,
277 - "vhost_mySecondVhost_messages_ready": 1,
278 - "vhost_mySecondVhost_messages_unacknowledged": 1,
133 + "churn_rates_channel_closed": 7,
134 + "churn_rates_channel_created": 7,
135 + "churn_rates_connection_closed": 8,
136 + "churn_rates_connection_created": 7,
137 + "churn_rates_queue_created": 2,
138 + "churn_rates_queue_declared": 3,
139 + "churn_rates_queue_deleted": 0,
140 + "message_stats_ack": 0,
141 + "message_stats_confirm": 1,
142 + "message_stats_deliver": 0,
143 + "message_stats_deliver_get": 4,
144 + "message_stats_deliver_no_ack": 0,
145 + "message_stats_get": 3,
146 + "message_stats_get_empty": 2,
147 + "message_stats_get_no_ack": 1,
148 + "message_stats_publish": 1,
149 + "message_stats_publish_in": 0,
150 + "message_stats_publish_out": 0,
151 + "message_stats_redeliver": 3,
152 + "message_stats_return_unroutable": 0,
153 + "node_rabbit@ilyam-deb11-play_avail_status_running": 1,
154 + "node_rabbit@ilyam-deb11-play_avail_status_down": 0,
155 + "node_rabbit@ilyam-deb11-play_disk_free_alarm_status_clear": 1,
156 + "node_rabbit@ilyam-deb11-play_disk_free_alarm_status_triggered": 0,
157 + "node_rabbit@ilyam-deb11-play_disk_free_bytes": 46901432320,
158 + "node_rabbit@ilyam-deb11-play_fds_available": 1048534,
159 + "node_rabbit@ilyam-deb11-play_fds_used": 42,
160 + "node_rabbit@ilyam-deb11-play_mem_alarm_status_clear": 1,
161 + "node_rabbit@ilyam-deb11-play_mem_alarm_status_triggered": 0,
162 + "node_rabbit@ilyam-deb11-play_mem_available": 9935852339,
163 + "node_rabbit@ilyam-deb11-play_mem_used": 142905344,
164 + "node_rabbit@ilyam-deb11-play_peer_rabbit@pve-deb-work_cluster_link_recv_bytes": 2374358706,
165 + "node_rabbit@ilyam-deb11-play_peer_rabbit@pve-deb-work_cluster_link_send_bytes": 2297379728,
166 + "node_rabbit@ilyam-deb11-play_procs_available": 1048138,
167 + "node_rabbit@ilyam-deb11-play_procs_used": 438,
168 + "node_rabbit@ilyam-deb11-play_run_queue": 1,
169 + "node_rabbit@ilyam-deb11-play_sockets_available": 0,
170 + "node_rabbit@ilyam-deb11-play_sockets_used": 0,
171 + "node_rabbit@ilyam-deb11-play_uptime": 241932,
172 + "node_rabbit@pve-deb-work_avail_status_running": 1,
173 + "node_rabbit@pve-deb-work_avail_status_down": 0,
174 + "node_rabbit@pve-deb-work_disk_free_alarm_status_clear": 1,
175 + "node_rabbit@pve-deb-work_disk_free_alarm_status_triggered": 0,
176 + "node_rabbit@pve-deb-work_disk_free_bytes": 103827365888,
177 + "node_rabbit@pve-deb-work_fds_available": 1048528,
178 + "node_rabbit@pve-deb-work_fds_used": 48,
179 + "node_rabbit@pve-deb-work_mem_alarm_status_clear": 1,
180 + "node_rabbit@pve-deb-work_mem_alarm_status_triggered": 0,
181 + "node_rabbit@pve-deb-work_mem_available": 14958259404,
182 + "node_rabbit@pve-deb-work_mem_used": 160018432,
183 + "node_rabbit@pve-deb-work_peer_rabbit@ilyam-deb11-play_cluster_link_recv_bytes": 2297460158,
184 + "node_rabbit@pve-deb-work_peer_rabbit@ilyam-deb11-play_cluster_link_send_bytes": 2374459095,
185 + "node_rabbit@pve-deb-work_procs_available": 1048109,
186 + "node_rabbit@pve-deb-work_procs_used": 467,
187 + "node_rabbit@pve-deb-work_run_queue": 0,
188 + "node_rabbit@pve-deb-work_sockets_available": 0,
189 + "node_rabbit@pve-deb-work_sockets_used": 0,
190 + "node_rabbit@pve-deb-work_uptime": 73793,
191 + "object_totals_channels": 0,
192 + "object_totals_connections": 0,
193 + "object_totals_consumers": 0,
194 + "object_totals_exchanges": 14,
195 + "object_totals_queues": 4,
196 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_ack": 0,
197 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_confirm": 0,
198 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_deliver": 0,
199 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_deliver_get": 4,
200 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_deliver_no_ack": 0,
201 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_get": 3,
202 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_get_empty": 2,
203 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_get_no_ack": 1,
204 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_publish": 1,
205 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_publish_in": 0,
206 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_publish_out": 0,
207 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_redeliver": 3,
208 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_return_unroutable": 0,
209 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_messages": 0,
210 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_messages_paged_out": 0,
211 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_messages_persistent": 0,
212 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_messages_ready": 0,
213 + "queue_MyFirstQueue_vhost_/_node_rabbit@pve-deb-work_messages_unacknowledged": 0,
214 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_ack": 0,
215 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_confirm": 0,
216 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_deliver": 0,
217 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_deliver_get": 0,
218 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_deliver_no_ack": 0,
219 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_get": 0,
220 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_get_empty": 0,
221 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_get_no_ack": 0,
222 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_publish": 0,
223 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_publish_in": 0,
224 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_publish_out": 0,
225 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_redeliver": 0,
226 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_message_stats_return_unroutable": 0,
227 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_messages": 0,
228 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_messages_paged_out": 0,
229 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_messages_persistent": 0,
230 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_messages_ready": 0,
231 + "queue_MyFirstQueue_vhost_myFirstVhost_node_rabbit@ilyam-deb11-play_messages_unacknowledged": 0,
232 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_ack": 0,
233 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_confirm": 0,
234 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_deliver": 0,
235 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_deliver_get": 0,
236 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_deliver_no_ack": 0,
237 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_get": 0,
238 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_get_empty": 0,
239 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_get_no_ack": 0,
240 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_publish": 0,
241 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_publish_in": 0,
242 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_publish_out": 0,
243 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_redeliver": 0,
244 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_message_stats_return_unroutable": 0,
245 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_messages": 0,
246 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_messages_paged_out": 0,
247 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_messages_persistent": 0,
248 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_messages_ready": 0,
249 + "queue_MySecondQueue_vhost_/_node_rabbit@pve-deb-work_messages_unacknowledged": 0,
250 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_ack": 0,
251 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_confirm": 0,
252 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_deliver": 0,
253 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_deliver_get": 0,
254 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_deliver_no_ack": 0,
255 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_get": 0,
256 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_get_empty": 0,
257 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_get_no_ack": 0,
258 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_publish": 0,
259 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_publish_in": 0,
260 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_publish_out": 0,
261 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_redeliver": 0,
262 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_message_stats_return_unroutable": 0,
263 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_messages": 0,
264 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_messages_paged_out": 0,
265 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_messages_persistent": 0,
266 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_messages_ready": 0,
267 + "queue_myFirstQueue_vhost_myFirstVhost_node_rabbit@pve-deb-work_messages_unacknowledged": 0,
268 + "queue_totals_messages": 0,
269 + "queue_totals_messages_ready": 0,
270 + "queue_totals_messages_unacknowledged": 0,
271 + "vhost_/_message_stats_ack": 0,
272 + "vhost_/_message_stats_confirm": 1,
273 + "vhost_/_message_stats_deliver": 0,
274 + "vhost_/_message_stats_deliver_get": 4,
275 + "vhost_/_message_stats_deliver_no_ack": 0,
276 + "vhost_/_message_stats_get": 3,
277 + "vhost_/_message_stats_get_empty": 2,
278 + "vhost_/_message_stats_get_no_ack": 1,
279 + "vhost_/_message_stats_publish": 1,
280 + "vhost_/_message_stats_publish_in": 0,
281 + "vhost_/_message_stats_publish_out": 0,
282 + "vhost_/_message_stats_redeliver": 3,
283 + "vhost_/_message_stats_return_unroutable": 0,
284 + "vhost_/_messages": 0,
285 + "vhost_/_messages_ready": 0,
286 + "vhost_/_messages_unacknowledged": 0,
287 + "vhost_/_status_partial": 0,
288 + "vhost_/_status_running": 1,
289 + "vhost_/_status_stopped": 0,
290 + "vhost_myFirstVhost_message_stats_ack": 0,
291 + "vhost_myFirstVhost_message_stats_confirm": 0,
292 + "vhost_myFirstVhost_message_stats_deliver": 0,
293 + "vhost_myFirstVhost_message_stats_deliver_get": 0,
294 + "vhost_myFirstVhost_message_stats_deliver_no_ack": 0,
295 + "vhost_myFirstVhost_message_stats_get": 0,
296 + "vhost_myFirstVhost_message_stats_get_empty": 0,
297 + "vhost_myFirstVhost_message_stats_get_no_ack": 0,
298 + "vhost_myFirstVhost_message_stats_publish": 0,
299 + "vhost_myFirstVhost_message_stats_publish_in": 0,
300 + "vhost_myFirstVhost_message_stats_publish_out": 0,
301 + "vhost_myFirstVhost_message_stats_redeliver": 0,
302 + "vhost_myFirstVhost_message_stats_return_unroutable": 0,
303 + "vhost_myFirstVhost_messages": 0,
304 + "vhost_myFirstVhost_messages_ready": 0,
305 + "vhost_myFirstVhost_messages_unacknowledged": 0,
306 + "vhost_myFirstVhost_status_partial": 0,
307 + "vhost_myFirstVhost_status_running": 1,
308 + "vhost_myFirstVhost_status_stopped": 0,
309 },
310 },
311 + "fails on unexpected JSON response": {
312 + prepare: caseUnexpectedJsonResponse,
313 + wantCollected: nil,
314 + },
315 "fails on invalid response": {
316 prepare: caseInvalidDataResponse,
317 wantCollected: nil,
284 - wantCharts: len(baseCharts),
318 },
319 "fails on 404": {
320 prepare: case404,
321 wantCollected: nil,
289 - wantCharts: len(baseCharts),
322 },
323 }
324
325 for name, test := range tests {
326 t.Run(name, func(t *testing.T) {
295 - rabbit, cleanup := test.prepare()
327 + rmq, cleanup := test.prepare()
328 defer cleanup()
329
298 - require.NoError(t, rabbit.Init())
330 + require.NoError(t, rmq.Init())
331
300 - mx := rabbit.Collect()
332 + mx := rmq.Collect()
333
334 assert.Equal(t, test.wantCollected, mx)
303 - assert.Equal(t, test.wantCharts, len(*rabbit.Charts()))
335 +
336 + if len(test.wantCollected) > 0 {
337 + assert.Equal(t, test.wantCharts, len(*rmq.Charts()))
338 + module.TestMetricsHasAllChartsDims(t, rmq.Charts(), mx)
339 + }
340 })
341 }
342 }
343
308 -func caseSuccessAllRequests() (*RabbitMQ, func()) {
309 - srv := prepareRabbitMQEndpoint()
310 - rabbit := New()
311 - rabbit.URL = srv.URL
312 - rabbit.CollectQueues = true
344 +func caseClusterOk() (*RabbitMQ, func()) {
345 + srv := httptest.NewServer(
346 + http.HandlerFunc(
347 + func(w http.ResponseWriter, r *http.Request) {
348 + switch r.URL.Path {
349 + case urlPathAPIDefinitions:
350 + _, _ = w.Write(dataClusterDefinitions)
351 + case urlPathAPIOverview:
352 + _, _ = w.Write(dataClusterOverview)
353 + case urlPathAPINodes:
354 + _, _ = w.Write(dataClusterNodes)
355 + case urlPathAPIVhosts:
356 + _, _ = w.Write(dataClusterVhosts)
357 + case urlPathAPIQueues:
358 + _, _ = w.Write(dataClusterQueues)
359 + default:
360 + w.WriteHeader(404)
361 + }
362 + }))
363 + rmq := New()
364 + rmq.URL = srv.URL
365 + rmq.CollectQueues = true
366
314 - return rabbit, srv.Close
367 + return rmq, srv.Close
368 +}
369 +
370 +func caseUnexpectedJsonResponse() (*RabbitMQ, func()) {
371 + resp := `
372 +{
373 + "elephant": {
374 + "burn": false,
375 + "mountain": true,
376 + "fog": false,
377 + "skin": -1561907625,
378 + "burst": "anyway",
379 + "shadow": 1558616893
380 + },
381 + "start": "ever",
382 + "base": 2093056027,
383 + "mission": -2007590351,
384 + "victory": 999053756,
385 + "die": false
386 +}
387 +`
388 + srv := httptest.NewServer(http.HandlerFunc(
389 + func(w http.ResponseWriter, r *http.Request) {
390 + _, _ = w.Write([]byte(resp))
391 + }))
392 + rmq := New()
393 + rmq.URL = srv.URL
394 +
395 + return rmq, srv.Close
396 }
397
398 func caseInvalidDataResponse() (*RabbitMQ, func()) {
@@ -319,10 +400,10 @@ func caseInvalidDataResponse() (*RabbitMQ, func()) {
400 func(w http.ResponseWriter, r *http.Request) {
401 _, _ = w.Write([]byte("hello and\n goodbye"))
402 }))
322 - rabbit := New()
323 - rabbit.URL = srv.URL
403 + rmq := New()
404 + rmq.URL = srv.URL
405
325 - return rabbit, srv.Close
406 + return rmq, srv.Close
407 }
408
409 func case404() (*RabbitMQ, func()) {
@@ -330,28 +411,8 @@ func case404() (*RabbitMQ, func()) {
411 func(w http.ResponseWriter, r *http.Request) {
412 w.WriteHeader(http.StatusNotFound)
413 }))
333 - rabbit := New()
334 - rabbit.URL = srv.URL
414 + rmq := New()
415 + rmq.URL = srv.URL
416
336 - return rabbit, srv.Close
337 -}
338 -
339 -func prepareRabbitMQEndpoint() *httptest.Server {
340 - srv := httptest.NewServer(
341 - http.HandlerFunc(
342 - func(w http.ResponseWriter, r *http.Request) {
343 - switch r.URL.Path {
344 - case urlPathAPIOverview:
345 - _, _ = w.Write(dataOverviewStats)
346 - case filepath.Join(urlPathAPINodes, "rabbit@localhost"):
347 - _, _ = w.Write(dataNodeStats)
348 - case urlPathAPIVhosts:
349 - _, _ = w.Write(dataVhostsStats)
350 - case urlPathAPIQueues:
351 - _, _ = w.Write(dataQueuesStats)
352 - default:
353 - w.WriteHeader(404)
354 - }
355 - }))
356 - return srv
417 + return rmq, srv.Close
418 }
src/go/plugin/go.d/modules/rabbitmq/restapi.go new
+115
@@ -0,0 +1,115 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package rabbitmq
4 +
5 +const (
6 + urlPathAPIDefinitions = "/api/definitions"
7 + urlPathAPIOverview = "/api/overview"
8 + urlPathAPINodes = "/api/nodes"
9 + urlPathAPIVhosts = "/api/vhosts"
10 + urlPathAPIQueues = "/api/queues"
11 +)
12 +
13 +type apiDefinitionsResp struct {
14 + RabbitmqVersion string `json:"rabbitmq_version"`
15 + GlobalParams []struct {
16 + Name string `json:"name"`
17 + Value any `json:"value"`
18 + } `json:"global_parameters"`
19 +}
20 +
21 +// https://www.rabbitmq.com/monitoring.html#cluster-wide-metrics
22 +type apiOverviewResp struct {
23 + ObjectTotals struct {
24 + Consumers int64 `json:"consumers" stm:"consumers"`
25 + Queues int64 `json:"queues" stm:"queues"`
26 + Exchanges int64 `json:"exchanges" stm:"exchanges"`
27 + Connections int64 `json:"connections" stm:"connections"`
28 + Channels int64 `json:"channels" stm:"channels"`
29 + } `json:"object_totals" stm:"object_totals"`
30 + ChurnRates struct {
31 + ChannelClosed int64 `json:"channel_closed" stm:"channel_closed"`
32 + ChannelCreated int64 `json:"channel_created" stm:"channel_created"`
33 + ConnectionClosed int64 `json:"connection_closed" stm:"connection_closed"`
34 + ConnectionCreated int64 `json:"connection_created" stm:"connection_created"`
35 + QueueCreated int64 `json:"queue_created" stm:"queue_created"`
36 + QueueDeclared int64 `json:"queue_declared" stm:"queue_declared"`
37 + QueueDeleted int64 `json:"queue_deleted" stm:"queue_deleted"`
38 + } `json:"churn_rates" stm:"churn_rates"`
39 + QueueTotals struct {
40 + Messages int64 `json:"messages" stm:"messages"`
41 + MessagesReady int64 `json:"messages_ready" stm:"messages_ready"`
42 + MessagesUnacknowledged int64 `json:"messages_unacknowledged" stm:"messages_unacknowledged"`
43 + } `json:"queue_totals" stm:"queue_totals"`
44 + MessageStats apiMessageStats `json:"message_stats" stm:"message_stats"`
45 +}
46 +
47 +// https://www.rabbitmq.com/monitoring.html#node-metrics
48 +type (
49 + apiNodeResp struct {
50 + Name string `json:"name"`
51 + OsPid string `json:"os_pid"`
52 + FDTotal int64 `json:"fd_total"`
53 + FDUsed int64 `json:"fd_used"`
54 + MemLimit int64 `json:"mem_limit"`
55 + MemUsed int64 `json:"mem_used"`
56 + SocketsTotal int64 `json:"sockets_total"`
57 + SocketsUsed int64 `json:"sockets_used"`
58 + ProcTotal int64 `json:"proc_total"`
59 + ProcUsed int64 `json:"proc_used"`
60 + DiskFree int64 `json:"disk_free"`
61 + RunQueue int64 `json:"run_queue"`
62 + Uptime int64 `json:"uptime"`
63 + Running bool `json:"running"`
64 + MemAlarm bool `json:"mem_alarm"`
65 + DiskFreeAlarm bool `json:"disk_free_alarm"`
66 + BeingDrained bool `json:"being_drained"`
67 + ClusterLinks []apiClusterPeer `json:"cluster_links"`
68 + }
69 + apiClusterPeer struct {
70 + Name string `json:"name"`
71 + RecvBytes int64 `json:"recv_bytes"`
72 + SendBytes int64 `json:"send_bytes"`
73 + }
74 +)
75 +
76 +type apiVhostResp struct {
77 + Name string `json:"name"`
78 + ClusterState map[string]string `json:"cluster_state"`
79 + Messages int64 `json:"messages" stm:"messages"`
80 + MessagesReady int64 `json:"messages_ready" stm:"messages_ready"`
81 + MessagesUnacknowledged int64 `json:"messages_unacknowledged" stm:"messages_unacknowledged"`
82 + MessageStats apiMessageStats `json:"message_stats" stm:"message_stats"`
83 +}
84 +
85 +// https://www.rabbitmq.com/monitoring.html#queue-metrics
86 +type apiQueueResp struct {
87 + Name string `json:"name"`
88 + Node string `json:"node"`
89 + Vhost string `json:"vhost"`
90 + Type string `json:"type"`
91 + State string `json:"state"`
92 + Messages int64 `json:"messages" stm:"messages"`
93 + MessagesReady int64 `json:"messages_ready" stm:"messages_ready"`
94 + MessagesUnacknowledged int64 `json:"messages_unacknowledged" stm:"messages_unacknowledged"`
95 + MessagesPagedOut int64 `json:"messages_paged_out" stm:"messages_paged_out"`
96 + MessagesPersistent int64 `json:"messages_persistent" stm:"messages_persistent"`
97 + MessageStats apiMessageStats `json:"message_stats" stm:"message_stats"`
98 +}
99 +
100 +// https://rawcdn.githack.com/rabbitmq/rabbitmq-server/v3.11.5/deps/rabbitmq_management/priv/www/api/index.html
101 +type apiMessageStats struct {
102 + Ack int64 `json:"ack" stm:"ack"`
103 + Publish int64 `json:"publish" stm:"publish"`
104 + PublishIn int64 `json:"publish_in" stm:"publish_in"`
105 + PublishOut int64 `json:"publish_out" stm:"publish_out"`
106 + Confirm int64 `json:"confirm" stm:"confirm"`
107 + Deliver int64 `json:"deliver" stm:"deliver"`
108 + DeliverNoAck int64 `json:"deliver_no_ack" stm:"deliver_no_ack"`
109 + Get int64 `json:"get" stm:"get"`
110 + GetEmpty int64 `json:"get_empty" stm:"get_empty"`
111 + GetNoAck int64 `json:"get_no_ack" stm:"get_no_ack"`
112 + DeliverGet int64 `json:"deliver_get" stm:"deliver_get"`
113 + Redeliver int64 `json:"redeliver" stm:"redeliver"`
114 + ReturnUnroutable int64 `json:"return_unroutable" stm:"return_unroutable"`
115 +}
src/go/plugin/go.d/modules/rabbitmq/testdata/v3.11.5/api-nodes-node.json deleted
-453
@@ -1,453 +0,0 @@
1 -{
2 - "partitions": [],
3 - "os_pid": "49",
4 - "fd_total": 1048576,
5 - "sockets_total": 943629,
6 - "mem_limit": 6713820774,
7 - "mem_alarm": false,
8 - "disk_free_limit": 16784551936,
9 - "disk_free_alarm": false,
10 - "proc_total": 1048576,
11 - "rates_mode": "basic",
12 - "uptime": 10098336,
13 - "run_queue": 1,
14 - "processors": 12,
15 - "exchange_types": [
16 - {
17 - "name": "topic",
18 - "description": "AMQP topic exchange, as per the AMQP specification",
19 - "enabled": true
20 - },
21 - {
22 - "name": "headers",
23 - "description": "AMQP headers exchange, as per the AMQP specification",
24 - "enabled": true
25 - },
26 - {
27 - "name": "fanout",
28 - "description": "AMQP fanout exchange, as per the AMQP specification",
29 - "enabled": true
30 - },
31 - {
32 - "name": "direct",
33 - "description": "AMQP direct exchange, as per the AMQP specification",
34 - "enabled": true
35 - }
36 - ],
37 - "auth_mechanisms": [
38 - {
39 - "name": "PLAIN",
40 - "description": "SASL PLAIN authentication mechanism",
41 - "enabled": true
42 - },
43 - {
44 - "name": "AMQPLAIN",
45 - "description": "QPid AMQPLAIN mechanism",
46 - "enabled": true
47 - },
48 - {
49 - "name": "RABBIT-CR-DEMO",
50 - "description": "RabbitMQ Demo challenge-response authentication mechanism",
51 - "enabled": false
52 - }
53 - ],
54 - "applications": [
55 - {
56 - "name": "accept",
57 - "description": "Accept header(s) for Erlang/Elixir",
58 - "version": "0.3.5"
59 - },
60 - {
61 - "name": "amqp10_common",
62 - "description": "Modules shared by rabbitmq-amqp1.0 and rabbitmq-amqp1.0-client",
63 - "version": "3.11.5"
64 - },
65 - {
66 - "name": "amqp_client",
67 - "description": "RabbitMQ AMQP Client",
68 - "version": "3.11.5"
69 - },
70 - {
71 - "name": "asn1",
72 - "description": "The Erlang ASN1 compiler version 5.0.21",
73 - "version": "5.0.21"
74 - },
75 - {
76 - "name": "aten",
77 - "description": "Erlang node failure detector",
78 - "version": "0.5.8"
79 - },
80 - {
81 - "name": "compiler",
82 - "description": "ERTS CXC 138 10",
83 - "version": "8.2.2"
84 - },
85 - {
86 - "name": "cowboy",
87 - "description": "Small, fast, modern HTTP server.",
88 - "version": "2.8.0"
89 - },
90 - {
91 - "name": "cowlib",
92 - "description": "Support library for manipulating Web protocols.",
93 - "version": "2.9.1"
94 - },
95 - {
96 - "name": "credentials_obfuscation",
97 - "description": "Helper library that obfuscates sensitive values in process state",
98 - "version": "3.2.0"
99 - },
100 - {
101 - "name": "crypto",
102 - "description": "CRYPTO",
103 - "version": "5.1.2"
104 - },
105 - {
106 - "name": "cuttlefish",
107 - "description": "cuttlefish configuration abstraction",
108 - "version": "3.1.0"
109 - },
110 - {
111 - "name": "enough",
112 - "description": "A gen_server implementation with additional, overload-protected call type",
113 - "version": "0.1.0"
114 - },
115 - {
116 - "name": "gen_batch_server",
117 - "description": "Generic batching server",
118 - "version": "0.8.8"
119 - },
120 - {
121 - "name": "inets",
122 - "description": "INETS CXC 138 49",
123 - "version": "8.2"
124 - },
125 - {
126 - "name": "kernel",
127 - "description": "ERTS CXC 138 10",
128 - "version": "8.5.2"
129 - },
130 - {
131 - "name": "mnesia",
132 - "description": "MNESIA CXC 138 12",
133 - "version": "4.21.3"
134 - },
135 - {
136 - "name": "observer_cli",
137 - "description": "Visualize Erlang Nodes On The Command Line",
138 - "version": "1.7.3"
139 - },
140 - {
141 - "name": "os_mon",
142 - "description": "CPO CXC 138 46",
143 - "version": "2.8"
144 - },
145 - {
146 - "name": "osiris",
147 - "description": "New project",
148 - "version": "1.3.3"
149 - },
150 - {
151 - "name": "prometheus",
152 - "description": "Prometheus.io client in Erlang",
153 - "version": "4.9.1"
154 - },
155 - {
156 - "name": "public_key",
157 - "description": "Public key infrastructure",
158 - "version": "1.13.2"
159 - },
160 - {
161 - "name": "ra",
162 - "description": "Raft library",
163 - "version": "2.4.5"
164 - },
165 - {
166 - "name": "rabbit",
167 - "description": "RabbitMQ",
168 - "version": "3.11.5"
169 - },
170 - {
171 - "name": "rabbit_common",
172 - "description": "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
173 - "version": "3.11.5"
174 - },
175 - {
176 - "name": "rabbitmq_management",
177 - "description": "RabbitMQ Management Console",
178 - "version": "3.11.5"
179 - },
180 - {
181 - "name": "rabbitmq_management_agent",
182 - "description": "RabbitMQ Management Agent",
183 - "version": "3.11.5"
184 - },
185 - {
186 - "name": "rabbitmq_prelaunch",
187 - "description": "RabbitMQ prelaunch setup",
188 - "version": "3.11.5"
189 - },
190 - {
191 - "name": "rabbitmq_prometheus",
192 - "description": "",
193 - "version": "3.11.5"
194 - },
195 - {
196 - "name": "rabbitmq_web_dispatch",
197 - "description": "RabbitMQ Web Dispatcher",
198 - "version": "3.11.5"
199 - },
200 - {
201 - "name": "ranch",
202 - "description": "Socket acceptor pool for TCP protocols.",
203 - "version": "2.1.0"
204 - },
205 - {
206 - "name": "recon",
207 - "description": "Diagnostic tools for production use",
208 - "version": "2.5.2"
209 - },
210 - {
211 - "name": "redbug",
212 - "description": "Erlang Tracing Debugger",
213 - "version": "2.0.7"
214 - },
215 - {
216 - "name": "runtime_tools",
217 - "description": "RUNTIME_TOOLS",
218 - "version": "1.19"
219 - },
220 - {
221 - "name": "sasl",
222 - "description": "SASL CXC 138 11",
223 - "version": "4.2"
224 - },
225 - {
226 - "name": "seshat",
227 - "description": "Counters registry",
228 - "version": "0.4.0"
229 - },
230 - {
231 - "name": "ssl",
232 - "description": "Erlang/OTP SSL application",
233 - "version": "10.8.6"
234 - },
235 - {
236 - "name": "stdlib",
237 - "description": "ERTS CXC 138 10",
238 - "version": "4.2"
239 - },
240 - {
241 - "name": "stdout_formatter",
242 - "description": "Tools to format paragraphs, lists and tables as plain text",
243 - "version": "0.2.4"
244 - },
245 - {
246 - "name": "syntax_tools",
247 - "description": "Syntax tools",
248 - "version": "3.0"
249 - },
250 - {
251 - "name": "sysmon_handler",
252 - "description": "Rate-limiting system_monitor event handler",
253 - "version": "1.3.0"
254 - },
255 - {
256 - "name": "systemd",
257 - "description": "systemd integration for Erlang applications",
258 - "version": "0.6.1"
259 - },
260 - {
261 - "name": "thoas",
262 - "description": "A blazing fast JSON parser and generator in pure Erlang.",
263 - "version": "0.4.0"
264 - },
265 - {
266 - "name": "tools",
267 - "description": "DEVTOOLS CXC 138 16",
268 - "version": "3.5.3"
269 - },
270 - {
271 - "name": "xmerl",
272 - "description": "XML parser",
273 - "version": "1.3.30"
274 - }
275 - ],
276 - "contexts": [
277 - {
278 - "description": "RabbitMQ Management",
279 - "path": "/",
280 - "cowboy_opts": "[{sendfile,false}]",
281 - "ip": "0.0.0.0",
282 - "port": "15672"
283 - },
284 - {
285 - "description": "RabbitMQ Prometheus",
286 - "path": "/",
287 - "cowboy_opts": "[{sendfile,false}]",
288 - "port": "15692",
289 - "protocol": "'http/prometheus'"
290 - }
291 - ],
292 - "log_files": [
293 - "/opt/bitnami/rabbitmq/var/log/rabbitmq/rabbit@localhost.log",
294 - "/opt/bitnami/rabbitmq/var/log/rabbitmq/rabbit@localhost_upgrade.log",
295 - "<stdout>"
296 - ],
297 - "db_dir": "/bitnami/rabbitmq/mnesia/rabbit@localhost",
298 - "config_files": [
299 - "/opt/bitnami/rabbitmq/etc/rabbitmq/rabbitmq.conf"
300 - ],
301 - "net_ticktime": 60,
302 - "enabled_plugins": [
303 - "rabbitmq_management",
304 - "rabbitmq_prometheus"
305 - ],
306 - "mem_calculation_strategy": "rss",
307 - "ra_open_file_metrics": {
308 - "ra_log_wal": 1,
309 - "ra_log_segment_writer": 0
310 - },
311 - "name": "rabbit@localhost",
312 - "running": true,
313 - "type": "disc",
314 - "mem_used": 172720128,
315 - "mem_used_details": {
316 - "rate": 0
317 - },
318 - "fd_used": 43,
319 - "fd_used_details": {
320 - "rate": -0.2
321 - },
322 - "sockets_used": 0,
323 - "sockets_used_details": {
324 - "rate": 0
325 - },
326 - "proc_used": 441,
327 - "proc_used_details": {
328 - "rate": -0.2
329 - },
330 - "disk_free": 189799186432,
331 - "disk_free_details": {
332 - "rate": 0
333 - },
334 - "gc_num": 74226,
335 - "gc_num_details": {
336 - "rate": 4.8
337 - },
338 - "gc_bytes_reclaimed": 1847200664,
339 - "gc_bytes_reclaimed_details": {
340 - "rate": 101998.4
341 - },
342 - "context_switches": 839195,
343 - "context_switches_details": {
344 - "rate": 59.4
345 - },
346 - "io_read_count": 1,
347 - "io_read_count_details": {
348 - "rate": 0
349 - },
350 - "io_read_bytes": 1,
351 - "io_read_bytes_details": {
352 - "rate": 0
353 - },
354 - "io_read_avg_time": 0.043,
355 - "io_read_avg_time_details": {
356 - "rate": 0
357 - },
358 - "io_write_count": 0,
359 - "io_write_count_details": {
360 - "rate": 0
361 - },
362 - "io_write_bytes": 0,
363 - "io_write_bytes_details": {
364 - "rate": 0
365 - },
366 - "io_write_avg_time": 0,
367 - "io_write_avg_time_details": {
368 - "rate": 0
369 - },
370 - "io_sync_count": 0,
371 - "io_sync_count_details": {
372 - "rate": 0
373 - },
374 - "io_sync_avg_time": 0,
375 - "io_sync_avg_time_details": {
376 - "rate": 0
377 - },
378 - "io_seek_count": 0,
379 - "io_seek_count_details": {
380 - "rate": 0
381 - },
382 - "io_seek_avg_time": 0,
383 - "io_seek_avg_time_details": {
384 - "rate": 0
385 - },
386 - "io_reopen_count": 0,
387 - "io_reopen_count_details": {
388 - "rate": 0
389 - },
390 - "mnesia_ram_tx_count": 272,
391 - "mnesia_ram_tx_count_details": {
392 - "rate": 0
393 - },
394 - "mnesia_disk_tx_count": 58,
395 - "mnesia_disk_tx_count_details": {
396 - "rate": 0
397 - },
398 - "msg_store_read_count": 0,
399 - "msg_store_read_count_details": {
400 - "rate": 0
401 - },
402 - "msg_store_write_count": 0,
403 - "msg_store_write_count_details": {
404 - "rate": 0
405 - },
406 - "queue_index_write_count": 0,
407 - "queue_index_write_count_details": {
408 - "rate": 0
409 - },
410 - "queue_index_read_count": 0,
411 - "queue_index_read_count_details": {
412 - "rate": 0
413 - },
414 - "connection_created": 0,
415 - "connection_created_details": {
416 - "rate": 0
417 - },
418 - "connection_closed": 0,
419 - "connection_closed_details": {
420 - "rate": 0
421 - },
422 - "channel_created": 0,
423 - "channel_created_details": {
424 - "rate": 0
425 - },
426 - "channel_closed": 0,
427 - "channel_closed_details": {
428 - "rate": 0
429 - },
430 - "queue_declared": 6,
431 - "queue_declared_details": {
432 - "rate": 0
433 - },
434 - "queue_created": 6,
435 - "queue_created_details": {
436 - "rate": 0
437 - },
438 - "queue_deleted": 2,
439 - "queue_deleted_details": {
440 - "rate": 0
441 - },
442 - "cluster_links": [],
443 - "metrics_gc_queue_length": {
444 - "connection_closed": 0,
445 - "channel_closed": 0,
446 - "consumer_deleted": 0,
447 - "exchange_deleted": 0,
448 - "queue_deleted": 0,
449 - "vhost_deleted": 0,
450 - "node_node_deleted": 0,
451 - "channel_consumer_deleted": 0
452 - }
453 -}
src/go/plugin/go.d/modules/rabbitmq/testdata/v3.11.5/api-overview.json deleted
-183
@@ -1,183 +0,0 @@
1 -{
2 - "management_version": "3.11.5",
3 - "rates_mode": "basic",
4 - "sample_retention_policies": {
5 - "global": [
6 - 600,
7 - 3600,
8 - 28800,
9 - 86400
10 - ],
11 - "basic": [
12 - 600,
13 - 3600
14 - ],
15 - "detailed": [
16 - 600
17 - ]
18 - },
19 - "exchange_types": [
20 - {
21 - "name": "direct",
22 - "description": "AMQP direct exchange, as per the AMQP specification",
23 - "enabled": true
24 - },
25 - {
26 - "name": "fanout",
27 - "description": "AMQP fanout exchange, as per the AMQP specification",
28 - "enabled": true
29 - },
30 - {
31 - "name": "headers",
32 - "description": "AMQP headers exchange, as per the AMQP specification",
33 - "enabled": true
34 - },
35 - {
36 - "name": "topic",
37 - "description": "AMQP topic exchange, as per the AMQP specification",
38 - "enabled": true
39 - }
40 - ],
41 - "product_version": "3.11.5",
42 - "product_name": "RabbitMQ",
43 - "rabbitmq_version": "3.11.5",
44 - "cluster_name": "rabbit@f705ea2a1bec",
45 - "erlang_version": "25.2",
46 - "erlang_full_version": "Erlang/OTP 25 [erts-13.1.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]",
47 - "release_series_support_status": "supported",
48 - "disable_stats": false,
49 - "enable_queue_totals": false,
50 - "message_stats": {
51 - "disk_reads": 0,
52 - "disk_reads_details": {
53 - "rate": 0
54 - },
55 - "disk_writes": 0,
56 - "disk_writes_details": {
57 - "rate": 0
58 - }
59 - },
60 - "churn_rates": {
61 - "channel_closed": 0,
62 - "channel_closed_details": {
63 - "rate": 0
64 - },
65 - "channel_created": 0,
66 - "channel_created_details": {
67 - "rate": 0
68 - },
69 - "connection_closed": 0,
70 - "connection_closed_details": {
71 - "rate": 0
72 - },
73 - "connection_created": 0,
74 - "connection_created_details": {
75 - "rate": 0
76 - },
77 - "queue_created": 6,
78 - "queue_created_details": {
79 - "rate": 0
80 - },
81 - "queue_declared": 6,
82 - "queue_declared_details": {
83 - "rate": 0
84 - },
85 - "queue_deleted": 2,
86 - "queue_deleted_details": {
87 - "rate": 0
88 - }
89 - },
90 - "queue_totals": {
91 - "messages": 0,
92 - "messages_details": {
93 - "rate": 0
94 - },
95 - "messages_ready": 0,
96 - "messages_ready_details": {
97 - "rate": 0
98 - },
99 - "messages_unacknowledged": 0,
100 - "messages_unacknowledged_details": {
101 - "rate": 0
102 - }
103 - },
104 - "object_totals": {
105 - "channels": 0,
106 - "connections": 0,
107 - "consumers": 0,
108 - "exchanges": 21,
109 - "queues": 4
110 - },
111 - "statistics_db_event_queue": 0,
112 - "node": "rabbit@localhost",
113 - "listeners": [
114 - {
115 - "node": "rabbit@localhost",
116 - "protocol": "amqp",
117 - "ip_address": "::",
118 - "port": 5672,
119 - "socket_opts": {
120 - "backlog": 128,
121 - "nodelay": true,
122 - "linger": [
123 - true,
124 - 0
125 - ],
126 - "exit_on_close": false
127 - }
128 - },
129 - {
130 - "node": "rabbit@localhost",
131 - "protocol": "clustering",
132 - "ip_address": "::",
133 - "port": 25672,
134 - "socket_opts": []
135 - },
136 - {
137 - "node": "rabbit@localhost",
138 - "protocol": "http",
139 - "ip_address": "::",
140 - "port": 15672,
141 - "socket_opts": {
142 - "cowboy_opts": {
143 - "sendfile": false
144 - },
145 - "ip": "0.0.0.0",
146 - "port": 15672
147 - }
148 - },
149 - {
150 - "node": "rabbit@localhost",
151 - "protocol": "http/prometheus",
152 - "ip_address": "::",
153 - "port": 15692,
154 - "socket_opts": {
155 - "cowboy_opts": {
156 - "sendfile": false
157 - },
158 - "port": 15692,
159 - "protocol": "http/prometheus"
160 - }
161 - }
162 - ],
163 - "contexts": [
164 - {
165 - "ssl_opts": [],
166 - "node": "rabbit@localhost",
167 - "description": "RabbitMQ Management",
168 - "path": "/",
169 - "cowboy_opts": "[{sendfile,false}]",
170 - "ip": "0.0.0.0",
171 - "port": "15672"
172 - },
173 - {
174 - "ssl_opts": [],
175 - "node": "rabbit@localhost",
176 - "description": "RabbitMQ Prometheus",
177 - "path": "/",
178 - "cowboy_opts": "[{sendfile,false}]",
179 - "port": "15692",
180 - "protocol": "'http/prometheus'"
181 - }
182 - ]
183 -}
src/go/plugin/go.d/modules/rabbitmq/testdata/v3.11.5/api-queues.json deleted
-334
@@ -1,334 +0,0 @@
1 -[
2 - {
3 - "arguments": {},
4 - "auto_delete": false,
5 - "backing_queue_status": {
6 - "avg_ack_egress_rate": 0,
7 - "avg_ack_ingress_rate": 0,
8 - "avg_egress_rate": 0,
9 - "avg_ingress_rate": 0,
10 - "delta": [
11 - "delta",
12 - "undefined",
13 - 0,
14 - 0,
15 - "undefined"
16 - ],
17 - "len": 0,
18 - "mode": "default",
19 - "next_deliver_seq_id": 0,
20 - "next_seq_id": 0,
21 - "num_pending_acks": 0,
22 - "num_unconfirmed": 0,
23 - "q1": 0,
24 - "q2": 0,
25 - "q3": 0,
26 - "q4": 0,
27 - "target_ram_count": "infinity",
28 - "version": 1
29 - },
30 - "consumer_capacity": 0,
31 - "consumer_utilisation": 0,
32 - "consumers": 0,
33 - "durable": true,
34 - "effective_policy_definition": {},
35 - "exclusive": false,
36 - "exclusive_consumer_tag": null,
37 - "garbage_collection": {
38 - "fullsweep_after": 65535,
39 - "max_heap_size": 0,
40 - "min_bin_vheap_size": 46422,
41 - "min_heap_size": 233,
42 - "minor_gcs": 74
43 - },
44 - "head_message_timestamp": null,
45 - "idle_since": "2023-01-02T15:51:49.985+00:00",
46 - "memory": 55408,
47 - "message_bytes": 0,
48 - "message_bytes_paged_out": 0,
49 - "message_bytes_persistent": 0,
50 - "message_bytes_ram": 0,
51 - "message_bytes_ready": 0,
52 - "message_bytes_unacknowledged": 0,
53 - "messages": 1,
54 - "messages_details": {
55 - "rate": 0
56 - },
57 - "messages_paged_out": 1,
58 - "messages_persistent": 1,
59 - "messages_ram": 0,
60 - "messages_ready": 1,
61 - "messages_ready_details": {
62 - "rate": 0
63 - },
64 - "messages_ready_ram": 0,
65 - "messages_unacknowledged": 1,
66 - "messages_unacknowledged_details": {
67 - "rate": 0
68 - },
69 - "messages_unacknowledged_ram": 0,
70 - "name": "myFirstQueue",
71 - "node": "rabbit@localhost",
72 - "operator_policy": null,
73 - "policy": null,
74 - "recoverable_slaves": null,
75 - "reductions": 91946,
76 - "reductions_details": {
77 - "rate": 0
78 - },
79 - "single_active_consumer_tag": null,
80 - "state": "running",
81 - "type": "classic",
82 - "vhost": "/"
83 - },
84 - {
85 - "arguments": {},
86 - "auto_delete": false,
87 - "backing_queue_status": {
88 - "avg_ack_egress_rate": 0,
89 - "avg_ack_ingress_rate": 0,
90 - "avg_egress_rate": 0,
91 - "avg_ingress_rate": 0,
92 - "delta": [
93 - "delta",
94 - "undefined",
95 - 0,
96 - 0,
97 - "undefined"
98 - ],
99 - "len": 0,
100 - "mode": "default",
101 - "next_deliver_seq_id": 0,
102 - "next_seq_id": 0,
103 - "num_pending_acks": 0,
104 - "num_unconfirmed": 0,
105 - "q1": 0,
106 - "q2": 0,
107 - "q3": 0,
108 - "q4": 0,
109 - "target_ram_count": "infinity",
110 - "version": 1
111 - },
112 - "consumer_capacity": 0,
113 - "consumer_utilisation": 0,
114 - "consumers": 0,
115 - "durable": true,
116 - "effective_policy_definition": {},
117 - "exclusive": false,
118 - "exclusive_consumer_tag": null,
119 - "garbage_collection": {
120 - "fullsweep_after": 65535,
121 - "max_heap_size": 0,
122 - "min_bin_vheap_size": 46422,
123 - "min_heap_size": 233,
124 - "minor_gcs": 74
125 - },
126 - "head_message_timestamp": null,
127 - "idle_since": "2023-01-02T15:51:49.296+00:00",
128 - "memory": 55408,
129 - "message_bytes": 0,
130 - "message_bytes_paged_out": 0,
131 - "message_bytes_persistent": 0,
132 - "message_bytes_ram": 0,
133 - "message_bytes_ready": 0,
134 - "message_bytes_unacknowledged": 0,
135 - "messages": 1,
136 - "messages_details": {
137 - "rate": 0
138 - },
139 - "messages_paged_out": 1,
140 - "messages_persistent": 1,
141 - "messages_ram": 0,
142 - "messages_ready": 1,
143 - "messages_ready_details": {
144 - "rate": 0
145 - },
146 - "messages_ready_ram": 0,
147 - "messages_unacknowledged": 1,
148 - "messages_unacknowledged_details": {
149 - "rate": 0
150 - },
151 - "messages_unacknowledged_ram": 0,
152 - "name": "mySecondQueue",
153 - "node": "rabbit@localhost",
154 - "operator_policy": null,
155 - "policy": null,
156 - "recoverable_slaves": null,
157 - "reductions": 91878,
158 - "reductions_details": {
159 - "rate": 0
160 - },
161 - "single_active_consumer_tag": null,
162 - "state": "running",
163 - "type": "classic",
164 - "vhost": "/"
165 - },
166 - {
167 - "arguments": {
168 - "x-queue-type": "classic"
169 - },
170 - "auto_delete": false,
171 - "backing_queue_status": {
172 - "avg_ack_egress_rate": 0,
173 - "avg_ack_ingress_rate": 0,
174 - "avg_egress_rate": 0,
175 - "avg_ingress_rate": 0,
176 - "delta": [
177 - "delta",
178 - "undefined",
179 - 0,
180 - 0,
181 - "undefined"
182 - ],
183 - "len": 0,
184 - "mode": "default",
185 - "next_deliver_seq_id": 0,
186 - "next_seq_id": 0,
187 - "num_pending_acks": 0,
188 - "num_unconfirmed": 0,
189 - "q1": 0,
190 - "q2": 0,
191 - "q3": 0,
192 - "q4": 0,
193 - "target_ram_count": "infinity",
194 - "version": 1
195 - },
196 - "consumer_capacity": 0,
197 - "consumer_utilisation": 0,
198 - "consumers": 0,
199 - "durable": true,
200 - "effective_policy_definition": {},
201 - "exclusive": false,
202 - "exclusive_consumer_tag": null,
203 - "garbage_collection": {
204 - "fullsweep_after": 65535,
205 - "max_heap_size": 0,
206 - "min_bin_vheap_size": 46422,
207 - "min_heap_size": 233,
208 - "minor_gcs": 7
209 - },
210 - "head_message_timestamp": null,
211 - "idle_since": "2023-01-02T15:52:57.855+00:00",
212 - "memory": 55408,
213 - "message_bytes": 0,
214 - "message_bytes_paged_out": 0,
215 - "message_bytes_persistent": 0,
216 - "message_bytes_ram": 0,
217 - "message_bytes_ready": 0,
218 - "message_bytes_unacknowledged": 0,
219 - "messages": 1,
220 - "messages_details": {
221 - "rate": 0
222 - },
223 - "messages_paged_out": 1,
224 - "messages_persistent": 1,
225 - "messages_ram": 0,
226 - "messages_ready": 1,
227 - "messages_ready_details": {
228 - "rate": 0
229 - },
230 - "messages_ready_ram": 0,
231 - "messages_unacknowledged": 1,
232 - "messages_unacknowledged_details": {
233 - "rate": 0
234 - },
235 - "messages_unacknowledged_ram": 0,
236 - "name": "myFirstQueue",
237 - "node": "rabbit@localhost",
238 - "operator_policy": null,
239 - "policy": null,
240 - "recoverable_slaves": null,
241 - "reductions": 7431,
242 - "reductions_details": {
243 - "rate": 0
244 - },
245 - "single_active_consumer_tag": null,
246 - "state": "running",
247 - "type": "classic",
248 - "vhost": "myFirstVhost"
249 - },
250 - {
251 - "arguments": {
252 - "x-queue-type": "classic"
253 - },
254 - "auto_delete": false,
255 - "backing_queue_status": {
256 - "avg_ack_egress_rate": 0,
257 - "avg_ack_ingress_rate": 0,
258 - "avg_egress_rate": 0,
259 - "avg_ingress_rate": 0,
260 - "delta": [
261 - "delta",
262 - "undefined",
263 - 0,
264 - 0,
265 - "undefined"
266 - ],
267 - "len": 0,
268 - "mode": "default",
269 - "next_deliver_seq_id": 0,
270 - "next_seq_id": 0,
271 - "num_pending_acks": 0,
272 - "num_unconfirmed": 0,
273 - "q1": 0,
274 - "q2": 0,
275 - "q3": 0,
276 - "q4": 0,
277 - "target_ram_count": "infinity",
278 - "version": 1
279 - },
280 - "consumer_capacity": 0,
281 - "consumer_utilisation": 0,
282 - "consumers": 0,
283 - "durable": true,
284 - "effective_policy_definition": {},
285 - "exclusive": false,
286 - "exclusive_consumer_tag": null,
287 - "garbage_collection": {
288 - "fullsweep_after": 65535,
289 - "max_heap_size": 0,
290 - "min_bin_vheap_size": 46422,
291 - "min_heap_size": 233,
292 - "minor_gcs": 7
293 - },
294 - "head_message_timestamp": null,
295 - "idle_since": "2023-01-02T15:53:08.260+00:00",
296 - "memory": 55408,
297 - "message_bytes": 0,
298 - "message_bytes_paged_out": 0,
299 - "message_bytes_persistent": 0,
300 - "message_bytes_ram": 0,
301 - "message_bytes_ready": 0,
302 - "message_bytes_unacknowledged": 0,
303 - "messages": 1,
304 - "messages_details": {
305 - "rate": 0
306 - },
307 - "messages_paged_out": 1,
308 - "messages_persistent": 1,
309 - "messages_ram": 0,
310 - "messages_ready": 1,
311 - "messages_ready_details": {
312 - "rate": 0
313 - },
314 - "messages_ready_ram": 0,
315 - "messages_unacknowledged": 1,
316 - "messages_unacknowledged_details": {
317 - "rate": 0
318 - },
319 - "messages_unacknowledged_ram": 0,
320 - "name": "MyFirstQueue",
321 - "node": "rabbit@localhost",
322 - "operator_policy": null,
323 - "policy": null,
324 - "recoverable_slaves": null,
325 - "reductions": 7436,
326 - "reductions_details": {
327 - "rate": 0
328 - },
329 - "single_active_consumer_tag": null,
330 - "state": "running",
331 - "type": "classic",
332 - "vhost": "mySecondVhost"
333 - }
334 -]
src/go/plugin/go.d/modules/rabbitmq/testdata/v3.11.5/api-vhosts.json deleted
-82
@@ -1,82 +0,0 @@
1 -[
2 - {
3 - "cluster_state": {
4 - "rabbit@localhost": "running"
5 - },
6 - "default_queue_type": "undefined",
7 - "description": "Default virtual host",
8 - "messages": 1,
9 - "messages_details": {
10 - "rate": 0
11 - },
12 - "messages_ready": 1,
13 - "messages_ready_details": {
14 - "rate": 0
15 - },
16 - "messages_unacknowledged": 1,
17 - "messages_unacknowledged_details": {
18 - "rate": 0
19 - },
20 - "metadata": {
21 - "description": "Default virtual host",
22 - "tags": []
23 - },
24 - "name": "/",
25 - "tags": [],
26 - "tracing": false
27 - },
28 - {
29 - "cluster_state": {
30 - "rabbit@localhost": "running"
31 - },
32 - "default_queue_type": "classic",
33 - "description": "",
34 - "messages": 1,
35 - "messages_details": {
36 - "rate": 0
37 - },
38 - "messages_ready": 1,
39 - "messages_ready_details": {
40 - "rate": 0
41 - },
42 - "messages_unacknowledged": 1,
43 - "messages_unacknowledged_details": {
44 - "rate": 0
45 - },
46 - "metadata": {
47 - "default_queue_type": "classic",
48 - "description": "",
49 - "tags": []
50 - },
51 - "name": "myFirstVhost",
52 - "tags": [],
53 - "tracing": false
54 - },
55 - {
56 - "cluster_state": {
57 - "rabbit@localhost": "running"
58 - },
59 - "default_queue_type": "classic",
60 - "description": "",
61 - "messages": 1,
62 - "messages_details": {
63 - "rate": 0
64 - },
65 - "messages_ready": 1,
66 - "messages_ready_details": {
67 - "rate": 0
68 - },
69 - "messages_unacknowledged": 1,
70 - "messages_unacknowledged_details": {
71 - "rate": 0
72 - },
73 - "metadata": {
74 - "default_queue_type": "classic",
75 - "description": "",
76 - "tags": []
77 - },
78 - "name": "mySecondVhost",
79 - "tags": [],
80 - "tracing": false
81 - }
82 -]
src/go/plugin/go.d/modules/rabbitmq/testdata/v4.0.3/cluster/definitions.json new
+104
@@ -0,0 +1,104 @@
1 +{
2 + "rabbit_version": "4.0.3",
3 + "rabbitmq_version": "4.0.3",
4 + "product_name": "RabbitMQ",
5 + "product_version": "4.0.3",
6 + "users": [
7 + {
8 + "name": "guest",
9 + "password_hash": "maIOxAU84BmwfeXh05rmrqXtLRdCx7KlsaimulGAcEcFAn5W",
10 + "hashing_algorithm": "rabbit_password_hashing_sha256",
11 + "tags": [
12 + "administrator"
13 + ],
14 + "limits": {}
15 + }
16 + ],
17 + "vhosts": [
18 + {
19 + "name": "myFirstVhost",
20 + "description": "",
21 + "tags": [],
22 + "default_queue_type": "classic",
23 + "metadata": {
24 + "description": "",
25 + "tags": [],
26 + "default_queue_type": "classic"
27 + }
28 + },
29 + {
30 + "name": "/",
31 + "description": "Default virtual host",
32 + "tags": [],
33 + "metadata": {
34 + "description": "Default virtual host",
35 + "tags": []
36 + }
37 + }
38 + ],
39 + "permissions": [
40 + {
41 + "user": "guest",
42 + "vhost": "/",
43 + "configure": ".*",
44 + "write": ".*",
45 + "read": ".*"
46 + },
47 + {
48 + "user": "guest",
49 + "vhost": "myFirstVhost",
50 + "configure": ".*",
51 + "write": ".*",
52 + "read": ".*"
53 + }
54 + ],
55 + "topic_permissions": [],
56 + "parameters": [],
57 + "global_parameters": [
58 + {
59 + "name": "internal_cluster_id",
60 + "value": "rabbitmq-cluster-id-k4mxA-XhKLAErEaNk_o8_Q"
61 + }
62 + ],
63 + "policies": [],
64 + "queues": [
65 + {
66 + "name": "MyFirstQueue",
67 + "vhost": "myFirstVhost",
68 + "durable": true,
69 + "auto_delete": false,
70 + "arguments": {
71 + "x-queue-type": "classic"
72 + }
73 + },
74 + {
75 + "name": "myFirstQueue",
76 + "vhost": "myFirstVhost",
77 + "durable": true,
78 + "auto_delete": false,
79 + "arguments": {
80 + "x-queue-type": "classic"
81 + }
82 + },
83 + {
84 + "name": "MySecondQueue",
85 + "vhost": "/",
86 + "durable": true,
87 + "auto_delete": false,
88 + "arguments": {
89 + "x-queue-type": "classic"
90 + }
91 + },
92 + {
93 + "name": "MyFirstQueue",
94 + "vhost": "/",
95 + "durable": true,
96 + "auto_delete": false,
97 + "arguments": {
98 + "x-queue-type": "classic"
99 + }
100 + }
101 + ],
102 + "exchanges": [],
103 + "bindings": []
104 +}
src/go/plugin/go.d/modules/rabbitmq/testdata/v4.0.3/cluster/nodes.json new
+1024
@@ -0,0 +1,1024 @@
1 +[
2 + {
3 + "partitions": [],
4 + "os_pid": "840436",
5 + "fd_total": 1048576,
6 + "sockets_total": 0,
7 + "mem_limit": 10078757683,
8 + "mem_alarm": false,
9 + "disk_free_limit": 50000000,
10 + "disk_free_alarm": false,
11 + "proc_total": 1048576,
12 + "rates_mode": "basic",
13 + "uptime": 241932964,
14 + "run_queue": 1,
15 + "processors": 8,
16 + "exchange_types": [
17 + {
18 + "name": "fanout",
19 + "description": "AMQP fanout exchange, as per the AMQP specification",
20 + "enabled": true
21 + },
22 + {
23 + "name": "headers",
24 + "description": "AMQP headers exchange, as per the AMQP specification",
25 + "enabled": true
26 + },
27 + {
28 + "name": "x-local-random",
29 + "description": "Picks one random local binding (queue) to route via (to).",
30 + "enabled": true
31 + },
32 + {
33 + "name": "topic",
34 + "description": "AMQP topic exchange, as per the AMQP specification",
35 + "enabled": true
36 + },
37 + {
38 + "name": "direct",
39 + "description": "AMQP direct exchange, as per the AMQP specification",
40 + "enabled": true
41 + }
42 + ],
43 + "auth_mechanisms": [
44 + {
45 + "name": "PLAIN",
46 + "description": "SASL PLAIN authentication mechanism",
47 + "enabled": true
48 + },
49 + {
50 + "name": "ANONYMOUS",
51 + "description": "SASL ANONYMOUS authentication mechanism",
52 + "enabled": true
53 + },
54 + {
55 + "name": "AMQPLAIN",
56 + "description": "QPid AMQPLAIN mechanism",
57 + "enabled": true
58 + },
59 + {
60 + "name": "RABBIT-CR-DEMO",
61 + "description": "RabbitMQ Demo challenge-response authentication mechanism",
62 + "enabled": false
63 + }
64 + ],
65 + "applications": [
66 + {
67 + "name": "accept",
68 + "description": "Accept header(s) for Erlang/Elixir",
69 + "version": "0.3.5"
70 + },
71 + {
72 + "name": "amqp10_common",
73 + "description": "Modules shared by rabbitmq-amqp1.0 and rabbitmq-amqp1.0-client",
74 + "version": "4.0.3"
75 + },
76 + {
77 + "name": "amqp_client",
78 + "description": "RabbitMQ AMQP Client",
79 + "version": "4.0.3"
80 + },
81 + {
82 + "name": "asn1",
83 + "description": "The Erlang ASN1 compiler version 5.2.2",
84 + "version": "5.2.2"
85 + },
86 + {
87 + "name": "aten",
88 + "description": "Erlang node failure detector",
89 + "version": "0.6.0"
90 + },
91 + {
92 + "name": "compiler",
93 + "description": "ERTS CXC 138 10",
94 + "version": "8.4.3.2"
95 + },
96 + {
97 + "name": "cowboy",
98 + "description": "Small, fast, modern HTTP server.",
99 + "version": "2.12.0"
100 + },
101 + {
102 + "name": "cowlib",
103 + "description": "Support library for manipulating Web protocols.",
104 + "version": "2.13.0"
105 + },
106 + {
107 + "name": "credentials_obfuscation",
108 + "description": "Helper library that obfuscates sensitive values in process state",
109 + "version": "3.4.0"
110 + },
111 + {
112 + "name": "crypto",
113 + "description": "CRYPTO",
114 + "version": "5.4.2.3"
115 + },
116 + {
117 + "name": "cuttlefish",
118 + "description": "cuttlefish configuration abstraction",
119 + "version": "3.4.0"
120 + },
121 + {
122 + "name": "enough",
123 + "description": "A gen_server implementation with additional, overload-protected call type",
124 + "version": "0.1.0"
125 + },
126 + {
127 + "name": "erts",
128 + "description": "ERTS CXC 138 10",
129 + "version": "14.2.5.4"
130 + },
131 + {
132 + "name": "gen_batch_server",
133 + "description": "Generic batching server",
134 + "version": "0.8.8"
135 + },
136 + {
137 + "name": "horus",
138 + "description": "Creates standalone modules from anonymous functions",
139 + "version": "0.3.0"
140 + },
141 + {
142 + "name": "inets",
143 + "description": "INETS CXC 138 49",
144 + "version": "9.1.0.1"
145 + },
146 + {
147 + "name": "jose",
148 + "description": "JSON Object Signing and Encryption (JOSE) for Erlang and Elixir.",
149 + "version": "1.11.10"
150 + },
151 + {
152 + "name": "kernel",
153 + "description": "ERTS CXC 138 10",
154 + "version": "9.2.4.3"
155 + },
156 + {
157 + "name": "khepri",
158 + "description": "Tree-like replicated on-disk database library",
159 + "version": "0.16.0"
160 + },
161 + {
162 + "name": "khepri_mnesia_migration",
163 + "description": "Tools to migrate between Mnesia and Khepri",
164 + "version": "0.7.0"
165 + },
166 + {
167 + "name": "mnesia",
168 + "description": "MNESIA CXC 138 12",
169 + "version": "4.23.1"
170 + },
171 + {
172 + "name": "oauth2_client",
173 + "description": "OAuth2 client from the RabbitMQ Project",
174 + "version": "4.0.3"
175 + },
176 + {
177 + "name": "observer_cli",
178 + "description": "Visualize Erlang Nodes On The Command Line",
179 + "version": "1.7.5"
180 + },
181 + {
182 + "name": "os_mon",
183 + "description": "CPO CXC 138 46",
184 + "version": "2.9.1"
185 + },
186 + {
187 + "name": "osiris",
188 + "description": "Foundation of the log-based streaming subsystem for RabbitMQ",
189 + "version": "1.8.2"
190 + },
191 + {
192 + "name": "prometheus",
193 + "description": "Prometheus.io client in Erlang",
194 + "version": "4.11.0"
195 + },
196 + {
197 + "name": "public_key",
198 + "description": "Public key infrastructure",
199 + "version": "1.15.1.3"
200 + },
201 + {
202 + "name": "ra",
203 + "description": "Raft library",
204 + "version": "2.14.0"
205 + },
206 + {
207 + "name": "rabbit",
208 + "description": "RabbitMQ",
209 + "version": "4.0.3"
210 + },
211 + {
212 + "name": "rabbit_common",
213 + "description": "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
214 + "version": "4.0.3"
215 + },
216 + {
217 + "name": "rabbitmq_management",
218 + "description": "RabbitMQ Management Console",
219 + "version": "4.0.3"
220 + },
221 + {
222 + "name": "rabbitmq_management_agent",
223 + "description": "RabbitMQ Management Agent",
224 + "version": "4.0.3"
225 + },
226 + {
227 + "name": "rabbitmq_prelaunch",
228 + "description": "RabbitMQ prelaunch setup",
229 + "version": "4.0.3"
230 + },
231 + {
232 + "name": "rabbitmq_prometheus",
233 + "description": "Prometheus metrics for RabbitMQ",
234 + "version": "4.0.3"
235 + },
236 + {
237 + "name": "rabbitmq_web_dispatch",
238 + "description": "RabbitMQ Web Dispatcher",
239 + "version": "4.0.3"
240 + },
241 + {
242 + "name": "ranch",
243 + "description": "Socket acceptor pool for TCP protocols.",
244 + "version": "2.1.0"
245 + },
246 + {
247 + "name": "recon",
248 + "description": "Diagnostic tools for production use",
249 + "version": "2.5.6"
250 + },
251 + {
252 + "name": "redbug",
253 + "description": "Erlang Tracing Debugger",
254 + "version": "2.1.0"
255 + },
256 + {
257 + "name": "runtime_tools",
258 + "description": "RUNTIME_TOOLS",
259 + "version": "2.0.1"
260 + },
261 + {
262 + "name": "sasl",
263 + "description": "SASL CXC 138 11",
264 + "version": "4.2.1"
265 + },
266 + {
267 + "name": "seshat",
268 + "description": "Counters registry",
269 + "version": "0.6.1"
270 + },
271 + {
272 + "name": "ssl",
273 + "description": "Erlang/OTP SSL application",
274 + "version": "11.1.4.5"
275 + },
276 + {
277 + "name": "stdlib",
278 + "description": "ERTS CXC 138 10",
279 + "version": "5.2.3.2"
280 + },
281 + {
282 + "name": "stdout_formatter",
283 + "description": "Tools to format paragraphs, lists and tables as plain text",
284 + "version": "0.2.4"
285 + },
286 + {
287 + "name": "syntax_tools",
288 + "description": "Syntax tools",
289 + "version": "3.1"
290 + },
291 + {
292 + "name": "sysmon_handler",
293 + "description": "Rate-limiting system_monitor event handler",
294 + "version": "1.3.0"
295 + },
296 + {
297 + "name": "systemd",
298 + "description": "systemd integration for Erlang applications",
299 + "version": "0.6.1"
300 + },
301 + {
302 + "name": "thoas",
303 + "description": "A blazing fast JSON parser and generator in pure Erlang.",
304 + "version": "1.2.1"
305 + },
306 + {
307 + "name": "tools",
308 + "description": "DEVTOOLS CXC 138 16",
309 + "version": "3.6"
310 + },
311 + {
312 + "name": "xmerl",
313 + "description": "XML parser",
314 + "version": "1.3.34.1"
315 + }
316 + ],
317 + "contexts": [
318 + {
319 + "description": "RabbitMQ Management",
320 + "path": "/",
321 + "cowboy_opts": "[{sendfile,false}]",
322 + "port": "15672"
323 + },
324 + {
325 + "description": "RabbitMQ Prometheus",
326 + "path": "/",
327 + "port": "15692",
328 + "protocol": "'http/prometheus'",
329 + "cowboy_opts": "[{sendfile,false}]"
330 + }
331 + ],
332 + "log_files": [
333 + "<stdout>"
334 + ],
335 + "db_dir": "/var/lib/rabbitmq/mnesia/rabbit@ilyam-deb11-play",
336 + "config_files": [
337 + "/etc/rabbitmq/conf.d/10-defaults.conf"
338 + ],
339 + "net_ticktime": 60,
340 + "enabled_plugins": [
341 + "rabbitmq_management",
342 + "rabbitmq_prometheus"
343 + ],
344 + "mem_calculation_strategy": "rss",
345 + "ra_open_file_metrics": {
346 + "ra_log_wal": 0,
347 + "ra_log_segment_writer": 0
348 + },
349 + "name": "rabbit@ilyam-deb11-play",
350 + "type": "disc",
351 + "running": true,
352 + "being_drained": false,
353 + "mem_used": 142905344,
354 + "mem_used_details": {
355 + "rate": 20480
356 + },
357 + "fd_used": 42,
358 + "fd_used_details": {
359 + "rate": 0
360 + },
361 + "sockets_used": 0,
362 + "sockets_used_details": {
363 + "rate": 0
364 + },
365 + "proc_used": 438,
366 + "proc_used_details": {
367 + "rate": 0
368 + },
369 + "disk_free": 46901432320,
370 + "disk_free_details": {
371 + "rate": 0
372 + },
373 + "gc_num": 16844647,
374 + "gc_num_details": {
375 + "rate": 91.4
376 + },
377 + "gc_bytes_reclaimed": 731332039624,
378 + "gc_bytes_reclaimed_details": {
379 + "rate": 4150521.6
380 + },
381 + "context_switches": 55056718,
382 + "context_switches_details": {
383 + "rate": 267
384 + },
385 + "io_read_count": 0,
386 + "io_read_count_details": {
387 + "rate": 0
388 + },
389 + "io_read_bytes": 0,
390 + "io_read_bytes_details": {
391 + "rate": 0
392 + },
393 + "io_read_avg_time": 0,
394 + "io_read_avg_time_details": {
395 + "rate": 0
396 + },
397 + "io_write_count": 0,
398 + "io_write_count_details": {
399 + "rate": 0
400 + },
401 + "io_write_bytes": 0,
402 + "io_write_bytes_details": {
403 + "rate": 0
404 + },
405 + "io_write_avg_time": 0,
406 + "io_write_avg_time_details": {
407 + "rate": 0
408 + },
409 + "io_sync_count": 0,
410 + "io_sync_count_details": {
411 + "rate": 0
412 + },
413 + "io_sync_avg_time": 0,
414 + "io_sync_avg_time_details": {
415 + "rate": 0
416 + },
417 + "io_seek_count": 0,
418 + "io_seek_count_details": {
419 + "rate": 0
420 + },
421 + "io_seek_avg_time": 0,
422 + "io_seek_avg_time_details": {
423 + "rate": 0
424 + },
425 + "io_reopen_count": 0,
426 + "io_reopen_count_details": {
427 + "rate": 0
428 + },
429 + "mnesia_ram_tx_count": 0,
430 + "mnesia_ram_tx_count_details": {
431 + "rate": 0
432 + },
433 + "mnesia_disk_tx_count": 0,
434 + "mnesia_disk_tx_count_details": {
435 + "rate": 0
436 + },
437 + "msg_store_read_count": 0,
438 + "msg_store_read_count_details": {
439 + "rate": 0
440 + },
441 + "msg_store_write_count": 0,
442 + "msg_store_write_count_details": {
443 + "rate": 0
444 + },
445 + "queue_index_write_count": 0,
446 + "queue_index_write_count_details": {
447 + "rate": 0
448 + },
449 + "queue_index_read_count": 0,
450 + "queue_index_read_count_details": {
451 + "rate": 0
452 + },
453 + "connection_created": 0,
454 + "connection_created_details": {
455 + "rate": 0
456 + },
457 + "connection_closed": 1,
458 + "connection_closed_details": {
459 + "rate": 0
460 + },
461 + "channel_created": 0,
462 + "channel_created_details": {
463 + "rate": 0
464 + },
465 + "channel_closed": 0,
466 + "channel_closed_details": {
467 + "rate": 0
468 + },
469 + "queue_declared": 2,
470 + "queue_declared_details": {
471 + "rate": 0
472 + },
473 + "queue_created": 1,
474 + "queue_created_details": {
475 + "rate": 0
476 + },
477 + "queue_deleted": 0,
478 + "queue_deleted_details": {
479 + "rate": 0
480 + },
481 + "cluster_links": [
482 + {
483 + "stats": {
484 + "send_bytes": 2297379728,
485 + "send_bytes_details": {
486 + "rate": 26874
487 + },
488 + "recv_bytes": 2374358706,
489 + "recv_bytes_details": {
490 + "rate": 33535.8
491 + }
492 + },
493 + "name": "rabbit@pve-deb-work",
494 + "peer_addr": "10.10.10.20",
495 + "peer_port": 25672,
496 + "sock_addr": "10.10.10.21",
497 + "sock_port": 35872,
498 + "recv_bytes": 2374358706,
499 + "send_bytes": 2297379728
500 + }
501 + ],
502 + "metrics_gc_queue_length": {
503 + "connection_closed": 0,
504 + "channel_closed": 0,
505 + "consumer_deleted": 0,
506 + "exchange_deleted": 0,
507 + "queue_deleted": 0,
508 + "vhost_deleted": 0,
509 + "node_node_deleted": 0,
510 + "channel_consumer_deleted": 0
511 + }
512 + },
513 + {
514 + "partitions": [],
515 + "os_pid": "1460515",
516 + "fd_total": 1048576,
517 + "sockets_total": 0,
518 + "mem_limit": 15118277836,
519 + "mem_alarm": false,
520 + "disk_free_limit": 50000000,
521 + "disk_free_alarm": false,
522 + "proc_total": 1048576,
523 + "rates_mode": "basic",
524 + "uptime": 73793432,
525 + "run_queue": 0,
526 + "processors": 16,
527 + "exchange_types": [
528 + {
529 + "name": "headers",
530 + "description": "AMQP headers exchange, as per the AMQP specification",
531 + "enabled": true
532 + },
533 + {
534 + "name": "direct",
535 + "description": "AMQP direct exchange, as per the AMQP specification",
536 + "enabled": true
537 + },
538 + {
539 + "name": "fanout",
540 + "description": "AMQP fanout exchange, as per the AMQP specification",
541 + "enabled": true
542 + },
543 + {
544 + "name": "topic",
545 + "description": "AMQP topic exchange, as per the AMQP specification",
546 + "enabled": true
547 + },
548 + {
549 + "name": "x-local-random",
550 + "description": "Picks one random local binding (queue) to route via (to).",
551 + "enabled": true
552 + }
553 + ],
554 + "auth_mechanisms": [
555 + {
556 + "name": "ANONYMOUS",
557 + "description": "SASL ANONYMOUS authentication mechanism",
558 + "enabled": true
559 + },
560 + {
561 + "name": "PLAIN",
562 + "description": "SASL PLAIN authentication mechanism",
563 + "enabled": true
564 + },
565 + {
566 + "name": "AMQPLAIN",
567 + "description": "QPid AMQPLAIN mechanism",
568 + "enabled": true
569 + },
570 + {
571 + "name": "RABBIT-CR-DEMO",
572 + "description": "RabbitMQ Demo challenge-response authentication mechanism",
573 + "enabled": false
574 + }
575 + ],
576 + "applications": [
577 + {
578 + "name": "accept",
579 + "description": "Accept header(s) for Erlang/Elixir",
580 + "version": "0.3.5"
581 + },
582 + {
583 + "name": "amqp10_common",
584 + "description": "Modules shared by rabbitmq-amqp1.0 and rabbitmq-amqp1.0-client",
585 + "version": "4.0.3"
586 + },
587 + {
588 + "name": "amqp_client",
589 + "description": "RabbitMQ AMQP Client",
590 + "version": "4.0.3"
591 + },
592 + {
593 + "name": "asn1",
594 + "description": "The Erlang ASN1 compiler version 5.2.2",
595 + "version": "5.2.2"
596 + },
597 + {
598 + "name": "aten",
599 + "description": "Erlang node failure detector",
600 + "version": "0.6.0"
601 + },
602 + {
603 + "name": "compiler",
604 + "description": "ERTS CXC 138 10",
605 + "version": "8.4.3.2"
606 + },
607 + {
608 + "name": "cowboy",
609 + "description": "Small, fast, modern HTTP server.",
610 + "version": "2.12.0"
611 + },
612 + {
613 + "name": "cowlib",
614 + "description": "Support library for manipulating Web protocols.",
615 + "version": "2.13.0"
616 + },
617 + {
618 + "name": "credentials_obfuscation",
619 + "description": "Helper library that obfuscates sensitive values in process state",
620 + "version": "3.4.0"
621 + },
622 + {
623 + "name": "crypto",
624 + "description": "CRYPTO",
625 + "version": "5.4.2.3"
626 + },
627 + {
628 + "name": "cuttlefish",
629 + "description": "cuttlefish configuration abstraction",
630 + "version": "3.4.0"
631 + },
632 + {
633 + "name": "enough",
634 + "description": "A gen_server implementation with additional, overload-protected call type",
635 + "version": "0.1.0"
636 + },
637 + {
638 + "name": "erts",
639 + "description": "ERTS CXC 138 10",
640 + "version": "14.2.5.4"
641 + },
642 + {
643 + "name": "gen_batch_server",
644 + "description": "Generic batching server",
645 + "version": "0.8.8"
646 + },
647 + {
648 + "name": "horus",
649 + "description": "Creates standalone modules from anonymous functions",
650 + "version": "0.3.0"
651 + },
652 + {
653 + "name": "inets",
654 + "description": "INETS CXC 138 49",
655 + "version": "9.1.0.1"
656 + },
657 + {
658 + "name": "jose",
659 + "description": "JSON Object Signing and Encryption (JOSE) for Erlang and Elixir.",
660 + "version": "1.11.10"
661 + },
662 + {
663 + "name": "kernel",
664 + "description": "ERTS CXC 138 10",
665 + "version": "9.2.4.3"
666 + },
667 + {
668 + "name": "khepri",
669 + "description": "Tree-like replicated on-disk database library",
670 + "version": "0.16.0"
671 + },
672 + {
673 + "name": "khepri_mnesia_migration",
674 + "description": "Tools to migrate between Mnesia and Khepri",
675 + "version": "0.7.0"
676 + },
677 + {
678 + "name": "mnesia",
679 + "description": "MNESIA CXC 138 12",
680 + "version": "4.23.1"
681 + },
682 + {
683 + "name": "oauth2_client",
684 + "description": "OAuth2 client from the RabbitMQ Project",
685 + "version": "4.0.3"
686 + },
687 + {
688 + "name": "observer_cli",
689 + "description": "Visualize Erlang Nodes On The Command Line",
690 + "version": "1.7.5"
691 + },
692 + {
693 + "name": "os_mon",
694 + "description": "CPO CXC 138 46",
695 + "version": "2.9.1"
696 + },
697 + {
698 + "name": "osiris",
699 + "description": "Foundation of the log-based streaming subsystem for RabbitMQ",
700 + "version": "1.8.2"
701 + },
702 + {
703 + "name": "prometheus",
704 + "description": "Prometheus.io client in Erlang",
705 + "version": "4.11.0"
706 + },
707 + {
708 + "name": "public_key",
709 + "description": "Public key infrastructure",
710 + "version": "1.15.1.3"
711 + },
712 + {
713 + "name": "ra",
714 + "description": "Raft library",
715 + "version": "2.14.0"
716 + },
717 + {
718 + "name": "rabbit",
719 + "description": "RabbitMQ",
720 + "version": "4.0.3"
721 + },
722 + {
723 + "name": "rabbit_common",
724 + "description": "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
725 + "version": "4.0.3"
726 + },
727 + {
728 + "name": "rabbitmq_management",
729 + "description": "RabbitMQ Management Console",
730 + "version": "4.0.3"
731 + },
732 + {
733 + "name": "rabbitmq_management_agent",
734 + "description": "RabbitMQ Management Agent",
735 + "version": "4.0.3"
736 + },
737 + {
738 + "name": "rabbitmq_prelaunch",
739 + "description": "RabbitMQ prelaunch setup",
740 + "version": "4.0.3"
741 + },
742 + {
743 + "name": "rabbitmq_prometheus",
744 + "description": "Prometheus metrics for RabbitMQ",
745 + "version": "4.0.3"
746 + },
747 + {
748 + "name": "rabbitmq_web_dispatch",
749 + "description": "RabbitMQ Web Dispatcher",
750 + "version": "4.0.3"
751 + },
752 + {
753 + "name": "ranch",
754 + "description": "Socket acceptor pool for TCP protocols.",
755 + "version": "2.1.0"
756 + },
757 + {
758 + "name": "recon",
759 + "description": "Diagnostic tools for production use",
760 + "version": "2.5.6"
761 + },
762 + {
763 + "name": "redbug",
764 + "description": "Erlang Tracing Debugger",
765 + "version": "2.1.0"
766 + },
767 + {
768 + "name": "runtime_tools",
769 + "description": "RUNTIME_TOOLS",
770 + "version": "2.0.1"
771 + },
772 + {
773 + "name": "sasl",
774 + "description": "SASL CXC 138 11",
775 + "version": "4.2.1"
776 + },
777 + {
778 + "name": "seshat",
779 + "description": "Counters registry",
780 + "version": "0.6.1"
781 + },
782 + {
783 + "name": "ssl",
784 + "description": "Erlang/OTP SSL application",
785 + "version": "11.1.4.5"
786 + },
787 + {
788 + "name": "stdlib",
789 + "description": "ERTS CXC 138 10",
790 + "version": "5.2.3.2"
791 + },
792 + {
793 + "name": "stdout_formatter",
794 + "description": "Tools to format paragraphs, lists and tables as plain text",
795 + "version": "0.2.4"
796 + },
797 + {
798 + "name": "syntax_tools",
799 + "description": "Syntax tools",
800 + "version": "3.1"
801 + },
802 + {
803 + "name": "sysmon_handler",
804 + "description": "Rate-limiting system_monitor event handler",
805 + "version": "1.3.0"
806 + },
807 + {
808 + "name": "systemd",
809 + "description": "systemd integration for Erlang applications",
810 + "version": "0.6.1"
811 + },
812 + {
813 + "name": "thoas",
814 + "description": "A blazing fast JSON parser and generator in pure Erlang.",
815 + "version": "1.2.1"
816 + },
817 + {
818 + "name": "tools",
819 + "description": "DEVTOOLS CXC 138 16",
820 + "version": "3.6"
821 + },
822 + {
823 + "name": "xmerl",
824 + "description": "XML parser",
825 + "version": "1.3.34.1"
826 + }
827 + ],
828 + "contexts": [
829 + {
830 + "description": "RabbitMQ Management",
831 + "path": "/",
832 + "cowboy_opts": "[{sendfile,false}]",
833 + "port": "15672"
834 + },
835 + {
836 + "description": "RabbitMQ Prometheus",
837 + "path": "/",
838 + "port": "15692",
839 + "protocol": "'http/prometheus'",
840 + "cowboy_opts": "[{sendfile,false}]"
841 + }
842 + ],
843 + "log_files": [
844 + "<stdout>"
845 + ],
846 + "db_dir": "/var/lib/rabbitmq/mnesia/rabbit@pve-deb-work",
847 + "config_files": [
848 + "/etc/rabbitmq/conf.d/10-defaults.conf"
849 + ],
850 + "net_ticktime": 60,
851 + "enabled_plugins": [
852 + "rabbitmq_management",
853 + "rabbitmq_prometheus"
854 + ],
855 + "mem_calculation_strategy": "rss",
856 + "ra_open_file_metrics": {
857 + "ra_log_wal": 0,
858 + "ra_log_segment_writer": 0
859 + },
860 + "name": "rabbit@pve-deb-work",
861 + "type": "disc",
862 + "running": true,
863 + "being_drained": false,
864 + "mem_used": 160018432,
865 + "mem_used_details": {
866 + "rate": 66355.2
867 + },
868 + "fd_used": 48,
869 + "fd_used_details": {
870 + "rate": 0
871 + },
872 + "sockets_used": 0,
873 + "sockets_used_details": {
874 + "rate": 0
875 + },
876 + "proc_used": 467,
877 + "proc_used_details": {
878 + "rate": 0
879 + },
880 + "disk_free": 103827365888,
881 + "disk_free_details": {
882 + "rate": 0
883 + },
884 + "gc_num": 6905715,
885 + "gc_num_details": {
886 + "rate": 88
887 + },
888 + "gc_bytes_reclaimed": 345454123080,
889 + "gc_bytes_reclaimed_details": {
890 + "rate": 4854558.4
891 + },
892 + "context_switches": 20023814,
893 + "context_switches_details": {
894 + "rate": 263
895 + },
896 + "io_read_count": 0,
897 + "io_read_count_details": {
898 + "rate": 0
899 + },
900 + "io_read_bytes": 0,
901 + "io_read_bytes_details": {
902 + "rate": 0
903 + },
904 + "io_read_avg_time": 0,
905 + "io_read_avg_time_details": {
906 + "rate": 0
907 + },
908 + "io_write_count": 0,
909 + "io_write_count_details": {
910 + "rate": 0
911 + },
912 + "io_write_bytes": 0,
913 + "io_write_bytes_details": {
914 + "rate": 0
915 + },
916 + "io_write_avg_time": 0,
917 + "io_write_avg_time_details": {
918 + "rate": 0
919 + },
920 + "io_sync_count": 0,
921 + "io_sync_count_details": {
922 + "rate": 0
923 + },
924 + "io_sync_avg_time": 0,
925 + "io_sync_avg_time_details": {
926 + "rate": 0
927 + },
928 + "io_seek_count": 0,
929 + "io_seek_count_details": {
930 + "rate": 0
931 + },
932 + "io_seek_avg_time": 0,
933 + "io_seek_avg_time_details": {
934 + "rate": 0
935 + },
936 + "io_reopen_count": 0,
937 + "io_reopen_count_details": {
938 + "rate": 0
939 + },
940 + "mnesia_ram_tx_count": 0,
941 + "mnesia_ram_tx_count_details": {
942 + "rate": 0
943 + },
944 + "mnesia_disk_tx_count": 0,
945 + "mnesia_disk_tx_count_details": {
946 + "rate": 0
947 + },
948 + "msg_store_read_count": 0,
949 + "msg_store_read_count_details": {
950 + "rate": 0
951 + },
952 + "msg_store_write_count": 0,
953 + "msg_store_write_count_details": {
954 + "rate": 0
955 + },
956 + "queue_index_write_count": 0,
957 + "queue_index_write_count_details": {
958 + "rate": 0
959 + },
960 + "queue_index_read_count": 0,
961 + "queue_index_read_count_details": {
962 + "rate": 0
963 + },
964 + "connection_created": 7,
965 + "connection_created_details": {
966 + "rate": 0
967 + },
968 + "connection_closed": 7,
969 + "connection_closed_details": {
970 + "rate": 0
971 + },
972 + "channel_created": 7,
973 + "channel_created_details": {
974 + "rate": 0
975 + },
976 + "channel_closed": 7,
977 + "channel_closed_details": {
978 + "rate": 0
979 + },
980 + "queue_declared": 1,
981 + "queue_declared_details": {
982 + "rate": 0
983 + },
984 + "queue_created": 1,
985 + "queue_created_details": {
986 + "rate": 0
987 + },
988 + "queue_deleted": 0,
989 + "queue_deleted_details": {
990 + "rate": 0
991 + },
992 + "cluster_links": [
993 + {
994 + "stats": {
995 + "send_bytes": 2374291460,
996 + "send_bytes_details": {
997 + "rate": 33526.2
998 + },
999 + "recv_bytes": 2297325788,
1000 + "recv_bytes_details": {
1001 + "rate": 26873.2
1002 + }
1003 + },
1004 + "name": "rabbit@ilyam-deb11-play",
1005 + "peer_addr": "10.10.10.21",
1006 + "peer_port": 35872,
1007 + "sock_addr": "10.10.10.20",
1008 + "sock_port": 25672,
1009 + "recv_bytes": 2297460158,
1010 + "send_bytes": 2374459095
1011 + }
1012 + ],
1013 + "metrics_gc_queue_length": {
1014 + "connection_closed": 0,
1015 + "channel_closed": 0,
1016 + "consumer_deleted": 0,
1017 + "exchange_deleted": 0,
1018 + "queue_deleted": 0,
1019 + "vhost_deleted": 0,
1020 + "node_node_deleted": 0,
1021 + "channel_consumer_deleted": 0
1022 + }
1023 + }
1024 +]
src/go/plugin/go.d/modules/rabbitmq/testdata/v4.0.3/cluster/overview.json new
+299
@@ -0,0 +1,299 @@
1 +{
2 + "management_version": "4.0.3",
3 + "rates_mode": "basic",
4 + "sample_retention_policies": {
5 + "global": [
6 + 600,
7 + 3600,
8 + 28800,
9 + 86400
10 + ],
11 + "basic": [
12 + 600,
13 + 3600
14 + ],
15 + "detailed": [
16 + 600
17 + ]
18 + },
19 + "exchange_types": [
20 + {
21 + "name": "direct",
22 + "description": "AMQP direct exchange, as per the AMQP specification",
23 + "enabled": true
24 + },
25 + {
26 + "name": "fanout",
27 + "description": "AMQP fanout exchange, as per the AMQP specification",
28 + "enabled": true
29 + },
30 + {
31 + "name": "headers",
32 + "description": "AMQP headers exchange, as per the AMQP specification",
33 + "enabled": true
34 + },
35 + {
36 + "name": "topic",
37 + "description": "AMQP topic exchange, as per the AMQP specification",
38 + "enabled": true
39 + },
40 + {
41 + "name": "x-local-random",
42 + "description": "Picks one random local binding (queue) to route via (to).",
43 + "enabled": true
44 + }
45 + ],
46 + "product_version": "4.0.3",
47 + "product_name": "RabbitMQ",
48 + "rabbitmq_version": "4.0.3",
49 + "cluster_name": "rabbit@pve-deb-work",
50 + "erlang_version": "26.2.5.5",
51 + "erlang_full_version": "Erlang/OTP 26 [erts-14.2.5.4] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]",
52 + "release_series_support_status": "supported",
53 + "disable_stats": false,
54 + "is_op_policy_updating_enabled": true,
55 + "enable_queue_totals": false,
56 + "message_stats": {
57 + "get": 3,
58 + "deliver": 0,
59 + "confirm": 1,
60 + "ack": 0,
61 + "publish": 1,
62 + "disk_reads": 0,
63 + "disk_writes": 0,
64 + "get_empty": 2,
65 + "get_no_ack": 1,
66 + "deliver_no_ack": 0,
67 + "redeliver": 3,
68 + "drop_unroutable": 0,
69 + "return_unroutable": 0,
70 + "deliver_get": 4,
71 + "get_empty_details": {
72 + "rate": 0
73 + },
74 + "deliver_get_details": {
75 + "rate": 0
76 + },
77 + "ack_details": {
78 + "rate": 0
79 + },
80 + "redeliver_details": {
81 + "rate": 0
82 + },
83 + "deliver_no_ack_details": {
84 + "rate": 0
85 + },
86 + "deliver_details": {
87 + "rate": 0
88 + },
89 + "get_no_ack_details": {
90 + "rate": 0
91 + },
92 + "get_details": {
93 + "rate": 0
94 + },
95 + "drop_unroutable_details": {
96 + "rate": 0
97 + },
98 + "return_unroutable_details": {
99 + "rate": 0
100 + },
101 + "confirm_details": {
102 + "rate": 0
103 + },
104 + "publish_details": {
105 + "rate": 0
106 + },
107 + "disk_writes_details": {
108 + "rate": 0
109 + },
110 + "disk_reads_details": {
111 + "rate": 0
112 + }
113 + },
114 + "churn_rates": {
115 + "connection_closed": 8,
116 + "queue_declared": 3,
117 + "queue_created": 2,
118 + "connection_created": 7,
119 + "queue_deleted": 0,
120 + "channel_created": 7,
121 + "channel_closed": 7,
122 + "queue_deleted_details": {
123 + "rate": 0
124 + },
125 + "queue_created_details": {
126 + "rate": 0
127 + },
128 + "queue_declared_details": {
129 + "rate": 0
130 + },
131 + "channel_closed_details": {
132 + "rate": 0
133 + },
134 + "channel_created_details": {
135 + "rate": 0
136 + },
137 + "connection_closed_details": {
138 + "rate": 0
139 + },
140 + "connection_created_details": {
141 + "rate": 0
142 + }
143 + },
144 + "queue_totals": {
145 + "messages": 0,
146 + "messages_ready": 0,
147 + "messages_unacknowledged": 0,
148 + "messages_details": {
149 + "rate": 0
150 + },
151 + "messages_unacknowledged_details": {
152 + "rate": 0
153 + },
154 + "messages_ready_details": {
155 + "rate": 0
156 + }
157 + },
158 + "object_totals": {
159 + "channels": 0,
160 + "consumers": 0,
161 + "exchanges": 14,
162 + "queues": 4,
163 + "connections": 0
164 + },
165 + "statistics_db_event_queue": 0,
166 + "node": "rabbit@pve-deb-work",
167 + "listeners": [
168 + {
169 + "node": "rabbit@ilyam-deb11-play",
170 + "protocol": "amqp",
171 + "ip_address": "::",
172 + "port": 5672,
173 + "socket_opts": {
174 + "backlog": 128,
175 + "nodelay": true,
176 + "linger": [
177 + true,
178 + 0
179 + ],
180 + "exit_on_close": false
181 + }
182 + },
183 + {
184 + "node": "rabbit@pve-deb-work",
185 + "protocol": "amqp",
186 + "ip_address": "::",
187 + "port": 5672,
188 + "socket_opts": {
189 + "backlog": 128,
190 + "nodelay": true,
191 + "linger": [
192 + true,
193 + 0
194 + ],
195 + "exit_on_close": false
196 + }
197 + },
198 + {
199 + "node": "rabbit@ilyam-deb11-play",
200 + "protocol": "clustering",
201 + "ip_address": "::",
202 + "port": 25672,
203 + "socket_opts": []
204 + },
205 + {
206 + "node": "rabbit@pve-deb-work",
207 + "protocol": "clustering",
208 + "ip_address": "::",
209 + "port": 25672,
210 + "socket_opts": []
211 + },
212 + {
213 + "node": "rabbit@ilyam-deb11-play",
214 + "protocol": "http",
215 + "ip_address": "::",
216 + "port": 15672,
217 + "socket_opts": {
218 + "cowboy_opts": {
219 + "sendfile": false
220 + },
221 + "port": 15672
222 + }
223 + },
224 + {
225 + "node": "rabbit@pve-deb-work",
226 + "protocol": "http",
227 + "ip_address": "::",
228 + "port": 15672,
229 + "socket_opts": {
230 + "cowboy_opts": {
231 + "sendfile": false
232 + },
233 + "port": 15672
234 + }
235 + },
236 + {
237 + "node": "rabbit@ilyam-deb11-play",
238 + "protocol": "http/prometheus",
239 + "ip_address": "::",
240 + "port": 15692,
241 + "socket_opts": {
242 + "port": 15692,
243 + "protocol": "http/prometheus",
244 + "cowboy_opts": {
245 + "sendfile": false
246 + }
247 + }
248 + },
249 + {
250 + "node": "rabbit@pve-deb-work",
251 + "protocol": "http/prometheus",
252 + "ip_address": "::",
253 + "port": 15692,
254 + "socket_opts": {
255 + "port": 15692,
256 + "protocol": "http/prometheus",
257 + "cowboy_opts": {
258 + "sendfile": false
259 + }
260 + }
261 + }
262 + ],
263 + "contexts": [
264 + {
265 + "ssl_opts": [],
266 + "node": "rabbit@ilyam-deb11-play",
267 + "description": "RabbitMQ Management",
268 + "path": "/",
269 + "cowboy_opts": "[{sendfile,false}]",
270 + "port": "15672"
271 + },
272 + {
273 + "ssl_opts": [],
274 + "node": "rabbit@pve-deb-work",
275 + "description": "RabbitMQ Management",
276 + "path": "/",
277 + "cowboy_opts": "[{sendfile,false}]",
278 + "port": "15672"
279 + },
280 + {
281 + "ssl_opts": [],
282 + "node": "rabbit@ilyam-deb11-play",
283 + "description": "RabbitMQ Prometheus",
284 + "path": "/",
285 + "port": "15692",
286 + "protocol": "'http/prometheus'",
287 + "cowboy_opts": "[{sendfile,false}]"
288 + },
289 + {
290 + "ssl_opts": [],
291 + "node": "rabbit@pve-deb-work",
292 + "description": "RabbitMQ Prometheus",
293 + "path": "/",
294 + "port": "15692",
295 + "protocol": "'http/prometheus'",
296 + "cowboy_opts": "[{sendfile,false}]"
297 + }
298 + ]
299 +}
src/go/plugin/go.d/modules/rabbitmq/testdata/v4.0.3/cluster/queues.json new
+224
@@ -0,0 +1,224 @@
1 +[
2 + {
3 + "arguments": {
4 + "x-queue-type": "classic"
5 + },
6 + "auto_delete": false,
7 + "consumer_capacity": 0,
8 + "consumer_utilisation": 0,
9 + "consumers": 0,
10 + "durable": true,
11 + "effective_policy_definition": {},
12 + "exclusive": false,
13 + "memory": 16920,
14 + "message_bytes": 0,
15 + "message_bytes_paged_out": 0,
16 + "message_bytes_persistent": 0,
17 + "message_bytes_ram": 0,
18 + "message_bytes_ready": 0,
19 + "message_bytes_unacknowledged": 0,
20 + "message_stats": {
21 + "ack": 0,
22 + "ack_details": {
23 + "rate": 0
24 + },
25 + "deliver": 0,
26 + "deliver_details": {
27 + "rate": 0
28 + },
29 + "deliver_get": 4,
30 + "deliver_get_details": {
31 + "rate": 0
32 + },
33 + "deliver_no_ack": 0,
34 + "deliver_no_ack_details": {
35 + "rate": 0
36 + },
37 + "get": 3,
38 + "get_details": {
39 + "rate": 0
40 + },
41 + "get_empty": 2,
42 + "get_empty_details": {
43 + "rate": 0
44 + },
45 + "get_no_ack": 1,
46 + "get_no_ack_details": {
47 + "rate": 0
48 + },
49 + "publish": 1,
50 + "publish_details": {
51 + "rate": 0
52 + },
53 + "redeliver": 3,
54 + "redeliver_details": {
55 + "rate": 0
56 + }
57 + },
58 + "messages": 0,
59 + "messages_details": {
60 + "rate": 0
61 + },
62 + "messages_paged_out": 0,
63 + "messages_persistent": 0,
64 + "messages_ram": 0,
65 + "messages_ready": 0,
66 + "messages_ready_details": {
67 + "rate": 0
68 + },
69 + "messages_ready_ram": 0,
70 + "messages_unacknowledged": 0,
71 + "messages_unacknowledged_details": {
72 + "rate": 0
73 + },
74 + "messages_unacknowledged_ram": 0,
75 + "name": "MyFirstQueue",
76 + "node": "rabbit@pve-deb-work",
77 + "reductions": 21378,
78 + "reductions_details": {
79 + "rate": 0
80 + },
81 + "state": "running",
82 + "storage_version": 2,
83 + "type": "classic",
84 + "vhost": "/"
85 + },
86 + {
87 + "arguments": {
88 + "x-queue-type": "classic"
89 + },
90 + "auto_delete": false,
91 + "consumer_capacity": 0,
92 + "consumer_utilisation": 0,
93 + "consumers": 0,
94 + "durable": true,
95 + "effective_policy_definition": {},
96 + "exclusive": false,
97 + "memory": 21808,
98 + "message_bytes": 0,
99 + "message_bytes_paged_out": 0,
100 + "message_bytes_persistent": 0,
101 + "message_bytes_ram": 0,
102 + "message_bytes_ready": 0,
103 + "message_bytes_unacknowledged": 0,
104 + "messages": 0,
105 + "messages_details": {
106 + "rate": 0
107 + },
108 + "messages_paged_out": 0,
109 + "messages_persistent": 0,
110 + "messages_ram": 0,
111 + "messages_ready": 0,
112 + "messages_ready_details": {
113 + "rate": 0
114 + },
115 + "messages_ready_ram": 0,
116 + "messages_unacknowledged": 0,
117 + "messages_unacknowledged_details": {
118 + "rate": 0
119 + },
120 + "messages_unacknowledged_ram": 0,
121 + "name": "MySecondQueue",
122 + "node": "rabbit@pve-deb-work",
123 + "reductions": 12204,
124 + "reductions_details": {
125 + "rate": 0
126 + },
127 + "state": "running",
128 + "storage_version": 2,
129 + "type": "classic",
130 + "vhost": "/"
131 + },
132 + {
133 + "arguments": {
134 + "x-queue-type": "classic"
135 + },
136 + "auto_delete": false,
137 + "consumer_capacity": 0,
138 + "consumer_utilisation": 0,
139 + "consumers": 0,
140 + "durable": true,
141 + "effective_policy_definition": {},
142 + "exclusive": false,
143 + "memory": 42520,
144 + "message_bytes": 0,
145 + "message_bytes_paged_out": 0,
146 + "message_bytes_persistent": 0,
147 + "message_bytes_ram": 0,
148 + "message_bytes_ready": 0,
149 + "message_bytes_unacknowledged": 0,
150 + "messages": 0,
151 + "messages_details": {
152 + "rate": 0
153 + },
154 + "messages_paged_out": 0,
155 + "messages_persistent": 0,
156 + "messages_ram": 0,
157 + "messages_ready": 0,
158 + "messages_ready_details": {
159 + "rate": 0
160 + },
161 + "messages_ready_ram": 0,
162 + "messages_unacknowledged": 0,
163 + "messages_unacknowledged_details": {
164 + "rate": 0
165 + },
166 + "messages_unacknowledged_ram": 0,
167 + "name": "MyFirstQueue",
168 + "node": "rabbit@ilyam-deb11-play",
169 + "reductions": 9133,
170 + "reductions_details": {
171 + "rate": 0
172 + },
173 + "state": "running",
174 + "storage_version": 2,
175 + "type": "classic",
176 + "vhost": "myFirstVhost"
177 + },
178 + {
179 + "arguments": {
180 + "x-queue-type": "classic"
181 + },
182 + "auto_delete": false,
183 + "consumer_capacity": 0,
184 + "consumer_utilisation": 0,
185 + "consumers": 0,
186 + "durable": true,
187 + "effective_policy_definition": {},
188 + "exclusive": false,
189 + "memory": 142984,
190 + "message_bytes": 0,
191 + "message_bytes_paged_out": 0,
192 + "message_bytes_persistent": 0,
193 + "message_bytes_ram": 0,
194 + "message_bytes_ready": 0,
195 + "message_bytes_unacknowledged": 0,
196 + "messages": 0,
197 + "messages_details": {
198 + "rate": 0
199 + },
200 + "messages_paged_out": 0,
201 + "messages_persistent": 0,
202 + "messages_ram": 0,
203 + "messages_ready": 0,
204 + "messages_ready_details": {
205 + "rate": 0
206 + },
207 + "messages_ready_ram": 0,
208 + "messages_unacknowledged": 0,
209 + "messages_unacknowledged_details": {
210 + "rate": 0
211 + },
212 + "messages_unacknowledged_ram": 0,
213 + "name": "myFirstQueue",
214 + "node": "rabbit@pve-deb-work",
215 + "reductions": 8816,
216 + "reductions_details": {
217 + "rate": 0
218 + },
219 + "state": "running",
220 + "storage_version": 2,
221 + "type": "classic",
222 + "vhost": "myFirstVhost"
223 + }
224 +]
src/go/plugin/go.d/modules/rabbitmq/testdata/v4.0.3/cluster/vhosts.json new
+107
@@ -0,0 +1,107 @@
1 +[
2 + {
3 + "cluster_state": {
4 + "rabbit@ilyam-deb11-play": "running",
5 + "rabbit@pve-deb-work": "running"
6 + },
7 + "default_queue_type": "undefined",
8 + "description": "Default virtual host",
9 + "message_stats": {
10 + "ack": 0,
11 + "ack_details": {
12 + "rate": 0
13 + },
14 + "confirm": 1,
15 + "confirm_details": {
16 + "rate": 0
17 + },
18 + "deliver": 0,
19 + "deliver_details": {
20 + "rate": 0
21 + },
22 + "deliver_get": 4,
23 + "deliver_get_details": {
24 + "rate": 0
25 + },
26 + "deliver_no_ack": 0,
27 + "deliver_no_ack_details": {
28 + "rate": 0
29 + },
30 + "drop_unroutable": 0,
31 + "drop_unroutable_details": {
32 + "rate": 0
33 + },
34 + "get": 3,
35 + "get_details": {
36 + "rate": 0
37 + },
38 + "get_empty": 2,
39 + "get_empty_details": {
40 + "rate": 0
41 + },
42 + "get_no_ack": 1,
43 + "get_no_ack_details": {
44 + "rate": 0
45 + },
46 + "publish": 1,
47 + "publish_details": {
48 + "rate": 0
49 + },
50 + "redeliver": 3,
51 + "redeliver_details": {
52 + "rate": 0
53 + },
54 + "return_unroutable": 0,
55 + "return_unroutable_details": {
56 + "rate": 0
57 + }
58 + },
59 + "messages": 0,
60 + "messages_details": {
61 + "rate": 0
62 + },
63 + "messages_ready": 0,
64 + "messages_ready_details": {
65 + "rate": 0
66 + },
67 + "messages_unacknowledged": 0,
68 + "messages_unacknowledged_details": {
69 + "rate": 0
70 + },
71 + "metadata": {
72 + "description": "Default virtual host",
73 + "tags": []
74 + },
75 + "name": "/",
76 + "tags": [],
77 + "tracing": false
78 + },
79 + {
80 + "cluster_state": {
81 + "rabbit@ilyam-deb11-play": "running",
82 + "rabbit@pve-deb-work": "running"
83 + },
84 + "default_queue_type": "classic",
85 + "description": "",
86 + "messages": 0,
87 + "messages_details": {
88 + "rate": 0
89 + },
90 + "messages_ready": 0,
91 + "messages_ready_details": {
92 + "rate": 0
93 + },
94 + "messages_unacknowledged": 0,
95 + "messages_unacknowledged_details": {
96 + "rate": 0
97 + },
98 + "metadata": {
99 + "description": "",
100 + "tags": [],
101 + "default_queue_type": "classic"
102 + },
103 + "name": "myFirstVhost",
104 + "tags": [],
105 + "tracing": false
106 + }
107 +]