riemann-cassandra 0.1.7-java → 0.1.8-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d7f49746236b8af95c433af165788339ac3e7e7
4
- data.tar.gz: c4049bddf0a1f611e5919b48e309a6a7aad56471
3
+ metadata.gz: 690a3ada907ac2d2d4629783f97275df82e403ca
4
+ data.tar.gz: 96367386f953967076e909a007c407acc691ae6e
5
5
  SHA512:
6
- metadata.gz: e4e4066268c9e4597c18146521c646ab1426cc8fb03d18de0e5205c9a5383bd34f542a4d243300f5fe3dfdd7f4ce2952e4415b9c79b6e1f0086a94cfae48b6c0
7
- data.tar.gz: 35631c8b573756cf66bca862ae6980e6f2a935ebd437b91c1f83adb4150abfbe10b0843a988c12a09fab27dc5ba4af5dcf915a72fa607d11d936cfdfca3b75fd
6
+ metadata.gz: 59bc711781b05741a296f0f6eb442486523ebb0100bd0dce677aaf81cb65c8dac571f71ee43468a84e302bd7b3880c5064bb5e25ba19c1296a0bc182b7cef389
7
+ data.tar.gz: 820d124c92b79f74b63de4b35bcb5fe493f80c269e7f7fb2d702d368434cebe391e0c2ee7c616544d7569cb520e1349443e1ab263c7e623de022aaa0b2228e46
data/README.md CHANGED
@@ -14,8 +14,8 @@ Gem for sending Cassandra metrics to Riemann. To use it you will need a JMX enab
14
14
  * Pending tasks (per stage)
15
15
  * Currently blocked tasks
16
16
  * Load
17
- * (TODO) ParNew garbage collections (count|time)
18
- * (TODO) CMS garbage collections (count|time)
17
+ * ParNew garbage collections (count|time)
18
+ * CMS garbage collections (count|time)
19
19
 
20
20
  More:
21
21
  * https://www.datadoghq.com/blog/how-to-monitor-cassandra-performance-metrics/
@@ -2,7 +2,6 @@
2
2
  require 'riemann/tools'
3
3
  require 'riemann/cassandra'
4
4
 
5
-
6
5
  class Riemann::Tools::Cassandra
7
6
  include Riemann::Tools
8
7
 
@@ -10,14 +9,16 @@ class Riemann::Tools::Cassandra
10
9
  opt :cassandra_jmx_port, 'Cassandra JMX port', type: Integer, default: 7199
11
10
 
12
11
  def tick
13
- Riemann::Cassandra::METRIC_PARAMS.each do |mp|
14
- report service: "cassandra #{mp[:event][:service]}",
15
- host: options[:event_host],
16
- metric: cassandra.metric(mp[:attribute], mp[:jmx_path]),
17
- description: mp[:event][:description],
18
- time: Time.now.utc.to_i,
19
- tags: options[:tags],
20
- ttl: options[:ttl]
12
+ Riemann::Cassandra::METRICS.each do |package, metrics|
13
+ metrics.each do |metric|
14
+ report service: "cassandra #{metric[:name]}",
15
+ host: options[:event_host],
16
+ metric: cassandra.metric(package, metric[:jmx]),
17
+ description: metric[:description],
18
+ time: Time.now.utc.to_i,
19
+ tags: options[:tags],
20
+ ttl: options[:ttl]
21
+ end
21
22
  end
22
23
  end
23
24
 
@@ -1,6 +1,6 @@
1
1
  require 'riemann/cassandra/version'
2
2
  require 'riemann/cassandra/client'
3
- require 'riemann/cassandra/metric_params'
3
+ require 'riemann/cassandra/metrics'
4
4
 
5
5
  module Riemann
6
6
  module Cassandra
@@ -12,14 +12,22 @@ module Riemann
12
12
  @mbean_server_connection = JMXConnectorFactory.connect(@service_url, nil).getMBeanServerConnection
13
13
  end
14
14
 
15
- def metric(attribute, **path_params)
16
- @mbean_server_connection.get_attribute(ObjectName.new(jmx_path(path_params)), attribute)
15
+ def metric(package, jmx)
16
+ @mbean_server_connection.get_attribute(ObjectName.new(jmx_path(package, jmx_path_params(jmx))), jmx_attribute(jmx))
17
17
  end
18
18
 
19
19
  private
20
20
 
21
- def jmx_path(**path_params)
22
- 'org.apache.cassandra.metrics:' + path_params.map{ |k,v| "#{k}=#{v}" }.join(',')
21
+ def jmx_path(package, jmx_path_params)
22
+ "#{package}:" + jmx_path_params.map { |k,v| "#{k}=#{v}" }.join(',')
23
+ end
24
+
25
+ def jmx_path_params(jmx)
26
+ jmx.reject { |k,v| k == :attribute }
27
+ end
28
+
29
+ def jmx_attribute(jmx)
30
+ jmx[:attribute]
23
31
  end
24
32
  end
25
33
  end
@@ -0,0 +1,47 @@
1
+ module Riemann
2
+ module Cassandra
3
+
4
+ # https://www.datadoghq.com/blog/how-to-collect-cassandra-metrics/
5
+ METRICS = {
6
+ 'org.apache.cassandra.metrics' => [
7
+ { name: 'pending_tasks_counter_mutation_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'CounterMutationStage', name: 'PendingTasks', attribute: 'Value' }, description: '' },
8
+ { name: 'pending_tasks_mutation_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'MutationStage', name: 'PendingTasks', attribute: 'Value' }, description: '' },
9
+ { name: 'pending_tasks_read_repair_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'ReadRepairStage', name: 'PendingTasks', attribute: 'Value' }, description: '' },
10
+ { name: 'pending_tasks_read_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'ReadStage', name: 'PendingTasks', attribute: 'Value' }, description: '' },
11
+ { name: 'pending_tasks_request_response_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'RequestResponseStage', name: 'PendingTasks', attribute: 'Value' }, description: '' },
12
+ { name: 'blocked_tasks_counter_mutation_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'CounterMutationStage', name: 'CurrentlyBlockedTasks', attribute: 'Count' }, description: '' },
13
+ { name: 'blocked_tasks_mutation_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'MutationStage', name: 'CurrentlyBlockedTasks', attribute: 'Count' }, description: '' },
14
+ { name: 'blocked_tasks_read_repair_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'ReadRepairStage', name: 'CurrentlyBlockedTasks', attribute: 'Count' }, description: '' },
15
+ { name: 'blocked_tasks_read_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'ReadStage', name: 'CurrentlyBlockedTasks', attribute: 'Count' }, description: '' },
16
+ { name: 'blocked_tasks_request_response_stage', jmx: { type: 'ThreadPools', path: 'request', scope: 'RequestResponseStage', name: 'CurrentlyBlockedTasks', attribute: 'Count' }, description: '' },
17
+ { name: 'read_throughput', jmx: { type: 'ClientRequest', scope: 'Read', name: 'Latency', attribute: 'OneMinuteRate' }, description: '' },
18
+ { name: 'write_throughput', jmx: { type: 'ClientRequest', scope: 'Write', name: 'Latency', attribute: 'OneMinuteRate' }, description: '' },
19
+ { name: 'total_read_latency', jmx: { type: 'ClientRequest', scope: 'Read', name: 'TotalLatency', attribute: 'Count' }, description: '' },
20
+ { name: 'total_write_latency', jmx: { type: 'ClientRequest', scope: 'Write', name: 'TotalLatency', attribute: 'Count' }, description: '' },
21
+ { name: 'read_latency', jmx: { type: 'ClientRequest', scope: 'Read', name: 'Latency', attribute: 'Count' }, description: '' },
22
+ { name: 'write_latency', jmx: { type: 'ClientRequest', scope: 'Write', name: 'Latency', attribute: 'Count' }, description: '' },
23
+ { name: 'read_timeout_exceptions', jmx: { type: 'ClientRequest', scope: 'Read', name: 'Timeouts', attribute: 'Count' }, description: '' },
24
+ { name: 'write_timeout_exceptions', jmx: { type: 'ClientRequest', scope: 'Write', name: 'Timeouts', attribute: 'Count' }, description: '' },
25
+ { name: 'read_unavailable_exceptions', jmx: { type: 'ClientRequest', scope: 'Read', name: 'Unavailables', attribute: 'Count' }, description: '' },
26
+ { name: 'write_unavailable_exceptions', jmx: { type: 'ClientRequest', scope: 'Write', name: 'Unavailables', attribute: 'Count' }, description: '' },
27
+ { name: 'read_timeout_exceptions', jmx: { type: 'ClientRequest', scope: 'Read', name: 'Timeouts', attribute: 'Count' }, description: '' },
28
+ { name: 'write_timeout_exceptions', jmx: { type: 'ClientRequest', scope: 'Write', name: 'Timeouts', attribute: 'Count' }, description: '' },
29
+ { name: 'read_unavailable_exceptions', jmx: { type: 'ClientRequest', scope: 'Read', name: 'Unavailables', attribute: 'Count' }, description: '' },
30
+ { name: 'write_unavailable_exceptions', jmx: { type: 'ClientRequest', scope: 'Write', name: 'Unavailables', attribute: 'Count' }, description: '' },
31
+ { name: 'key_cache_hits', jmx: { type: 'Cache', scope: 'KeyCache', name: 'Hits', attribute: 'Count' }, description: '' },
32
+ { name: 'key_cache_requests', jmx: { type: 'Cache', scope: 'KeyCache', name: 'Requests', attribute: 'Count' }, description: '' },
33
+ { name: 'completed_compaction_tasks', jmx: { type: 'Compaction', name: 'CompletedTasks', attribute: 'Value' }, description: '' },
34
+ { name: 'pending_compaction_tasks', jmx: { type: 'Compaction', name: 'PendingTasks', attribute: 'Value' }, description: '' },
35
+ { name: 'exceptions', jmx: { type: 'Storage', name: 'Exceptions', attribute: 'Count' }, description: '' },
36
+ { name: 'load', jmx: { type: 'Storage', name: 'Load', attribute: 'Count' }, description: '' },
37
+ { name: 'total_disk_space_used', jmx: { type: 'ColumnFamily', name: 'TotalDiskSpaceUsed', attribute: 'Value' }, description: '' }
38
+ ],
39
+ 'java.lang' => [
40
+ { name: 'par_new_garbage_collections_count', jmx: { type: 'GarbageCollector', name: 'ParNew', attribute: 'CollectionCount' }, description: '' },
41
+ { name: 'par_new_garbage_collections_time', jmx: { type: 'GarbageCollector', name: 'ParNew', attribute: 'CollectionTime' }, description: '' },
42
+ { name: 'cms_garbage_collections_count', jmx: { type: 'GarbageCollector', name: 'ConcurrentMarkSweep', attribute: 'CollectionCount' }, description: '' },
43
+ { name: 'cms_garbage_collections_time', jmx: { type: 'GarbageCollector', name: 'ConcurrentMarkSweep', attribute: 'CollectionTime' }, description: '' }
44
+ ]
45
+ }
46
+ end
47
+ end
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  module Cassandra
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-cassandra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: java
6
6
  authors:
7
7
  - Deyan Dobrinov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -83,7 +83,7 @@ files:
83
83
  - bin/riemann-cassandra
84
84
  - lib/riemann/cassandra.rb
85
85
  - lib/riemann/cassandra/client.rb
86
- - lib/riemann/cassandra/metric_params.rb
86
+ - lib/riemann/cassandra/metrics.rb
87
87
  - lib/riemann/cassandra/version.rb
88
88
  - lib/riemann/tools.rb
89
89
  - riemann-cassandra.gemspec
@@ -1,161 +0,0 @@
1
- module Riemann
2
- module Cassandra
3
- # https://www.datadoghq.com/blog/how-to-collect-cassandra-metrics/
4
- METRIC_PARAMS = [
5
- {
6
- event: { service: 'read_throughput', description: '' },
7
- jmx_path: { type: 'ClientRequest', scope: 'Read', name: 'Latency' }, attribute: 'OneMinuteRate'
8
- },
9
-
10
- {
11
- event: { service: 'write_throughput', description: '' },
12
- jmx_path: { type: 'ClientRequest', scope: 'Write', name: 'Latency' }, attribute: 'OneMinuteRate'
13
- },
14
-
15
- {
16
- event: { service: 'total_read_latency', description: '' },
17
- jmx_path: { type: 'ClientRequest', scope: 'Read', name: 'TotalLatency' }, attribute: 'Count'
18
- },
19
-
20
- {
21
- event: { service: 'total_write_latency', description: '' },
22
- jmx_path: { type: 'ClientRequest', scope: 'Write', name: 'TotalLatency' }, attribute: 'Count'
23
- },
24
-
25
- {
26
- event: { service: 'read_latency', description: '' },
27
- jmx_path: { type: 'ClientRequest', scope: 'Read', name: 'Latency' }, attribute: 'Count'
28
- },
29
-
30
- {
31
- event: { service: 'write_latency', description: '' },
32
- jmx_path: { type: 'ClientRequest', scope: 'Write', name: 'Latency' }, attribute: 'Count'
33
- },
34
-
35
- {
36
- event: { service: 'key_cache_hits', description: '' },
37
- jmx_path: { type: 'Cache', scope: 'KeyCache', name: 'Hits' }, attribute: 'Count'
38
- },
39
-
40
- {
41
- event: { service: 'key_cache_requests', description: '' },
42
- jmx_path: { type: 'Cache', scope: 'KeyCache', name: 'Requests' }, attribute: 'Count'
43
- },
44
-
45
- {
46
- event: { service: 'read_timeout_exceptions', description: '' },
47
- jmx_path: { type: 'ClientRequest', scope: 'Read', name: 'Timeouts' }, attribute: 'Count'
48
- },
49
-
50
- {
51
- event: { service: 'write_timeout_exceptions', description: '' },
52
- jmx_path: { type: 'ClientRequest', scope: 'Write', name: 'Timeouts' }, attribute: 'Count'
53
- },
54
-
55
- {
56
- event: { service: 'read_unavailable_exceptions', description: '' },
57
- jmx_path: { type: 'ClientRequest', scope: 'Read', name: 'Unavailables' }, attribute: 'Count'
58
- },
59
-
60
- {
61
- event: { service: 'write_unavailable_exceptions', description: '' },
62
- jmx_path: { type: 'ClientRequest', scope: 'Write', name: 'Unavailables' }, attribute: 'Count'
63
- },
64
-
65
- {
66
- event: { service: 'total_disk_space_used', description: '' },
67
- jmx_path: { type: 'ColumnFamily', name: 'TotalDiskSpaceUsed' }, attribute: 'Value'
68
- },
69
-
70
- {
71
- event: { service: 'completed_compaction_tasks', description: '' },
72
- jmx_path: { type: 'Compaction', name: 'CompletedTasks' }, attribute: 'Value'
73
- },
74
-
75
- {
76
- event: { service: 'pending_compaction_tasks', description: '' },
77
- jmx_path: { type: 'Compaction', name: 'PendingTasks' }, attribute: 'Value'
78
- },
79
-
80
- {
81
- event: { service: 'exceptions', description: '' },
82
- jmx_path: { type: 'Storage', name: 'Exceptions' }, attribute: 'Count'
83
- },
84
-
85
- {
86
- event: { service: 'read_timeout_exceptions', description: '' },
87
- jmx_path: { type: 'ClientRequest', scope: 'Read', name: 'Timeouts' }, attribute: 'Count'
88
- },
89
-
90
- {
91
- event: { service: 'write_timeout_exceptions', description: '' },
92
- jmx_path: { type: 'ClientRequest', scope: 'Write', name: 'Timeouts' }, attribute: 'Count'
93
- },
94
-
95
- {
96
- event: { service: 'read_unavailable_exceptions', description: '' },
97
- jmx_path: { type: 'ClientRequest', scope: 'Read', name: 'Unavailables' }, attribute: 'Count'
98
- },
99
-
100
- {
101
- event: { service: 'write_unavailable_exceptions', description: '' },
102
- jmx_path: { type: 'ClientRequest', scope: 'Write', name: 'Unavailables' }, attribute: 'Count'
103
- },
104
-
105
- {
106
- event: { service: 'pending_tasks_counter_mutation_stage', description: '' },
107
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'CounterMutationStage', name: 'PendingTasks' }, attribute: 'Value'
108
- },
109
-
110
- {
111
- event: { service: 'pending_tasks_mutation_stage', description: '' },
112
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'MutationStage', name: 'PendingTasks' }, attribute: 'Value'
113
- },
114
-
115
- {
116
- event: { service: 'pending_tasks_read_repair_stage', description: '' },
117
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'ReadRepairStage', name: 'PendingTasks' }, attribute: 'Value'
118
- },
119
-
120
- {
121
- event: { service: 'pending_tasks_read_stage', description: '' },
122
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'ReadStage', name: 'PendingTasks' }, attribute: 'Value'
123
- },
124
-
125
- {
126
- event: { service: 'pending_tasks_request_response_stage', description: '' },
127
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'RequestResponseStage', name: 'PendingTasks' }, attribute: 'Value'
128
- },
129
-
130
- {
131
- event: { service: 'blocked_tasks_counter_mutation_stage', description: '' },
132
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'CounterMutationStage', name: 'CurrentlyBlockedTasks' }, attribute: 'Count'
133
- },
134
-
135
- {
136
- event: { service: 'blocked_tasks_mutation_stage', description: '' },
137
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'MutationStage', name: 'CurrentlyBlockedTasks' }, attribute: 'Count'
138
- },
139
-
140
- {
141
- event: { service: 'blocked_tasks_read_repair_stage', description: '' },
142
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'ReadRepairStage', name: 'CurrentlyBlockedTasks' }, attribute: 'Count'
143
- },
144
-
145
- {
146
- event: { service: 'blocked_tasks_read_stage', description: '' },
147
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'ReadStage', name: 'CurrentlyBlockedTasks' }, attribute: 'Count'
148
- },
149
-
150
- {
151
- event: { service: 'blocked_tasks_request_response_stage', description: '' },
152
- jmx_path: { type: 'ThreadPools', path: 'request', scope: 'RequestResponseStage', name: 'CurrentlyBlockedTasks' }, attribute: 'Count'
153
- },
154
-
155
- {
156
- event: { service: 'load', description: '' },
157
- jmx_path: { type: 'Storage', name: 'Load' }, attribute: 'Count'
158
- }
159
- ]
160
- end
161
- end