riemann-hbase 0.0.1

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.
Files changed (3) hide show
  1. data/LICENSE +21 -0
  2. data/bin/riemann-hbase +53 -0
  3. metadata +95 -0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 Mohit Chawla
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/bin/riemann-hbase ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'riemann-tools'
4
+ require 'jmx4r'
5
+
6
+ # Works under JRuby
7
+ # Riemann Client to gather Hbase stats from JMX - currently can talk to localhost, without auth
8
+
9
+ class Riemann::Tools::Hbase
10
+ include Riemann::Tools
11
+
12
+ opt :server_type, "Hbase Server Type", :default => "regionserver"
13
+ opt :jmx_port, "JMX Port to connect to", :default => "10101"
14
+
15
+ def alert(service, state, metric, description, tags)
16
+ report(
17
+ :service => service,
18
+ :state => state.to_s,
19
+ :metric => metric.to_f,
20
+ :description => description,
21
+ :tags => tags
22
+ )
23
+ end
24
+
25
+ def all_stats
26
+
27
+ if opts[:server_type] == "master"
28
+ bean_object_name = "hadoop:service=Master,name=MasterStatistics"
29
+ else
30
+ bean_object_name = "hadoop:service=RegionServer,name=RegionServerStatistics"
31
+ end
32
+
33
+ begin
34
+ JMX::MBean.establish_connection :host => "localhost", :port => "#{opts[:jmx_port]}"
35
+ rescue Exception => e
36
+ alert "hbase-#{opts[:server_type]}", :critical, "", "Could not connect to JMX, #{e.message}", ""
37
+ return
38
+ end
39
+
40
+ stats = JMX::MBean.find_by_name "#{bean_object_name}"
41
+ stats.attributes.keys.each { |attr|
42
+ alert "#{attr}", :ok, "#{stats.send attr}", "#{attr}", "hbase-#{opts[:server_type]}"
43
+ }
44
+
45
+ end
46
+
47
+ def tick
48
+ all_stats
49
+ end
50
+
51
+ end
52
+
53
+ Riemann::Tools::Hbase.run
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riemann-hbase
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Mohit Chawla
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-08-10 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: jmx4r
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: riemann-tools
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description:
49
+ email: mohit.chawla.binary@gmail.com
50
+ executables:
51
+ - riemann-hbase
52
+ extensions: []
53
+
54
+ extra_rdoc_files: []
55
+
56
+ files:
57
+ - bin/riemann-hbase
58
+ - LICENSE
59
+ homepage: https://github.com/alcy/riemann-hbase
60
+ licenses: []
61
+
62
+ post_install_message:
63
+ rdoc_options: []
64
+
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 57
73
+ segments:
74
+ - 1
75
+ - 8
76
+ - 7
77
+ version: 1.8.7
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project: riemann-hbase
90
+ rubygems_version: 1.8.15
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: Utility to submit hbase metrics to Riemann
94
+ test_files: []
95
+