librato-metrics-taps 0.3.6

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.
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cgi'
4
+ require 'optparse'
5
+
6
+ require 'rubygems'
7
+ require 'rest-client'
8
+
9
+ SOURCES=['em01b-r2', 'em01b-r4']
10
+
11
+ $options = {
12
+ :uri => 'metrics-stg.heroku.com/v1/metrics.json',
13
+ :user => nil,
14
+ :pass => nil,
15
+ :path => nil
16
+ }
17
+
18
+ optparse = OptionParser.new do|opts|
19
+ opts.banner = "Usage: report-em01b [options]\n"
20
+
21
+ # help
22
+ opts.on( '-h', '--help', 'Display this screen' ) do
23
+ puts opts
24
+ exit
25
+ end
26
+
27
+ # API
28
+ opts.on('--uri <API URI>', 'Set API address') do |uri|
29
+ $options[:uri] = uri
30
+ end
31
+
32
+ # email
33
+ opts.on('--email <EMAIL>', 'Set email') do |email|
34
+ $options[:user] = CGI.escape(email)
35
+ end
36
+
37
+ # token
38
+ opts.on('--token <TOKEN>', 'Set token') do |token|
39
+ $options[:pass] = token
40
+ end
41
+
42
+ # path to check utility
43
+ opts.on('--path <PATH>', 'Path to check utility') do |path|
44
+ $options[:path] = path
45
+ end
46
+ end
47
+
48
+ optparse.parse!(ARGV)
49
+
50
+ unless $options[:user] && $options[:pass]
51
+ puts "Must specify --email and --token"
52
+ exit 1
53
+ end
54
+
55
+ unless $options[:path] && File.exist?($options[:path])
56
+ puts "Can't find executable at: #{$options[:path]}"
57
+ exit 1
58
+ end
59
+
60
+ gauges = {}
61
+ SOURCES.each_with_index do |src, i|
62
+
63
+ str = %x{#{$options[:path]} #{src} 2>&1}.chomp
64
+ unless $?.exited? && $?.exitstatus == 0
65
+ puts "Failed to execute: #{$options[:path]}"
66
+ exit 1
67
+ end
68
+
69
+ m = str.match(/.*TF: ([\.0-9]+)HU:[ ]{0,}([\.0-9]+)%IL:[ ]{0,}([\.0-9]+)[ ]{0,}/)
70
+
71
+ gauges["#{i}_0"] = {
72
+ :name => 'sfdc::temperature',
73
+ :source => src,
74
+ :value => Float(m[1])
75
+ }
76
+
77
+ gauges["#{i}_1"] = {
78
+ :name => 'sfdc::humidity',
79
+ :source => src,
80
+ :value => Float(m[2])
81
+ }
82
+
83
+ gauges["#{i}_2"] = {
84
+ :name => 'sfdc::illumination',
85
+ :source => src,
86
+ :value => Float(m[3])
87
+ }
88
+ end
89
+
90
+ RestClient.post "https://#{$options[:user]}:#{$options[:pass]}@#{$options[:uri]}", :gauges => gauges
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'librato-metrics-taps'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestLibratoMetricsTaps < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,199 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: librato-metrics-taps
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.6
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Librato, Inc.
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jmx4r
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.1.4
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.4
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ name: librato-metrics
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ~>
35
+ - !ruby/object:Gem::Version
36
+ version: 1.0.4
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ version: 1.0.4
43
+ none: false
44
+ prerelease: false
45
+ type: :runtime
46
+ - !ruby/object:Gem::Dependency
47
+ name: trollop
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '='
51
+ - !ruby/object:Gem::Version
52
+ version: 1.16.2
53
+ none: false
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '='
57
+ - !ruby/object:Gem::Version
58
+ version: 1.16.2
59
+ none: false
60
+ prerelease: false
61
+ type: :runtime
62
+ - !ruby/object:Gem::Dependency
63
+ name: jruby-openssl
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.5
69
+ none: false
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '='
73
+ - !ruby/object:Gem::Version
74
+ version: 0.8.5
75
+ none: false
76
+ prerelease: false
77
+ type: :runtime
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: !binary |-
85
+ MA==
86
+ none: false
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: !binary |-
92
+ MA==
93
+ none: false
94
+ prerelease: false
95
+ type: :development
96
+ - !ruby/object:Gem::Dependency
97
+ name: shoulda
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: !binary |-
103
+ MA==
104
+ none: false
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: !binary |-
110
+ MA==
111
+ none: false
112
+ prerelease: false
113
+ type: :development
114
+ - !ruby/object:Gem::Dependency
115
+ name: rdoc
116
+ version_requirements: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: '3.12'
121
+ none: false
122
+ requirement: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ version: '3.12'
127
+ none: false
128
+ prerelease: false
129
+ type: :development
130
+ description: Taps for extracting metrics data and publishing to Librato Metrics
131
+ email: mike@librato.com
132
+ executables:
133
+ - librato-metrics-tap-jmxbeans
134
+ extensions: []
135
+ extra_rdoc_files: []
136
+ files:
137
+ - .document
138
+ - .gitignore
139
+ - Gemfile
140
+ - Gemfile.lock
141
+ - LICENSE.txt
142
+ - README.md
143
+ - Rakefile
144
+ - VERSION
145
+ - bin/librato-metrics-tap-jmxbeans
146
+ - examples/cassandra/cfstats-0_7_6-2.yaml
147
+ - examples/cassandra/cfstats-0_8_1.yaml
148
+ - examples/cassandra/cfstats-0_8_8.yaml
149
+ - examples/cassandra/cfstats-1_1_6.yaml
150
+ - examples/cassandra/tpstats-0_7_6-2.yaml
151
+ - examples/cassandra/tpstats-0_8_1.yaml
152
+ - examples/cassandra/tpstats-0_8_8.yaml
153
+ - examples/cassandra/tpstats-1_1_6.yaml
154
+ - examples/java-lang.yaml
155
+ - lib/librato-metrics-taps.rb
156
+ - lib/librato/metrics/taps.rb
157
+ - lib/librato/metrics/taps/jmx.rb
158
+ - lib/librato/metrics/taps/publisher.rb
159
+ - librato-metrics-taps.gemspec
160
+ - temp_sensors/check_em01.c
161
+ - temp_sensors/report-em01b.rb
162
+ - test/helper.rb
163
+ - test/test_librato-metrics-taps.rb
164
+ homepage: http://github.com/librato/librato-metrics-taps
165
+ licenses:
166
+ - MIT
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ segments:
176
+ - 0
177
+ version: !binary |-
178
+ MA==
179
+ hash: 2
180
+ none: false
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ! '>='
184
+ - !ruby/object:Gem::Version
185
+ segments:
186
+ - 0
187
+ version: !binary |-
188
+ MA==
189
+ hash: 2
190
+ none: false
191
+ requirements: []
192
+ rubyforge_project:
193
+ rubygems_version: 1.8.24
194
+ signing_key:
195
+ specification_version: 3
196
+ summary: Librato Metrics Taps
197
+ test_files:
198
+ - test/helper.rb
199
+ - test/test_librato-metrics-taps.rb