<?xml version="1.0" encoding="UTF-8"?>
<plugin-url>
  <approved type="boolean">true</approved>
  <author>Jason Lee</author>
  <cached-tag-list>phusion, passenger</cached-tag-list>
  <canonical-name nil="true"></canonical-name>
  <code>class PassengerStatus &lt; Scout::Plugin
  def build_report
    cmd  = option(:passenger_status_command) || &quot;passenger-status&quot;
    data = `#{cmd} 2&gt;&amp;1`
    if $?.success?
      stats = parse_data(data)
      report(stats)
    else
      error &quot;Could not get data from command&quot;, &quot;Error:  #{data}&quot;
    end
  end

  private

  def parse_data(data)
    stats = {}
    
    data.each_line do |line|
      #line = line.gsub(/\e\[\d+m/,'')
      if line =~ /^max\s+=\s(\d+)/
        stats[&quot;max&quot;] = $1
      elsif line =~ /^count\s+=\s(\d+)/
        stats[&quot;current&quot;] = $1
      elsif line =~ /^active\s+=\s(\d+)/
        stats[&quot;active&quot;] = $1
      elsif line =~ /^inactive\s+=\s(\d+)/
        stats[&quot;inactive&quot;] = $1
      elsif line =~ /^Waiting on global queue: (\d+)/
        stats[&quot;gq_wait&quot;] = $1

      end
    end

    stats
  end

end
</code>
  <created-at type="datetime">2009-06-12T14:43:50-07:00</created-at>
  <default-triggers type="yaml" nil="true"></default-triggers>
  <description>Provides metrics on Passengers internal state, including the number of application instances that are currently alive, the number of instances that are currently processing requests, and the number of idle instances. See &quot;the passenger manual&quot;:http://www.modrails.com/documentation/Users%20guide.html#_inspecting_phusion_passenger_8217_s_internal_status for details on the values provided by the passenger-status command line.

&lt;p&gt;
*Note that you need to edit the sudoers file on your server to allow the Scout agent to run @passenger-status@ without a password*. You will need to address this access issue on your server. &quot;Learn how here&quot;:https://scoutapp.com/plugin_urls/141-passenger-status/help_entries/171.
 &lt;/p&gt;</description>
  <featured type="boolean">false</featured>
  <id type="integer">141</id>
  <metadata type="yaml">--- |-
options:
  passenger_status_command:
    name: The Passenger Status Command
    notes: The full path to the passenger-status command (possibly with sudo).
    default: sudo /usr/bin/passenger-status

schema:
  - current
  - max
  - active
  - inactive
  - gq_wait

metadata:
  current: 
    units: &quot;&quot;
    larger_is_better: &quot;0&quot;
    delimiter: &quot;,&quot;
    precision: &quot;0&quot;
    label: Current Passengers
  max: 
    units: &quot;&quot;
    larger_is_better: &quot;0&quot;
    delimiter: &quot;,&quot;
    precision: &quot;0&quot;
    label: Max Passengers
  active: 
    units: &quot;&quot;
    larger_is_better: &quot;0&quot;
    delimiter: &quot;,&quot;
    precision: &quot;0&quot;
    label: Active Passengers
  inactive: 
    units: &quot;&quot;
    larger_is_better: &quot;0&quot;
    delimiter: &quot;,&quot;
    precision: &quot;0&quot;
    label: Inactive Passengers    
  gq_wait: 
    units: &quot;&quot;
    larger_is_better: &quot;0&quot;
    delimiter: &quot;,&quot;
    precision: &quot;0&quot;
    label: Req. waiting on global queue
</metadata>
  <name>Passenger Status</name>
  <plugins-count type="integer">7</plugins-count>
  <rating-avg type="decimal">0.0</rating-avg>
  <rating-count type="integer">0</rating-count>
  <rating-total type="integer">0</rating-total>
  <readme>Passenger Status
======================

Based on passenger_memory_stats

Compatibility 
-------------

Works on Linux and Solaris.

Sudo Usage
----------

The passenger-status program recommends that you run it would super user privileges to gain more information.  This plugin is usable without the extra access rights, but you will need to add them if you want the full details.

It's important to note though that it is not safe for you to transmit your super user password to us.  You will need to address this access issue on your server.

Our recommended procedure to handle this is:

1. Edit the sudoers file on your server to allow the user that runs the scout client listed in your crontab to be able to run passenger-status without a password. e.g.  
     daemon  ALL=NOPASSWD: /usr/bin/passenger-status
2. Login into Scout and edit your plugin settings to add sudo in front of the command name. e.g
     sudo /usr/bin/passenger-status
</readme>
  <schema type="yaml" nil="true"></schema>
  <scout-version type="integer">3</scout-version>
  <short-description>Provides metrics on Passengers internal state, including the number of application instances that are currently alive, the number of instances that are currently processing requests, and the number of idle instances. </short-description>
  <tested-platforms>Ubunto 8.04</tested-platforms>
  <total-usage-count type="integer">0</total-usage-count>
  <updated-at type="datetime">2010-03-03T18:10:49-08:00</updated-at>
  <url>http://github.com/highgroove/scout-plugins/raw/master/passenger_status/passenger_status.rb</url>
</plugin-url>
