garru-ruby_scribe_client 0.0.6 → 0.0.6.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.
data/CHANGELOG CHANGED
@@ -1,4 +1,4 @@
1
- v0.0.6 fb303: added host option. moved client to module namespace
1
+ v0.0.6.1 fb303: added host option. moved client to module namespace
2
2
  v0.0.5 wrote fb303 client for scribe mgmt
3
3
  v0.0.4 removing flush because framed transport doesn't need it
4
4
  v0.0.3 flush instead of open/close each time
data/Manifest CHANGED
@@ -15,6 +15,7 @@ LICENSE
15
15
  Manifest
16
16
  Rakefile
17
17
  README
18
+ ruby_scribe_client.gemspec
18
19
  vendor/thrift/client.rb
19
20
  vendor/thrift/deprecation.rb
20
21
  vendor/thrift/exceptions.rb
data/etc/scribe_munin.rb CHANGED
@@ -10,7 +10,7 @@ class ScribeStats
10
10
  CATEGORY = 'scribe'
11
11
 
12
12
  def initialize(host, port)
13
- @scribe = FB303.new(host, port)
13
+ @scribe = FB303::Client.new(host, port)
14
14
  @category = 'scribe'
15
15
  end
16
16
 
data/etc/scribe_net CHANGED
@@ -1 +1,85 @@
1
- scribe_munin.rb
1
+ #! /usr/bin/env ruby
2
+ # Munin plugin for starling.
3
+ HOST = ENV['HOST'] || '127.0.0.1';
4
+ PORT = ENV['PORT'] || 1463;
5
+ require 'rubygems'
6
+ require 'ruby_scribe_client'
7
+
8
+ #Monkey patched so the namespaced queues are included in stats
9
+ class ScribeStats
10
+ CATEGORY = 'scribe'
11
+
12
+ def initialize(host, port)
13
+ @scribe = FB303::Client.new(host, port)
14
+ @category = 'scribe'
15
+ end
16
+
17
+
18
+ def net_stats
19
+ stats = {
20
+ :label => 'read',
21
+ :type => 'COUNTER',
22
+ :graph => 'no',
23
+ :cdef => '8,*'
24
+ }
25
+ return stats
26
+ end
27
+
28
+ def net_munin_config
29
+ graph_config = <<-END.gsub(/ +/, '')
30
+ graph_title Scribe Traffic
31
+ graph_args --base 1000
32
+ graph_vlabel bits read(-) / written(+) per second
33
+ graph_category #{CATEGORY}
34
+ graph_order bytes_read bytes_written
35
+ END
36
+
37
+ stat_config = ''
38
+ counters.keys do |stat|
39
+ stat.gsub!(/\s/){'_'}
40
+ stats.each do |var,value|
41
+ value = "#{stat}," + value if var == :cdef
42
+ stat_config << "#{stat}.#{var} #{value}\n"
43
+ end
44
+ end
45
+
46
+ return graph_config + stat_config
47
+ end
48
+
49
+ def net_munin
50
+ ret = ""
51
+ @scribe.getCounters.each do |k, v|
52
+ ret << "#{k.gsub(/\s/){'_'}}.value #{v}\n"
53
+ end
54
+ end
55
+
56
+ private
57
+
58
+ def munin_name(str)
59
+ str.tr(":", '_')
60
+ end
61
+
62
+
63
+
64
+ def counters
65
+ @scribe.getCounters
66
+ end
67
+
68
+ end
69
+
70
+ # We pick the chart based on the command we were called as.
71
+ if $0 =~ /scribe_(\w+)/ then
72
+ chart_name = $1
73
+ else
74
+ $stderr.puts "can't find chart name"
75
+ end
76
+
77
+ starling = ScribeStats.new(HOST, PORT)
78
+
79
+ command = "#{chart_name}_munin"
80
+
81
+ if ARGV[0] == 'config' then
82
+ command << '_config'
83
+ end
84
+
85
+ print starling.send(command)
@@ -7,7 +7,7 @@
7
7
  require File.join([File.dirname(__FILE__), '..', '..', 'vendor','thrift'])
8
8
  require File.join([File.dirname(__FILE__) ,'FacebookService'])
9
9
  require File.join([File.dirname(__FILE__), 'scribe_types'])
10
- require File.join([File.dirname(__FILE__), 'ruby_scribe_client', 'fb303_client'])
10
+ require File.join([File.dirname(__FILE__), 'fb303_client'])
11
11
 
12
12
  module Scribe
13
13
  class Client < FacebookService::Client
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ruby_scribe_client}
5
- s.version = "0.0.6"
5
+ s.version = "0.0.6.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Gary Tsang"]
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{Ruby Scribe Client. Package and Wrapper for generated ruby interfaces}
11
11
  s.email = %q{}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/ruby_scribe_client/FacebookService.rb", "lib/ruby_scribe_client/fb303_client.rb", "lib/ruby_scribe_client/fb303_types.rb", "lib/ruby_scribe_client/reflection_limited_types.rb", "lib/ruby_scribe_client/scribe.rb", "lib/ruby_scribe_client/scribe_mgmt.rb", "lib/ruby_scribe_client/scribe_types.rb", "lib/ruby_scribe_client.rb", "LICENSE", "README"]
13
- s.files = ["CHANGELOG", "etc/scribe_cat.rb", "etc/scribe_munin.rb", "etc/scribe_net", "etc/test.rb", "lib/ruby_scribe_client/FacebookService.rb", "lib/ruby_scribe_client/fb303_client.rb", "lib/ruby_scribe_client/fb303_types.rb", "lib/ruby_scribe_client/reflection_limited_types.rb", "lib/ruby_scribe_client/scribe.rb", "lib/ruby_scribe_client/scribe_mgmt.rb", "lib/ruby_scribe_client/scribe_types.rb", "lib/ruby_scribe_client.rb", "LICENSE", "Manifest", "Rakefile", "README", "vendor/thrift/client.rb", "vendor/thrift/deprecation.rb", "vendor/thrift/exceptions.rb", "vendor/thrift/processor.rb", "vendor/thrift/protocol/binaryprotocol.rb", "vendor/thrift/protocol/binaryprotocolaccelerated.rb", "vendor/thrift/protocol/tbinaryprotocol.rb", "vendor/thrift/protocol/tprotocol.rb", "vendor/thrift/protocol.rb", "vendor/thrift/serializer.rb", "vendor/thrift/server/httpserver.rb", "vendor/thrift/server/nonblockingserver.rb", "vendor/thrift/server/thttpserver.rb", "vendor/thrift/server/tserver.rb", "vendor/thrift/server.rb", "vendor/thrift/struct.rb", "vendor/thrift/thrift.rb", "vendor/thrift/transport/httpclient.rb", "vendor/thrift/transport/socket.rb", "vendor/thrift/transport/thttpclient.rb", "vendor/thrift/transport/tsocket.rb", "vendor/thrift/transport/ttransport.rb", "vendor/thrift/transport/unixsocket.rb", "vendor/thrift/transport.rb", "vendor/thrift/types.rb", "vendor/thrift.rb", "ruby_scribe_client.gemspec"]
13
+ s.files = ["CHANGELOG", "etc/scribe_cat.rb", "etc/scribe_munin.rb", "etc/scribe_net", "etc/test.rb", "lib/ruby_scribe_client/FacebookService.rb", "lib/ruby_scribe_client/fb303_client.rb", "lib/ruby_scribe_client/fb303_types.rb", "lib/ruby_scribe_client/reflection_limited_types.rb", "lib/ruby_scribe_client/scribe.rb", "lib/ruby_scribe_client/scribe_mgmt.rb", "lib/ruby_scribe_client/scribe_types.rb", "lib/ruby_scribe_client.rb", "LICENSE", "Manifest", "Rakefile", "README", "ruby_scribe_client.gemspec", "vendor/thrift/client.rb", "vendor/thrift/deprecation.rb", "vendor/thrift/exceptions.rb", "vendor/thrift/processor.rb", "vendor/thrift/protocol/binaryprotocol.rb", "vendor/thrift/protocol/binaryprotocolaccelerated.rb", "vendor/thrift/protocol/tbinaryprotocol.rb", "vendor/thrift/protocol/tprotocol.rb", "vendor/thrift/protocol.rb", "vendor/thrift/serializer.rb", "vendor/thrift/server/httpserver.rb", "vendor/thrift/server/nonblockingserver.rb", "vendor/thrift/server/thttpserver.rb", "vendor/thrift/server/tserver.rb", "vendor/thrift/server.rb", "vendor/thrift/struct.rb", "vendor/thrift/thrift.rb", "vendor/thrift/transport/httpclient.rb", "vendor/thrift/transport/socket.rb", "vendor/thrift/transport/thttpclient.rb", "vendor/thrift/transport/tsocket.rb", "vendor/thrift/transport/ttransport.rb", "vendor/thrift/transport/unixsocket.rb", "vendor/thrift/transport.rb", "vendor/thrift/types.rb", "vendor/thrift.rb"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://github.com/garru/ruby_scribe_client}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ruby_scribe_client", "--main", "README"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garru-ruby_scribe_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gary Tsang
@@ -49,6 +49,7 @@ files:
49
49
  - Manifest
50
50
  - Rakefile
51
51
  - README
52
+ - ruby_scribe_client.gemspec
52
53
  - vendor/thrift/client.rb
53
54
  - vendor/thrift/deprecation.rb
54
55
  - vendor/thrift/exceptions.rb
@@ -75,7 +76,6 @@ files:
75
76
  - vendor/thrift/transport.rb
76
77
  - vendor/thrift/types.rb
77
78
  - vendor/thrift.rb
78
- - ruby_scribe_client.gemspec
79
79
  has_rdoc: true
80
80
  homepage: http://github.com/garru/ruby_scribe_client
81
81
  post_install_message: