]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/passenger_processes
Fix rubocop warnings
[chef.git] / cookbooks / munin / files / default / plugins / passenger_processes
index d89d0412e9139d2fac1a0ec39f908ef4b6ffa413..0611ccc0e7ac4f54a5f2fa3e45b04bdf00a4fa64 100755 (executable)
@@ -1,32 +1,34 @@
 #!/usr/bin/env ruby
 
+require "English"
+
 def output_config
-  puts <<-END
-graph_category passenger
-graph_title Passenger processes
-graph_order active inactive
-graph_vlabel processes
-graph_total total
+  puts <<~CONFIG
+    graph_category passenger
+    graph_title Passenger processes
+    graph_order active inactive
+    graph_vlabel processes
+    graph_total total
 
-active.label busy servers
-active.draw AREA
-inactive.label idle servers
-inactive.draw STACK
-END
+    active.label busy servers
+    active.draw AREA
+    inactive.label idle servers
+    inactive.draw STACK
+  CONFIG
   exit 0
 end
 
 def output_values
   status = `/usr/sbin/passenger-status`
-  unless $?.success?
-    $stderr.puts "failed executing passenger-status"
+  unless $CHILD_STATUS.success?
+    warn "failed executing passenger-status"
     exit 1
   end
   status =~ /active\s+=\s+(\d+)/
-  puts "active.value #{$1}"
+  puts "active.value #{Regexp.last_match[1]}"
 
   status =~ /inactive\s+=\s+(\d+)/
-  puts "inactive.value #{$1}"
+  puts "inactive.value #{Regexp.last_match[1]}"
 end
 
 if ARGV[0] == "config"