notify-graphite 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDQ2MzNhZGY4N2E4MDQ4YWUwMGViYTQ1Y2M2ZmVlNzdjMzBkYWVlMw==
5
+ data.tar.gz: !binary |-
6
+ ZTYyNjYxZDIwODdhY2U0NzQzZTJiNjFlMTNmMjU0MmUyOTczZjI1Ng==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZDAyNTA3NTgwZTc2ODExMzllNDc0MjlhMDNhNzVmYWU1NGI5YmUyMjRkZThl
10
+ M2NmY2JlNGJjZjIyNzk4YmMxODI3NWE3MTJhYzM5M2IzMzAxYjk0YzljZDJh
11
+ NGZiMGYzMjVhMmUzOGQ5ZDVjYjA3MTQ2MTY1Y2QwZWZiZjJkZDE=
12
+ data.tar.gz: !binary |-
13
+ YmM2YzY0MzBjZjZmOGM3MjI5YzIwZTIzNmYwMDU2YmZmMDZiZGE5YTM3NDk2
14
+ NTNhZDkyMmMxZWRkZmVlMmE5YjUxYTEwMGVkMmM2YjYyZWFiM2JkZGQ2Nzkz
15
+ YjFmMzc2NWE1ZThmYjRiMzFkNmViZWRlYWMyM2ZjNmNjZjA2MDA=
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'notify-graphite'
5
+
6
+ options = {}
7
+ OptionParser.new do |opts|
8
+ opts.banner = "Usage: #{__FILE__} [-h] -c <carbon> [-p <portnumber>] [-b <basename>] <eventname>"
9
+
10
+ opts.on("-c", "--carbon Carbon host", :REQUIRED, "Hostname or address of your carbon host") do |h|
11
+ options[:hostname] = h
12
+ end
13
+
14
+ opts.on("-p", "--port Carbon Port", :OPTIONAL, "Carbon port. Default: 2003") do |p|
15
+ options[:port] = p.to_i || 2003
16
+ end
17
+
18
+ opts.on("-b", "--basename Basename for events", :OPTIONAL, "Basename for events Default: com.mycompany") do |p|
19
+ options[:port] = p.to_i || 2003
20
+ end
21
+
22
+ opts.on("-h", "--help", "Show this help information") do
23
+ puts opts
24
+ exit 1
25
+ end
26
+ end.parse!
27
+
28
+ unless options[:hostname]
29
+ ::STDERR.puts("ERROR: please specify a carbon host")
30
+ abort
31
+ end
32
+
33
+ notify = Notify::Graphite.new(options[:hostname], options[:port], 'com.mycompany')
34
+
35
+ if ARGV.length > 0
36
+ notify.send_event(ARGV.join('.'))
37
+ else
38
+ ::STDERR.puts("ERROR: no eventname given")
39
+ abort
40
+ end
@@ -0,0 +1,19 @@
1
+ require 'bundler/setup'
2
+ require 'graphite_client'
3
+
4
+ module Notify; end
5
+
6
+ class Notify::Graphite < BasicObject
7
+ VERSION = "0.0.1"
8
+
9
+ def initialize(host, port=2003, basename=nil)
10
+ @basename = ["events", basename].compact.join('.')
11
+ @client = ::GraphiteClient.new(host+":"+port.to_s)
12
+ end
13
+
14
+ def send_event(event_name)
15
+ @client.report(@basename+"."+event_name, 1)
16
+ #TODO: we should also send a "normal" graphite event to the json api.
17
+ end
18
+
19
+ end
@@ -0,0 +1 @@
1
+ require 'notify/graphite'
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: notify-graphite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jan Ulferts
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: graphite_client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.4'
27
+ description: Push event notifications to Graphite
28
+ email:
29
+ - janu@cpan.org
30
+ executables:
31
+ - notify_graphite
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - bin/notify_graphite
36
+ - lib/notify/graphite.rb
37
+ - lib/notify-graphite.rb
38
+ homepage: https://github.com/fatz/notify-graphite
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ! '>'
49
+ - !ruby/object:Gem::Version
50
+ version: '1.9'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.0.3
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Push event notifications to Graphite
62
+ test_files: []
63
+ has_rdoc: