munin_rake_processes 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 usage of Rake processes currently running - (possibly from cron)
9
- graph_title CPU usage of Rake Processes
10
- graph_vlabel CPU usage of Rake Processes
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.each_key do |key|
13
- puts "#{key}_CPU.label #{key}_CPU"
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 |cmd, values|
19
- puts "#{cmd}_CPU.value #{values[:cpu]}"
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 of Rake processes currently running - (possibly from cron)
9
- graph_title CPU Time of Rake Processes
10
- graph_vlabel CPU Time of Rake Processes
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.each_key do |key|
13
- puts "#{key}_TIME.label #{key}_TIME"
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 |cmd, values|
19
- puts "#{cmd}_TIME.value #{values[:time]}"
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 usage of Rake processes currently running - (possibly from cron)
9
- graph_title Memory usage of Rake Processes
10
- graph_vlabel Memory usage of Rake Processes
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.each_key do |key|
13
- puts "#{key}_Memory.label #{key}_Memory"
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 |cmd, values|
19
- puts "#{cmd}_Memory.value #{values[:memory]}"
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.gsub(/[^\w]/, '_')
32
- label = "#{user}_#{pid}_#{rake_cmd}"
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[label] = {:cpu => cpu, :memory => memory, :time => time_in_seconds}
35
+ _rake_processes[key] = {:cpu => cpu, :memory => memory, :time => time_in_seconds, :label => label}
35
36
  end
36
37
  _rake_processes
37
38
  end
@@ -1,5 +1,5 @@
1
1
  module Munin
2
2
  module RakeProcesses
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  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
- To install these munin plugins and start monitoring your rake processes run
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 usage of Rake processes currently running - (possibly from cron)
20
- graph_title CPU usage of Rake Processes
21
- graph_vlabel CPU usage of Rake Processes
22
- some_user_25963_load_users_CPU.label some_user_25963_load_users_CPU
23
- some_user_27461_load_users_CPU.label some_user_27461_load_users_CPU
24
- some_user_27499_cron_CPU.label some_user_27499_cron_CPU
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
- some_user_25963_load_users_CPU.value 5.0
37
- some_user_27461_load_users_CPU.value 0.0
38
- some_user_27499_cron_CPU.value 90.0
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 of Rake processes currently running - (possibly from cron)
20
- graph_title CPU Time of Rake Processes
21
- graph_vlabel CPU Time of Rake Processes
22
- some_user_25963_load_users_TIME.label some_user_25963_load_users_TIME
23
- some_user_27461_load_users_TIME.label some_user_27461_load_users_TIME
24
- some_user_27499_cron_TIME.label some_user_27499_cron_TIME
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
- some_user_25963_load_users_TIME.value 8448.69
37
- some_user_27461_load_users_TIME.value 0.0
38
- some_user_27499_cron_TIME.value 2.3
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 usage of Rake processes currently running - (possibly from cron)
20
- graph_title Memory usage of Rake Processes
21
- graph_vlabel Memory usage of Rake Processes
22
- some_user_25963_load_users_Memory.label some_user_25963_load_users_Memory
23
- some_user_27461_load_users_Memory.label some_user_27461_load_users_Memory
24
- some_user_27499_cron_Memory.label some_user_27499_cron_Memory
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
- some_user_25963_load_users_Memory.value 0.2
37
- some_user_27461_load_users_Memory.value 0.1
38
- some_user_27499_cron_Memory.value 0.3
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['some_user_25963_load_users'] }
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['some_user_27461_load_users'] }
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 }
@@ -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 load_users
12
- some_user 27461 0.0 0.1 00:00:00 ruby /Users/alex/.rvm/gems/ruby-1.8.7-p334/bin/rake load_users
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.2
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: &70140733836500 !ruby/object:Gem::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: *70140733836500
24
+ version_requirements: *70155678730500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70140733834760 !ruby/object:Gem::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: *70140733834760
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
- \ To install these munin plugins and start monitoring your rake processes run\n\n
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: