munin_rake_processes 0.0.2 → 0.0.3
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/lib/munin/rake_processes/cpu.rb +9 -7
- data/lib/munin/rake_processes/cpu_time.rb +7 -7
- data/lib/munin/rake_processes/memory.rb +9 -7
- data/lib/munin/rake_processes/plugin.rb +4 -3
- data/lib/munin/rake_processes/version.rb +1 -1
- data/munin_rake_processes.gemspec +1 -1
- data/spec/munin/rake_processes/cpu_spec.rb +11 -9
- data/spec/munin/rake_processes/cpu_time_spec.rb +9 -9
- data/spec/munin/rake_processes/memory_spec.rb +11 -9
- data/spec/munin/rake_processes/plugin_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +6 -6
@@ -4,19 +4,21 @@ module Munin
|
|
4
4
|
|
5
5
|
def config
|
6
6
|
puts <<-CONFIG
|
7
|
+
graph_args --lower-limit 0 --upper-limit 100
|
7
8
|
graph_category #{graph_category}
|
8
|
-
graph_info The CPU
|
9
|
-
|
10
|
-
|
9
|
+
graph_info The % of CPU currently used by each running Rake processes - (possibly from cron)
|
10
|
+
graph_scale no
|
11
|
+
graph_title Current CPU utilization of Rake Processes
|
12
|
+
graph_vlabel Percent
|
11
13
|
CONFIG
|
12
|
-
rake_processes.
|
13
|
-
puts "#{key}
|
14
|
+
rake_processes.each do |key, values|
|
15
|
+
puts "#{key}.label #{values[:label]}"
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
19
|
def run
|
18
|
-
rake_processes.each do |
|
19
|
-
puts "#{
|
20
|
+
rake_processes.each do |key, values|
|
21
|
+
puts "#{key}.value #{values[:cpu]}"
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -5,18 +5,18 @@ module Munin
|
|
5
5
|
def config
|
6
6
|
puts <<-CONFIG
|
7
7
|
graph_category #{graph_category}
|
8
|
-
graph_info The CPU time consumed
|
9
|
-
graph_title CPU Time of Rake Processes
|
10
|
-
graph_vlabel
|
8
|
+
graph_info The seconds of cumulative CPU time consumed by each Rake processes
|
9
|
+
graph_title Cumulative CPU Time of Rake Processes
|
10
|
+
graph_vlabel Seconds
|
11
11
|
CONFIG
|
12
|
-
rake_processes.
|
13
|
-
puts "#{key}
|
12
|
+
rake_processes.each do |key, values|
|
13
|
+
puts "#{key}.label #{values[:label]}"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
def run
|
18
|
-
rake_processes.each do |
|
19
|
-
puts "#{
|
18
|
+
rake_processes.each do |key, values|
|
19
|
+
puts "#{key}.value #{values[:time]}"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -4,19 +4,21 @@ module Munin
|
|
4
4
|
|
5
5
|
def config
|
6
6
|
puts <<-CONFIG
|
7
|
+
graph_args --lower-limit 0 --upper-limit 100
|
7
8
|
graph_category #{graph_category}
|
8
|
-
graph_info The Memory
|
9
|
-
|
10
|
-
|
9
|
+
graph_info The % of Memory currently used by each running Rake processes - (possibly from cron)
|
10
|
+
graph_scale no
|
11
|
+
graph_title Current Memory utilization of Rake Processes
|
12
|
+
graph_vlabel Percent
|
11
13
|
CONFIG
|
12
|
-
rake_processes.
|
13
|
-
puts "#{key}
|
14
|
+
rake_processes.each do |key, values|
|
15
|
+
puts "#{key}.label #{values[:label]}"
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
19
|
def run
|
18
|
-
rake_processes.each do |
|
19
|
-
puts "#{
|
20
|
+
rake_processes.each do |key, values|
|
21
|
+
puts "#{key}.value #{values[:memory]}"
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -28,10 +28,11 @@ module Munin
|
|
28
28
|
rake_ps_lines.each do |ps_line|
|
29
29
|
user, pid, cpu, memory, cpu_time, cmd = ps_line.split ' ', 6
|
30
30
|
cmd =~ /rake([^-]+)/
|
31
|
-
rake_cmd = $1.split('-').first.strip
|
32
|
-
|
31
|
+
rake_cmd = $1.split('-').first.strip
|
32
|
+
key = "#{user}_#{pid}_#{rake_cmd.gsub(/[^\w]/, '_')}"
|
33
|
+
label = "#{user} (#{pid}) #{rake_cmd}"
|
33
34
|
time_in_seconds = ps_time_to_seconds(cpu_time)
|
34
|
-
_rake_processes[
|
35
|
+
_rake_processes[key] = {:cpu => cpu, :memory => memory, :time => time_in_seconds, :label => label}
|
35
36
|
end
|
36
37
|
_rake_processes
|
37
38
|
end
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.post_install_message = <<-POST_INSTALL_MESSAGE
|
19
19
|
#{"*" * 80}
|
20
20
|
|
21
|
-
|
21
|
+
To install these munin plugins and start monitoring your rake processes run
|
22
22
|
|
23
23
|
munin_rake_processes_installer
|
24
24
|
|
@@ -15,13 +15,15 @@ describe Munin::RakeProcesses::Cpu do
|
|
15
15
|
|
16
16
|
subject { captured_output }
|
17
17
|
it { should == <<-OUTPUT
|
18
|
+
graph_args --lower-limit 0 --upper-limit 100
|
18
19
|
graph_category RakeProcesses
|
19
|
-
graph_info The CPU
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
graph_info The % of CPU currently used by each running Rake processes - (possibly from cron)
|
21
|
+
graph_scale no
|
22
|
+
graph_title Current CPU utilization of Rake Processes
|
23
|
+
graph_vlabel Percent
|
24
|
+
some_user_25963_users_load.label some_user (25963) users:load
|
25
|
+
some_user_27461_users_load.label some_user (27461) users:load
|
26
|
+
some_user_27499_cron.label some_user (27499) cron
|
25
27
|
OUTPUT
|
26
28
|
}
|
27
29
|
end
|
@@ -33,9 +35,9 @@ OUTPUT
|
|
33
35
|
|
34
36
|
subject { captured_output }
|
35
37
|
it { should == <<-OUTPUT
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
some_user_25963_users_load.value 5.0
|
39
|
+
some_user_27461_users_load.value 0.0
|
40
|
+
some_user_27499_cron.value 90.0
|
39
41
|
OUTPUT
|
40
42
|
}
|
41
43
|
end
|
@@ -16,12 +16,12 @@ describe Munin::RakeProcesses::CpuTime do
|
|
16
16
|
subject { captured_output }
|
17
17
|
it { should == <<-OUTPUT
|
18
18
|
graph_category RakeProcesses
|
19
|
-
graph_info The CPU time consumed
|
20
|
-
graph_title CPU Time of Rake Processes
|
21
|
-
graph_vlabel
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
graph_info The seconds of cumulative CPU time consumed by each Rake processes
|
20
|
+
graph_title Cumulative CPU Time of Rake Processes
|
21
|
+
graph_vlabel Seconds
|
22
|
+
some_user_25963_users_load.label some_user (25963) users:load
|
23
|
+
some_user_27461_users_load.label some_user (27461) users:load
|
24
|
+
some_user_27499_cron.label some_user (27499) cron
|
25
25
|
OUTPUT
|
26
26
|
}
|
27
27
|
end
|
@@ -33,9 +33,9 @@ OUTPUT
|
|
33
33
|
|
34
34
|
subject { captured_output }
|
35
35
|
it { should == <<-OUTPUT
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
some_user_25963_users_load.value 8448.69
|
37
|
+
some_user_27461_users_load.value 0.0
|
38
|
+
some_user_27499_cron.value 2.3
|
39
39
|
OUTPUT
|
40
40
|
}
|
41
41
|
end
|
@@ -15,13 +15,15 @@ describe Munin::RakeProcesses::Memory do
|
|
15
15
|
|
16
16
|
subject { captured_output }
|
17
17
|
it { should == <<-OUTPUT
|
18
|
+
graph_args --lower-limit 0 --upper-limit 100
|
18
19
|
graph_category RakeProcesses
|
19
|
-
graph_info The Memory
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
graph_info The % of Memory currently used by each running Rake processes - (possibly from cron)
|
21
|
+
graph_scale no
|
22
|
+
graph_title Current Memory utilization of Rake Processes
|
23
|
+
graph_vlabel Percent
|
24
|
+
some_user_25963_users_load.label some_user (25963) users:load
|
25
|
+
some_user_27461_users_load.label some_user (27461) users:load
|
26
|
+
some_user_27499_cron.label some_user (27499) cron
|
25
27
|
OUTPUT
|
26
28
|
}
|
27
29
|
end
|
@@ -33,9 +35,9 @@ OUTPUT
|
|
33
35
|
|
34
36
|
subject { captured_output }
|
35
37
|
it { should == <<-OUTPUT
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
some_user_25963_users_load.value 0.2
|
39
|
+
some_user_27461_users_load.value 0.1
|
40
|
+
some_user_27499_cron.value 0.3
|
39
41
|
OUTPUT
|
40
42
|
}
|
41
43
|
end
|
@@ -10,14 +10,14 @@ describe Munin::RakeProcesses::Plugin do
|
|
10
10
|
its(:size) { should == 3 }
|
11
11
|
|
12
12
|
describe 'old load_users' do
|
13
|
-
subject { rake_processes['
|
13
|
+
subject { rake_processes['some_user_25963_users_load'] }
|
14
14
|
its([:cpu ]) { should == '5.0' }
|
15
15
|
its([:memory]) { should == '0.2' }
|
16
16
|
its([:time ]) { should == 8448.69 }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe 'hung old load_users' do
|
20
|
-
subject { rake_processes['
|
20
|
+
subject { rake_processes['some_user_27461_users_load'] }
|
21
21
|
its([:cpu ]) { should == '0.0' }
|
22
22
|
its([:memory]) { should == '0.1' }
|
23
23
|
its([:time ]) { should == 0.0 }
|
data/spec/spec_helper.rb
CHANGED
@@ -8,8 +8,8 @@ end
|
|
8
8
|
|
9
9
|
def stub_ps
|
10
10
|
Munin::RakeProcesses::Plugin.stub(:'`').and_return <<-PS_STRING
|
11
|
-
some_user 25963 5.0 0.2 140:48.69 ruby /Users/alex/.rvm/gems/ruby-1.8.7-p334/bin/rake
|
12
|
-
some_user 27461 0.0 0.1 00:00:00 ruby /Users/alex/.rvm/gems/ruby-1.8.7-p334/bin/rake
|
11
|
+
some_user 25963 5.0 0.2 140:48.69 ruby /Users/alex/.rvm/gems/ruby-1.8.7-p334/bin/rake users:load
|
12
|
+
some_user 27461 0.0 0.1 00:00:00 ruby /Users/alex/.rvm/gems/ruby-1.8.7-p334/bin/rake users:load
|
13
13
|
some_user 27499 90.0 0.3 0:02.30 ruby /Users/alex/.rvm/gems/ruby-1.8.7-p334/bin/rake cron
|
14
14
|
PS_STRING
|
15
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: munin_rake_processes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70155678730500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.2'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70155678730500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70155678729820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70155678729820
|
36
36
|
description: Munin tasks for monitoring rake processes
|
37
37
|
email:
|
38
38
|
- alex@alexrothenberg.com
|
@@ -74,7 +74,7 @@ files:
|
|
74
74
|
homepage: ''
|
75
75
|
licenses: []
|
76
76
|
post_install_message: ! " ********************************************************************************\n\n
|
77
|
-
\
|
77
|
+
\ To install these munin plugins and start monitoring your rake processes run\n\n
|
78
78
|
\ munin_rake_processes_installer\n\n Enjoy!\n\n ********************************************************************************\n"
|
79
79
|
rdoc_options: []
|
80
80
|
require_paths:
|