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