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