entombedvirus-munin_manager 0.0.3 → 0.0.4

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/Manifest CHANGED
@@ -1,17 +1,18 @@
1
- README.markdown
2
1
  bin/munin_manager
3
2
  bin/runner
4
- lib/munin_manager.rb
3
+ ext/string.rb
4
+ lib/munin_manager/acts_as_munin_plugin.rb
5
5
  lib/munin_manager/log_reader.rb
6
6
  lib/munin_manager/plugins/haproxy_response_time.rb
7
7
  lib/munin_manager/plugins/rails_response_time.rb
8
+ lib/munin_manager/plugins/scribe_net.rb
8
9
  lib/munin_manager/plugins.rb
9
- lib/munin_manager/acts_as_munin_plugin.rb
10
+ lib/munin_manager.rb
11
+ Manifest
12
+ munin_manager.gemspec
13
+ Rakefile
14
+ README.markdown
10
15
  test/haproxy_response_time_test.rb
11
16
  test/log_reader_test.rb
12
- test/test_helper.rb
13
17
  test/rails_response_time_test.rb
14
- ext/string.rb
15
- Rakefile
16
- Manifest
17
- munin_manager.gemspec
18
+ test/test_helper.rb
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('munin_manager', '0.0.3') do |s|
2
+ Echoe.new('munin_manager', '0.0.4') do |s|
3
3
  s.description = "Tool to maintain and install munin plugins written in Ruby"
4
4
  s.author = "Rohith Ravi"
5
5
  s.email = "entombedvirus@gmail.com"
@@ -0,0 +1,80 @@
1
+ #! /usr/bin/env ruby
2
+ # Munin plugin for starling.
3
+ require 'rubygems'
4
+ require 'ruby_scribe_client'
5
+
6
+ #Monkey patched so the namespaced queues are included in stats
7
+ module MuninManager
8
+ class Plugins::ScribeNet
9
+ include ActsAsMuninPlugin
10
+
11
+ def initialize(host, port)
12
+ @scribe = FB303::Client.new(host, port)
13
+ @category = 'scribe'
14
+ end
15
+
16
+ def config
17
+ graph_config = <<-END.gsub(/ +/, '')
18
+ graph_title Scribe Traffic
19
+ graph_args --base 1000
20
+ graph_vlabel bits per second
21
+ graph_category #{@category}
22
+ END
23
+
24
+
25
+ stat_config = ''
26
+ graph_order = 'graph_order'
27
+ counters.keys.each do |stat|
28
+ stat_name = format_for_munin(stat)
29
+ graph_order << " "+ stat_name
30
+ net_stats.each do |var,value|
31
+ value = "#{stat_name}," + value if var == :cdef
32
+ stat_config << "#{stat_name}.#{var} #{value}\n"
33
+ end
34
+ end
35
+
36
+ return graph_config + graph_order+"\n" + stat_config
37
+ end
38
+
39
+ def values
40
+ ret = ""
41
+ @scribe.getCounters.each do |k, v|
42
+ ret << "#{format_for_munin(k)}.value #{v}\n"
43
+ end
44
+ ret
45
+ end
46
+
47
+ def self.run
48
+ host = ENV['SCRIBE_HOST'] || 'localhost';
49
+ port = ENV['SCRIBE_PORT'].to_i || 1463;
50
+ scribe = new(host, port)
51
+ allowed_commands = ['config']
52
+
53
+ if cmd = ARGV[0] and allowed_commands.include? cmd then
54
+ puts scribe.send(cmd.to_sym)
55
+ else
56
+ puts scribe.values
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ def format_for_munin(str)
63
+ str.to_s.gsub(/[^A-Za-z0-9_]/, "_")
64
+ end
65
+
66
+ def counters
67
+ @scribe.getCounters
68
+ end
69
+
70
+ def net_stats
71
+ stats = {
72
+ :label => 'read',
73
+ :type => 'COUNTER',
74
+ :cdef => '8,*'
75
+ }
76
+ return stats
77
+ end
78
+
79
+ end
80
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{munin_manager}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rohith Ravi"]
@@ -10,8 +10,8 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{Tool to maintain and install munin plugins written in Ruby}
11
11
  s.email = %q{entombedvirus@gmail.com}
12
12
  s.executables = ["munin_manager", "runner"]
13
- s.extra_rdoc_files = ["README.markdown", "bin/munin_manager", "bin/runner", "lib/munin_manager.rb", "lib/munin_manager/log_reader.rb", "lib/munin_manager/plugins/haproxy_response_time.rb", "lib/munin_manager/plugins/rails_response_time.rb", "lib/munin_manager/plugins.rb", "lib/munin_manager/acts_as_munin_plugin.rb", "ext/string.rb"]
14
- s.files = ["README.markdown", "bin/munin_manager", "bin/runner", "lib/munin_manager.rb", "lib/munin_manager/log_reader.rb", "lib/munin_manager/plugins/haproxy_response_time.rb", "lib/munin_manager/plugins/rails_response_time.rb", "lib/munin_manager/plugins.rb", "lib/munin_manager/acts_as_munin_plugin.rb", "test/haproxy_response_time_test.rb", "test/log_reader_test.rb", "test/test_helper.rb", "test/rails_response_time_test.rb", "ext/string.rb", "Rakefile", "Manifest", "munin_manager.gemspec"]
13
+ s.extra_rdoc_files = ["bin/munin_manager", "bin/runner", "ext/string.rb", "lib/munin_manager/acts_as_munin_plugin.rb", "lib/munin_manager/log_reader.rb", "lib/munin_manager/plugins/haproxy_response_time.rb", "lib/munin_manager/plugins/rails_response_time.rb", "lib/munin_manager/plugins/scribe_net.rb", "lib/munin_manager/plugins.rb", "lib/munin_manager.rb", "README.markdown"]
14
+ s.files = ["bin/munin_manager", "bin/runner", "ext/string.rb", "lib/munin_manager/acts_as_munin_plugin.rb", "lib/munin_manager/log_reader.rb", "lib/munin_manager/plugins/haproxy_response_time.rb", "lib/munin_manager/plugins/rails_response_time.rb", "lib/munin_manager/plugins/scribe_net.rb", "lib/munin_manager/plugins.rb", "lib/munin_manager.rb", "Manifest", "munin_manager.gemspec", "Rakefile", "README.markdown", "test/haproxy_response_time_test.rb", "test/log_reader_test.rb", "test/rails_response_time_test.rb", "test/test_helper.rb"]
15
15
  s.has_rdoc = true
16
16
  s.homepage = %q{}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Munin_manager", "--main", "README.markdown"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entombedvirus-munin_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rohith Ravi
@@ -21,34 +21,36 @@ executables:
21
21
  extensions: []
22
22
 
23
23
  extra_rdoc_files:
24
- - README.markdown
25
24
  - bin/munin_manager
26
25
  - bin/runner
27
- - lib/munin_manager.rb
26
+ - ext/string.rb
27
+ - lib/munin_manager/acts_as_munin_plugin.rb
28
28
  - lib/munin_manager/log_reader.rb
29
29
  - lib/munin_manager/plugins/haproxy_response_time.rb
30
30
  - lib/munin_manager/plugins/rails_response_time.rb
31
+ - lib/munin_manager/plugins/scribe_net.rb
31
32
  - lib/munin_manager/plugins.rb
32
- - lib/munin_manager/acts_as_munin_plugin.rb
33
- - ext/string.rb
34
- files:
33
+ - lib/munin_manager.rb
35
34
  - README.markdown
35
+ files:
36
36
  - bin/munin_manager
37
37
  - bin/runner
38
- - lib/munin_manager.rb
38
+ - ext/string.rb
39
+ - lib/munin_manager/acts_as_munin_plugin.rb
39
40
  - lib/munin_manager/log_reader.rb
40
41
  - lib/munin_manager/plugins/haproxy_response_time.rb
41
42
  - lib/munin_manager/plugins/rails_response_time.rb
43
+ - lib/munin_manager/plugins/scribe_net.rb
42
44
  - lib/munin_manager/plugins.rb
43
- - lib/munin_manager/acts_as_munin_plugin.rb
45
+ - lib/munin_manager.rb
46
+ - Manifest
47
+ - munin_manager.gemspec
48
+ - Rakefile
49
+ - README.markdown
44
50
  - test/haproxy_response_time_test.rb
45
51
  - test/log_reader_test.rb
46
- - test/test_helper.rb
47
52
  - test/rails_response_time_test.rb
48
- - ext/string.rb
49
- - Rakefile
50
- - Manifest
51
- - munin_manager.gemspec
53
+ - test/test_helper.rb
52
54
  has_rdoc: true
53
55
  homepage: ""
54
56
  post_install_message: