entombedvirus-munin_manager 0.0.6 → 0.0.8

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
@@ -4,6 +4,8 @@ ext/string.rb
4
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
+ lib/munin_manager/plugins/network_latency.rb
8
+ lib/munin_manager/plugins/packet_loss.rb
7
9
  lib/munin_manager/plugins/rails_response_time.rb
8
10
  lib/munin_manager/plugins/scribe_net.rb
9
11
  lib/munin_manager/plugins.rb
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('munin_manager', '0.0.6') do |s|
2
+ Echoe.new('munin_manager', '0.0.8') 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,41 @@
1
+ module MuninManager
2
+ class Plugins::NetworkLatency < LogReader
3
+ include ActsAsMuninPlugin
4
+
5
+ def self.run
6
+ hostnames = (ENV['hostnames'] || 'localhost').split(",")
7
+ count = (ENV["count"] || 1).to_i
8
+ if ARGV[0] == "config"
9
+ puts config(hostnames)
10
+ else
11
+ hostnames.each do |hostname|
12
+ values = []
13
+ count.times do |i|
14
+ value = %x{(ping -c 10 #{hostname} 2> /dev/null || echo '0/0/0/0/-1/0') | tail -1 | cut -d/ -f 5}.to_i
15
+ values << value if value >= 0
16
+ end
17
+ avg = values.size > 0 ? values.inject(0){|a,b| a + b}.to_f / values.size : -1
18
+ puts "#{sanitize(hostname)}.value #{avg}"
19
+ end
20
+ end
21
+ end
22
+
23
+ def self.sanitize(hostname)
24
+ hostname.to_s.gsub(/[^\w]/, '_')
25
+ end
26
+
27
+ def self.config(hostnames)
28
+ configs = {
29
+ "graph_title" => "Network Latency",
30
+ "graph_vlabel" => "time (ms)",
31
+ "graph_category" => "Network",
32
+ "graph_order" => ""
33
+ }
34
+ hostnames.each do |hostname|
35
+ configs["#{sanitize(hostname)}.label"] = hostname
36
+ configs["graph_order"] += "#{sanitize(hostname)} "
37
+ end
38
+ configs.map {|key_value_pair| key_value_pair.join(" ")}.join("\n")
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ module MuninManager
2
+ class Plugins::PacketLoss < LogReader
3
+ include ActsAsMuninPlugin
4
+
5
+ def self.run
6
+ hostnames = (ENV['hostnames'] || 'localhost').split(",")
7
+ count = (ENV["count"] || 1).to_i
8
+ if ARGV[0] == "config"
9
+ puts config(hostnames)
10
+ else
11
+ hostnames.each do |hostname|
12
+ values = []
13
+ count.times do |i|
14
+ value = %x{(ping -c 10 #{hostname} 2> /dev/null || echo "1 packets transmitted, 1 received, 100% packet loss, time 0ms") | tail -2 | head -1 | cut -d' ' -f 6 | sed s/%//}.to_i
15
+ values << value
16
+ end
17
+ avg = values.inject{|a,b| a + b}.to_f / values.size
18
+ puts "#{sanitize(hostname)}.value #{avg}"
19
+ end
20
+ end
21
+ end
22
+
23
+ def self.sanitize(hostname)
24
+ hostname.to_s.gsub(/[^\w]/, '_')
25
+ end
26
+
27
+ def self.config(hostnames)
28
+ configs = {
29
+ "graph_title" => "Packet Loss",
30
+ "graph_vlabel" => "percentage",
31
+ "graph_category" => "Network",
32
+ "graph_order" => ""
33
+ }
34
+ hostnames.each do |hostname|
35
+ configs["#{sanitize(hostname)}.label"] = hostname
36
+ configs["graph_order"] += "#{sanitize(hostname)} "
37
+ end
38
+ configs.map {|key_value_pair| key_value_pair.join(" ")}.join("\n")
39
+ end
40
+ end
41
+ end
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{munin_manager}
5
- s.version = "0.0.6"
5
+ s.version = "0.0.8"
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"]
9
- s.date = %q{2009-04-09}
9
+ s.date = %q{2009-04-10}
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 = ["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"]
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/network_latency.rb", "lib/munin_manager/plugins/packet_loss.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/network_latency.rb", "lib/munin_manager/plugins/packet_loss.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.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rohith Ravi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-09 00:00:00 -07:00
12
+ date: 2009-04-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -27,6 +27,8 @@ extra_rdoc_files:
27
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
+ - lib/munin_manager/plugins/network_latency.rb
31
+ - lib/munin_manager/plugins/packet_loss.rb
30
32
  - lib/munin_manager/plugins/rails_response_time.rb
31
33
  - lib/munin_manager/plugins/scribe_net.rb
32
34
  - lib/munin_manager/plugins.rb
@@ -39,6 +41,8 @@ files:
39
41
  - lib/munin_manager/acts_as_munin_plugin.rb
40
42
  - lib/munin_manager/log_reader.rb
41
43
  - lib/munin_manager/plugins/haproxy_response_time.rb
44
+ - lib/munin_manager/plugins/network_latency.rb
45
+ - lib/munin_manager/plugins/packet_loss.rb
42
46
  - lib/munin_manager/plugins/rails_response_time.rb
43
47
  - lib/munin_manager/plugins/scribe_net.rb
44
48
  - lib/munin_manager/plugins.rb