riemann-cassandra 0.1.8-java → 0.1.9-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 690a3ada907ac2d2d4629783f97275df82e403ca
4
- data.tar.gz: 96367386f953967076e909a007c407acc691ae6e
3
+ metadata.gz: 05764ad509f0b90bd1c927ff6af31583c7b44c8c
4
+ data.tar.gz: a2a91f29381515f9deb3105f17ae6bd4f0c891fb
5
5
  SHA512:
6
- metadata.gz: 59bc711781b05741a296f0f6eb442486523ebb0100bd0dce677aaf81cb65c8dac571f71ee43468a84e302bd7b3880c5064bb5e25ba19c1296a0bc182b7cef389
7
- data.tar.gz: 820d124c92b79f74b63de4b35bcb5fe493f80c269e7f7fb2d702d368434cebe391e0c2ee7c616544d7569cb520e1349443e1ab263c7e623de022aaa0b2228e46
6
+ metadata.gz: 6186b267d65a43656d470a3f17aefc7b0fe3e9936abae2c7b207385eb2e809ecc29cbbfc6bba28fd7b464f0a5ed83b43de901ce39f08aff64953ee5dbf915b49
7
+ data.tar.gz: b9b0d2edb23ae0691ae6e0acc1d688231ebb466c61b059a126babef52003a3e78882d96b33d23a272fd80ced4e76575a598af6590780dabacbc9c223ea8cb470
@@ -11,13 +11,17 @@ class Riemann::Tools::Cassandra
11
11
  def tick
12
12
  Riemann::Cassandra::METRICS.each do |package, metrics|
13
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]
14
+ measurement = cassandra.measurement(package, metric[:jmx])
15
+
16
+ if measurement
17
+ report service: "cassandra #{metric[:name]}",
18
+ host: options[:event_host],
19
+ metric: measurement,
20
+ description: metric[:description],
21
+ time: Time.now.utc.to_i,
22
+ tags: options[:tags],
23
+ ttl: options[:ttl]
24
+ end
21
25
  end
22
26
  end
23
27
  end
@@ -12,8 +12,18 @@ module Riemann
12
12
  @mbean_server_connection = JMXConnectorFactory.connect(@service_url, nil).getMBeanServerConnection
13
13
  end
14
14
 
15
- def metric(package, jmx)
16
- @mbean_server_connection.get_attribute(ObjectName.new(jmx_path(package, jmx_path_params(jmx))), jmx_attribute(jmx))
15
+ def measurement(package, jmx)
16
+ object_name = ObjectName.new(jmx_path(package, jmx_path_params(jmx)))
17
+ attribute = jmx_attribute(jmx)
18
+
19
+ begin
20
+ @mbean_server_connection.get_attribute(object_name, attribute)
21
+ rescue Java::JavaxManagement::InstanceNotFoundException,
22
+ Java::JavaxManagement::AttributeNotFoundException
23
+
24
+ puts "Ignoring... #{object_name.canonical_name} #{attribute} because it cannot be found."
25
+ nil
26
+ end
17
27
  end
18
28
 
19
29
  private
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  module Cassandra
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  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.8
4
+ version: 0.1.9
5
5
  platform: java
6
6
  authors:
7
7
  - Deyan Dobrinov