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