entombedvirus-munin_manager 0.0.8 → 0.0.9

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/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('munin_manager', '0.0.8') do |s|
2
+ Echoe.new('munin_manager', '0.0.9') 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"
@@ -10,9 +10,16 @@ module MuninManager
10
10
  else
11
11
  hostnames.each do |hostname|
12
12
  values = []
13
+ threads = []
13
14
  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
15
+ threads << Thread.new do
16
+ value = %x{(ping -c 10 #{hostname} 2> /dev/null || echo '0/0/0/0/-1/0') | tail -1 | cut -d/ -f 5}.to_i
17
+ Thread.current[:value] = value
18
+ end
19
+ end
20
+ threads.each do |t|
21
+ t.join
22
+ values << t[:value] if t[:value] >= 0
16
23
  end
17
24
  avg = values.size > 0 ? values.inject(0){|a,b| a + b}.to_f / values.size : -1
18
25
  puts "#{sanitize(hostname)}.value #{avg}"
@@ -10,9 +10,16 @@ module MuninManager
10
10
  else
11
11
  hostnames.each do |hostname|
12
12
  values = []
13
+ threads = []
13
14
  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
15
+ threads << Thread.new do
16
+ 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
17
+ Thread.current[:value] = value
18
+ end
19
+ end
20
+ threads.each do |t|
21
+ t.join
22
+ values << t[:value]
16
23
  end
17
24
  avg = values.inject{|a,b| a + b}.to_f / values.size
18
25
  puts "#{sanitize(hostname)}.value #{avg}"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{munin_manager}
5
- s.version = "0.0.8"
5
+ s.version = "0.0.9"
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-10}
9
+ s.date = %q{2009-04-13}
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"]
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.8
4
+ version: 0.0.9
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-10 00:00:00 -07:00
12
+ date: 2009-04-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15