Permalink
Browse files

Fix for Passenger version 4.

  • Loading branch information...
1 parent 17dd511 commit 41d264d40ec9f1f5de704f67ad715c4a933ea7f7 @kei-s kei-s committed Jul 19, 2013
Showing with 34 additions and 5 deletions.
  1. +9 −4 lib/munin/plugins/passenger_queue.rb
  2. +25 −1 lib/munin/plugins/passenger_status.rb
View
13 lib/munin/plugins/passenger_queue.rb
@@ -21,9 +21,14 @@ def config
end
def run
- status = run_command(passenger_status, debug)
- status =~ /Waiting on global queue:\s+(\d+)/
- puts "requests.value #{$1}"
+ status = run_command(passenger_status, debug)
+ if status =~ /Version : 4/
+ status =~ /Requests in top-level queue\s+:\s+(\d+)/
+ puts "requests.value #{$1}"
+ else
+ status =~ /Waiting on global queue:\s+(\d+)/
+ puts "requests.value #{$1}"
+ end
end
end
-end
+end
View
26 lib/munin/plugins/passenger_status.rb
@@ -31,6 +31,30 @@ def config
def run
status = run_command(passenger_status, debug)
+ if status =~ /Version : 4/
+ run_version4(status)
+ else
+ run_version3(status)
+ end
+ end
+
+ private
+ def run_version4(status)
+ status =~ /Max pool size\s+:\s+(\d+)/
+ puts "max.value #{$1}"
+
+ status =~ /Processes\s+:\s+(\d+)/
+ puts "running.value #{$1}"
+
+ active_processes = status.scan(/Sessions:\s+(\d+)/).flatten.select { |count| count.to_i != 0 }.size
+ puts "active.value #{active_processes}"
+
+ total_sessions = 0
+ status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i }
+ puts "sessions.value #{total_sessions}"
+ end
+
+ def run_version3(status)
status =~ /max\s+=\s+(\d+)/
puts "max.value #{$1}"
@@ -45,4 +69,4 @@ def run
puts "sessions.value #{total_sessions}"
end
end
-end
+end

0 comments on commit 41d264d

Please sign in to comment.