Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for Passenger version 4.

  • Loading branch information...
commit 41d264d40ec9f1f5de704f67ad715c4a933ea7f7 1 parent 17dd511
Kei Shiratsuchi kei-s authored
13 lib/munin/plugins/passenger_queue.rb
View
@@ -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
26 lib/munin/plugins/passenger_status.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.