<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Snow Giraffe Tech &#187; gems</title>
	<atom:link href="http://www.snowgiraffe.com/tech/category/ruby-on-rails/gems/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.snowgiraffe.com/tech</link>
	<description>rails, rubies, and sometimes dolphins</description>
	<lastBuildDate>Mon, 07 Jun 2010 14:36:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails Application Health Monitor</title>
		<link>http://www.snowgiraffe.com/tech/599/health-monitor/</link>
		<comments>http://www.snowgiraffe.com/tech/599/health-monitor/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 02:43:54 +0000</pubDate>
		<dc:creator>blythe</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[monitor rails health]]></category>

		<guid isPermaLink="false">http://www.snowgiraffe.com/tech/?p=599</guid>
		<description><![CDATA[The health monitor gem allows you to monitor your rails application through a single controller action. In addition to built in database and server environment checks, health monitor allows you to quickly add your customized health checks to the mix.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="hot-thermometer" src="http://www.snowgiraffe.com/tech/wp-content/uploads/2009/12/hot-thermometer-172x300.gif" alt="hot-thermometer" width="109" height="191" /><br />
Most rails applications have many additional moving parts of which the health cannot be assessed with simply pinging the (hopefully page cached) homepage</p>
<p>For example,</p>
<ul>
<li>Is Email is sent successfully?</li>
<li>Is the SMS gateway alive and you bought sufficient credits?</li>
<li>All database connections are alive? Backgroundrb down again?</li>
<li>The cloud computing setup jacked the imagemagick? Again?</li>
<li>You are running out of disk space and there are no more file descriptors for your</li>
<li>The git SHA and version is correct</li>
<p style="text-align: center;"><img class="size-medium wp-image-604 aligncenter" title="Screen shot 2009-12-06 at 12.29.53 AM" src="http://www.snowgiraffe.com/tech/wp-content/uploads/2009/12/Screen-shot-2009-12-06-at-12.29.53-AM-300x100.png" alt="Screen shot 2009-12-06 at 12.29.53 AM" width="300" height="100" /></p>
</ul>
<p><a href="http://github.com/blythedunham/health_monitor" target="_blank">Health Monitor</a> adds a single controller action to generate an html, js, or xml report with details of <strong>all</strong> your custom defined health checks. An error response code (500 server error) indicates failure when any monitored feature fails or exceeds the custom timeout definition. <a href="http://www.snowgiraffe.com/tech/599/health-monitor/" target="_blank">Health monitor</a> is easier to setup than custom server side cron tasks and adds the advantage of exercising more code since everything from your load balancer to nginx to mongrels must be happily shoving rubies around to get that 200 oh boy success message. So ping away, grab a beer and know that hey, you might be too drunk but at least you will know your application is sick before your clients do.</p>
<h2><strong>Install</strong></h2>
<pre>sudo gem install health_monitor --source=http://gemcutter.org

config.gem :health_monitor, :source =&gt; http://gemcutter.org</pre>
<h2><strong>Create a the health monitor controller<br />
</strong></h2>
<pre>script/generate health_monitor</pre>
<h2><strong>Add your customizations</strong></h2>
<pre class="ruby">  <span class="keyword">class </span><span class="class">HealthMonitorController</span> <span class="punct">&lt;</span> <span class="constant">ApplicationController</span>
    <span class="ident">acts_as_health_monitor</span>

    <span class="comment">#More examples available at http://github.com/blythedunham/health_monitor</span>
    <span class="comment">#Built in checks</span>
    <span class="ident">monitor_health</span> <span class="symbol">:schema_check</span><span class="punct">,</span> <span class="symbol">:database_check</span><span class="punct">,</span> <span class="symbol">:ey_agent_check</span>

    <span class="comment">#monitor specified process</span>
    <span class="ident">monitor_process</span> <span class="symbol">:monit</span> 

    <span class="comment"># Custom monitor task</span>
    <span class="ident">monitor_health</span> <span class="symbol">:email</span><span class="punct">,</span> <span class="symbol">:description</span> <span class="punct">=&gt;</span> <span class="punct">'</span><span class="string">send an email</span><span class="punct">'</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">controller</span><span class="punct">|</span>
      <span class="constant">ActionMailer</span><span class="punct">::</span><span class="constant">Base</span><span class="punct">.</span><span class="ident">deliver_my_mail</span><span class="punct">('</span><span class="string">blah</span><span class="punct">')</span>
    <span class="keyword">end</span>
  <span class="keyword">end
</span></pre>
<h2>Routes</h2>
<p>Routes are automatically generated:<br />
http://localhost:3000/health_monitor<br />
http://localhost:3000/health_monitor.js</p>
<p>Monitor specific tasks or skip tasks with the parameters <strong>skip</strong> and <strong>only</strong><br />
http://localhost:3000/health_monitor?only=schema_check,database_check<br />
http://localhost:3000/health_monitor?skip=email,database_check</p>
]]></content:encoded>
			<wfw:commentRss>http://www.snowgiraffe.com/tech/599/health-monitor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
