]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/passenger_processes
Remove trailing whitespace in ruby code
[chef.git] / cookbooks / munin / files / default / plugins / passenger_processes
1 #!/usr/bin/env ruby
2
3 def output_config
4   puts <<-END
5 graph_category passenger
6 graph_title Passenger processes
7 graph_order active inactive
8 graph_vlabel processes
9 graph_total total
10
11 active.label busy servers
12 active.draw AREA
13 inactive.label idle servers
14 inactive.draw STACK
15 END
16   exit 0
17 end
18
19 def output_values
20   status = `/usr/sbin/passenger-status`
21   unless $?.success?
22     $stderr.puts "failed executing passenger-status"
23     exit 1
24   end
25   status =~ /active\s+=\s+(\d+)/
26   puts "active.value #{$1}"
27
28   status =~ /inactive\s+=\s+(\d+)/
29   puts "inactive.value #{$1}"
30 end
31
32 if ARGV[0] == "config"
33   output_config
34 else
35   output_values
36 end