]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/passenger_requests
remove redirect of reverse to poldi
[chef.git] / cookbooks / munin / files / default / plugins / passenger_requests
1 #!/usr/bin/env ruby
2
3 require "English"
4
5 def output_config
6   puts <<-END
7 graph_args --base 1000
8 graph_category passenger
9 graph_title Passenger requests
10 graph_vlabel requests / ${graph_period}
11
12 requests.label requests
13 requests.type DERIVE
14 requests.max 1000000
15 requests.min 0
16 END
17   exit 0
18 end
19
20 def output_values
21   status = `/usr/sbin/passenger-status`
22   unless $CHILD_STATUS.success?
23     $stderr.puts "failed executing passenger-status"
24     exit 1
25   end
26   total_requests = 0
27   status.scan(/Processed: (\d+)/).flatten.each { |count| total_requests += count.to_i }
28   puts "requests.value #{total_requests}"
29 end
30
31 if ARGV[0] == "config"
32   output_config
33 else
34   output_values
35 end