diff options
author | Micah Anderson <micah@riseup.net> | 2016-11-04 10:54:28 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2016-11-04 10:54:28 -0400 |
commit | 34a381efa8f6295080c843f86bfa07d4e41056af (patch) | |
tree | 9282cf5d4c876688602705a7fa0002bc4a810bde /puppet/modules/passenger/files/munin/passenger_stats | |
parent | 0a72bc6fd292bf9367b314fcb0347c4d35042f16 (diff) | |
parent | 5821964ff7e16ca7aa9141bd09a77d355db492a9 (diff) |
Merge branch 'develop'
Diffstat (limited to 'puppet/modules/passenger/files/munin/passenger_stats')
m--------- | puppet/modules/passenger | 0 | ||||
-rwxr-xr-x | puppet/modules/passenger/files/munin/passenger_stats | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/puppet/modules/passenger b/puppet/modules/passenger deleted file mode 160000 -Subproject d1b46de84acf4d9e3582b64e019935fb1125f9b 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 |