<?xml version="1.0" encoding="UTF-8"?>
<plugin-url>
  <approved type="boolean">true</approved>
  <author>Luc Castera</author>
  <cached-tag-list>nginx</cached-tag-list>
  <canonical-name nil="true"></canonical-name>
  <code>require 'open-uri'

class NginxReport &lt; Scout::Plugin

  def build_report	
	  url = option(:url) || 'http://127.0.0.1/nginx_status'

  	total, requests, reading, writing, waiting = nil

  	open(url) {|f|
  	  f.each_line do |line|
  		total = $1 if line =~ /^Active connections:\s+(\d+)/
  		if line =~ /^Reading:\s+(\d+).*Writing:\s+(\d+).*Waiting:\s+(\d+)/
  		  reading = $1
  		  writing = $2
  		  waiting = $3
  		end
  		requests = $3 if line =~ /^\s+(\d+)\s+(\d+)\s+(\d+)/  
  	  end
  	}
	
	  report({:total =&gt; total, :reading =&gt; reading, :writing =&gt; writing, :waiting =&gt; waiting, :requests =&gt; requests})
  end
end
</code>
  <created-at type="datetime">2008-08-08T11:39:41-07:00</created-at>
  <default-triggers type="yaml" nil="true"></default-triggers>
  <description>Monitors &quot;Nginx&quot;:http://wiki.codemongers.com/Main, reporting the total # of requests, the total number of connections, and the number of connections reading, writing, and waiting.

&lt;p&gt;In order to have this plugin running, you need to make sure that your  version of Nginx was compiled with the Stub Status module.&lt;/p&gt;

&lt;p&gt;On Ubuntu Hardy, the Nginx package comes with Stub Status compiled in so if you installed Nginx via apt-get or aptitude, you should have it.&lt;/p&gt;

&lt;p&gt;Make sure you have the following in your Nginx config file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
location /nginx_status {
  stub_status on;
  access_log   off;
  allow 127.0.0.1;
  deny all;
}
&lt;/code&gt;&lt;/pre&gt;
</description>
  <featured type="boolean">false</featured>
  <id type="integer">72</id>
  <metadata type="yaml" nil="true"></metadata>
  <name>Nginx monitoring</name>
  <plugins-count type="integer">25</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>* Description

This is a Scout (http://scoutapp.com) plugin that monitors nginx and 
sends the data back to scout.

For more info, visit:
https://scoutapp.com/plugin_urls/static/creating_a_plugin

In order to have this plugin running, you need to make sure that your 
version of Nginx was compiled with the Stub Status module.

On Ubuntu Hardy, the nginx package comes with Stub Status compiled in so 
if you installed Nginx via apt-get or aptitude, you should have it.

Make sure you have the following in your nginx config file:

location /nginx_status {
	stub_status on;
	access_log   off;
	allow 127.0.0.1;
	deny all;
}

---- History ----

Created on July 30, 2008 by Luc Castera</readme>
  <schema type="yaml" nil="true"></schema>
  <scout-version type="integer">2</scout-version>
  <short-description>Monitors Nginx, reporting the total # of requests, the total number of connections, and the number of connections reading, writing, and waiting.</short-description>
  <tested-platforms>linux</tested-platforms>
  <total-usage-count type="integer">0</total-usage-count>
  <updated-at type="datetime">2010-02-04T12:49:20-08:00</updated-at>
  <url>http://github.com/highgroove/scout-plugins/raw/master/nginx_report/nginx_report.rb</url>
</plugin-url>
