]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/passenger_queues
Add munin plugin to monitor rrdcached
[chef.git] / cookbooks / munin / files / default / plugins / passenger_queues
1 #!/usr/bin/env ruby
2
3 def output_config
4   puts <<-END
5 graph_category passenger
6 graph_title Passenger queues
7 graph_vlabel count
8
9 global.label global
10 END
11   exit 0
12 end
13
14 def output_values
15   status = `/usr/sbin/passenger-status`
16   unless $CHILD_STATUS.success?
17     $stderr.puts "failed executing passenger-status"
18     exit 1
19   end
20   status =~ /Waiting on global queue:\s+(\d+)/
21   puts "global.value #{Regexp.last_match[1]}"
22 end
23
24 if ARGV[0] == "config"
25   output_config
26 else
27   output_values
28 end