11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/sensu/plugins/rabbitmq/cloudwatch/queues.rb', line 11
def self.metrics_for(queue)
dimensions = [{ name: 'queue', value: queue['name'] }]
[
{
metric_name: 'QueueMemory',
value: queue['memory'],
unit: 'Bytes'
},
{
metric_name: 'QueueMessages',
value: queue['messages'],
unit: 'Count'
},
{
metric_name: 'QueueMessagesRate',
value: queue['messages_details']['rate'],
unit: 'Count/Second'
},
{
metric_name: 'QueueMessagesReady',
value: queue['messages_ready'],
unit: 'Count'
},
{
metric_name: 'QueueMessagesReadyRate',
value: queue['messages_ready_details']['rate'],
unit: 'Count/Second'
},
{
metric_name: 'QueueMessagesUnacknowledged',
value: queue['messages_unacknowledged'],
unit: 'Count'
},
{
metric_name: 'QueueMessagesUnacknowledgedRate',
value: queue['messages_unacknowledged_details']['rate'],
unit: 'Count/Second'
},
{
metric_name: 'QueueConsumers',
value: queue['consumers'],
unit: 'Count'
},
{
metric_name: 'QueueMessagesRam',
value: queue['messages_ram'],
unit: 'Bytes'
},
{
metric_name: 'QueueMessagesReadyRam',
value: queue['messages_ready_ram'],
unit: 'Bytes'
},
{
metric_name: 'QueueUnacknowledgedRam',
value: queue['messages_unacknowledged_ram'],
unit: 'Bytes'
},
{
metric_name: 'QueueMessagesPersistent',
value: queue['messages_persistent'],
unit: 'Count'
},
{
metric_name: 'QueueMessageBytes',
value: queue['message_bytes'],
unit: 'Bytes'
},
{
metric_name: 'QueueMessageBytesReady',
value: queue['message_bytes_ready'],
unit: 'Bytes'
},
{
metric_name: 'QueueMessageBytesUnacknowledged',
value: queue['message_bytes_unacknowledged'],
unit: 'Bytes'
},
{
metric_name: 'QueueMessageBytesRam',
value: queue['message_bytes_ram'],
unit: 'Bytes'
},
{
metric_name: 'QueueMessageBytesPersistent',
value: queue['message_bytes_persistent'],
unit: 'Bytes'
},
{
metric_name: 'QueueDiskReads',
value: queue['disk_reads'],
unit: 'Count'
},
{
metric_name: 'QueueDiskWrites',
value: queue['disk_writes'],
unit: 'Count'
}
].map do |metric|
metric[:dimensions] = dimensions
metric
end
end
|