riemann-cassandra 0.1.1-java → 0.1.2-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: 1e60f91ac2ff3d3870b0e1588c73ad8ecf827ba5
4
- data.tar.gz: 6841b5abf41188c92bd3b7d55941fce3ebc39064
3
+ metadata.gz: 4077068474a36acb3451a61c8c27d2340fc08766
4
+ data.tar.gz: 5b41b75ca8f5426fbb4e72276b707a8ed803fd62
5
5
  SHA512:
6
- metadata.gz: a80cec281558534d6a54b193ce03cef0a57f88d90ac0a434fce60ca0ffe966cd67666cbd875e0f43d37bf9e444e0a0cc35792229f347d190515b35c73f5debe4
7
- data.tar.gz: 4d1137d256bf1f184e47aa32cd2c0f0592ed442fb82dce24520eddfa931c69434de8f028ac5c5727b8bc5ed32497b9f5f1903cfc165ecfa20ee9e4b9afff0121
6
+ metadata.gz: 305df12e49c2c3a3538947440787374cd0de8774b17bf99e402469804f8e5bf94df83fb906b3aefce4986861c7c13659f94582fcb1f04a7df92a57f79168eb6d
7
+ data.tar.gz: fe4c8f451dafb91013981ee818f9da4f68ef3f0a935deb9879f25563f6d1df5b3950fdf6c979a7580e556b6c8c193a2529174a18329abe67224520193a38025c
data/README.md CHANGED
@@ -5,17 +5,17 @@ Gem for sending Cassandra metrics to Riemann. To use it you will need a JMX enab
5
5
  * Throughput (writes|reads)
6
6
  * Latency (writes|reads)
7
7
  * Key cache hit rate
8
+ * Exceptions
8
9
  * Timeout exceptions (writes|reads)
9
10
  * Unavailable exceptions (writes|reads)
11
+ * Total disk space used
12
+ * Completed compaction tasks
13
+ * Pending compaction tasks
14
+ * Pending tasks (per stage)
15
+ * Currently blocked tasks
10
16
  * (TODO) Load
11
- * (TODO) Total disk space used
12
- * (TODO) Completed compaction tasks
13
- * (TODO) Pending compaction tasks
14
17
  * (TODO) ParNew garbage collections (count|time)
15
18
  * (TODO) CMS garbage collections (count|time)
16
- * (TODO) Exceptions
17
- * (TODO) Pending tasks (per stage)
18
- * (TODO) Currently blocked tasks
19
19
 
20
20
  More:
21
21
  * https://www.datadoghq.com/blog/how-to-monitor-cassandra-performance-metrics/
@@ -40,10 +40,10 @@ loop do
40
40
  # Send metric events
41
41
  Riemann::Cassandra::METRIC_PARAMS.each do |mp|
42
42
  metric_event = {
43
- service: "cassandra #{mp[:service]}",
43
+ service: "cassandra #{mp[:event][:service]}",
44
44
  host: opts[:event_host],
45
- metric: cassandra.metric(mp[:type], mp[:scope], mp[:name], mp[:attribute]),
46
- description: mp[:description],
45
+ metric: cassandra.metric(mp[:attribute], mp[:jmx_path]),
46
+ description: mp[:event][:description],
47
47
  time: Time.now.utc.to_i,
48
48
  tags: opts[:tags],
49
49
  ttl: opts[:ttl]
@@ -7,16 +7,19 @@ import javax.management.remote.JMXServiceURL
7
7
  module Riemann
8
8
  module Cassandra
9
9
  class Client
10
- attr_reader :mbean_server_connection
11
-
12
10
  def initialize(hostname, port)
13
11
  @service_url = JMXServiceURL.new("service:jmx:rmi:///jndi/rmi://#{hostname}:#{port}/jmxrmi")
14
12
  @mbean_server_connection = JMXConnectorFactory.connect(@service_url, nil).getMBeanServerConnection
15
13
  end
16
14
 
17
- def metric(type, scope, name, attribute)
18
- jmx_path = "org.apache.cassandra.metrics:type=#{type},scope=#{scope},name=#{name}"
19
- mbean_server_connection.get_attribute(ObjectName.new(jmx_path), attribute)
15
+ def metric(attribute, **path_params)
16
+ @mbean_server_connection.get_attribute(ObjectName.new(jmx_path(path_params)), attribute)
17
+ end
18
+
19
+ private
20
+
21
+ def jmx_path(**path_params)
22
+ 'org.apache.cassandra.metrics:' + path_params.map{ |k,v| "#{k}=#{v}" }.join(',')
20
23
  end
21
24
  end
22
25
  end
@@ -2,18 +2,155 @@ module Riemann
2
2
  module Cassandra
3
3
  # https://www.datadoghq.com/blog/how-to-collect-cassandra-metrics/
4
4
  METRIC_PARAMS = [
5
- { service: 'read_throughput', type: 'ClientRequest', scope: 'Read', name: 'Latency', attribute: 'OneMinuteRate', description: '' },
6
- { service: 'write_throughput', type: 'ClientRequest', scope: 'Write', name: 'Latency', attribute: 'OneMinuteRate', description: '' },
7
- { service: 'total_read_latency', type: 'ClientRequest', scope: 'Read', name: 'TotalLatency', attribute: 'Count', description: '' },
8
- { service: 'total_write_latency', type: 'ClientRequest', scope: 'Write', name: 'TotalLatency', attribute: 'Count', description: '' },
9
- { service: 'read_latency', type: 'ClientRequest', scope: 'Read', name: 'Latency', attribute: 'Count', description: '' },
10
- { service: 'write_latency', type: 'ClientRequest', scope: 'Write', name: 'Latency', attribute: 'Count', description: '' },
11
- { service: 'key_cache_hits', type: 'Cache', scope: 'KeyCache', name: 'Hits', attribute: 'Count', description: '' },
12
- { service: 'key_cache_requests', type: 'Cache', scope: 'KeyCache', name: 'Requests', attribute: 'Count', description: '' },
13
- { service: 'read_timeout_exceptions', type: 'ClientRequest', scope: 'Read', name: 'Timeouts', attribute: 'Count', description: '' },
14
- { service: 'write_timeout_exceptions', type: 'ClientRequest', scope: 'Write', name: 'Timeouts', attribute: 'Count', description: '' },
15
- { service: 'read_unavailable_exceptions', type: 'ClientRequest', scope: 'Read', name: 'Unavailables', attribute: 'Count', description: '' },
16
- { service: 'write_unavailable_exceptions', type: 'ClientRequest', scope: 'Write', name: 'Unavailables', attribute: 'Count', description: '' }
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
+ }
17
154
  ]
18
155
  end
19
156
  end
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  module Cassandra
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -19,12 +19,12 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = ["riemann-cassandra"]
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.10"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
-
25
22
  spec.required_ruby_version = '>= 2.2.2'
26
23
  spec.platform = 'java'
27
24
 
25
+ spec.add_development_dependency "bundler", "~> 1.10"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+
28
28
  spec.add_runtime_dependency 'riemann-client', '~> 0.2.6'
29
29
  spec.add_runtime_dependency 'trollop', '~> 2.1.2'
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-cassandra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: java
6
6
  authors:
7
7
  - Deyan Dobrinov