From 4a11e48e397f1a7eb4c68a1dd1f9e3c5a11352f8 Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 12 Jul 2016 16:46:06 -0400 Subject: git subrepo clone https://leap.se/git/puppet_passenger puppet/modules/passenger subrepo: subdir: "puppet/modules/passenger" merged: "47fca11" upstream: origin: "https://leap.se/git/puppet_passenger" branch: "master" commit: "47fca11" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo" commit: "1e79595" Change-Id: Idba1129126ca0f13a4441e00d7b53e8b4f856825 --- .../modules/passenger/files/munin/passenger_stats | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 puppet/modules/passenger/files/munin/passenger_stats (limited to 'puppet/modules/passenger/files/munin/passenger_stats') diff --git a/puppet/modules/passenger/files/munin/passenger_stats b/puppet/modules/passenger/files/munin/passenger_stats new file mode 100755 index 00000000..f06e88a0 --- /dev/null +++ b/puppet/modules/passenger/files/munin/passenger_stats @@ -0,0 +1,47 @@ +#!/usr/bin/env ruby + +PASSENGER_STATUS = ENV['passenger_status'] || '/usr/local/bin/passenger-status' + +def output_config + puts <<-END +graph_category Passenger +graph_title passenger status +graph_vlabel count + +sessions.label sessions +max.label max processes +running.label running processes +active.label active processes +inactive.label inactive processes +END + exit 0 +end + +def output_values + status = `#{PASSENGER_STATUS}` + unless $?.success? + $stderr.puts "failed executing passenger-status" + exit 1 + end + status =~ /max\s+=\s+(\d+)/ + puts "max.value #{$1}" + + status =~ /count\s+=\s+(\d+)/ + puts "running.value #{$1}" + + status =~ /active\s+=\s+(\d+)/ + puts "active.value #{$1}" + + status =~ /inactive\s+=\s+(\d+)/ + puts "inactive.value #{$1}" + + total_sessions = 0 + status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i } + puts "sessions.value #{total_sessions}" +end + +if ARGV[0] == "config" + output_config +else + output_values +end -- cgit v1.2.3