simple-graphite 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Ian Meyer
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,32 @@
1
+ = simple-graphite
2
+
3
+ A simple interface into [Graphite](http://graphite.wikidot.com "Graphite").
4
+
5
+ = How-to
6
+
7
+ %w{rubygems simple-graphite}.each { |l| require l }
8
+ g = Graphite.new({:host => "your.graphite.host", :port => 2003})
9
+ or
10
+ g = Graphite.new
11
+ g.host = 'your.graphite.host'
12
+ g.port = 2003
13
+
14
+ To push data to Graphite:
15
+ g.push_to_graphite do |socket|
16
+ socket.puts "your.metric.name 3.1415926 #{g.time}"
17
+ end
18
+
19
+ == Note on Patches/Pull Requests
20
+
21
+ * Fork the project.
22
+ * Make your feature addition or bug fix.
23
+ * Add tests for it. This is important so I don't break it in a
24
+ future version unintentionally.
25
+ * Commit, do not mess with rakefile, version, or history.
26
+ (if you want to have your own version, that is fine but
27
+ bump version in a commit by itself I can ignore when I pull)
28
+ * Send me a pull request. Bonus points for topic branches.
29
+
30
+ == Copyright
31
+
32
+ Copyright (c) 2010 Ian Meyer. See LICENSE for details.
@@ -0,0 +1,20 @@
1
+ require 'socket'
2
+
3
+ class Graphite
4
+ attr_accessor :host, :port, :time
5
+ def initialize(options = {})
6
+ @host = options[:host]
7
+ @port = options[:port]
8
+ @time = Time.now.to_i
9
+ end
10
+
11
+ def push_to_graphite
12
+ socket = TCPSocket.new(@host, @port)
13
+ yield socket
14
+ socket.close
15
+ end
16
+
17
+ def hostname
18
+ Socket.gethostname
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class EtsyGraphiteTest < 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
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'simple-graphite'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple-graphite
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Ian Meyer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-19 00:00:00 +00:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Exposes methods to send data to graphite
23
+ email: ianmmeyer@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - LICENSE
30
+ - README.rdoc
31
+ files:
32
+ - lib/simple-graphite.rb
33
+ - test/simple-graphite_test.rb
34
+ - test/test_helper.rb
35
+ - LICENSE
36
+ - README.rdoc
37
+ has_rdoc: true
38
+ homepage: http://github.com/ianmmeyer/simple-graphite
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --charset=UTF-8
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ hash: 3
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.3.7
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Simple hook into graphite
71
+ test_files:
72
+ - test/test_helper.rb
73
+ - test/simple-graphite_test.rb