<?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>Jeff McReynolds</title>
	<atom:link href="http://jeffmcreynolds.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jeffmcreynolds.com</link>
	<description></description>
	<lastBuildDate>Mon, 22 Apr 2013 19:49:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Jan Runs, So Far.</title>
		<link>http://jeffmcreynolds.com/2013/01/26/jan-runs-so-far/</link>
		<comments>http://jeffmcreynolds.com/2013/01/26/jan-runs-so-far/#comments</comments>
		<pubDate>Sat, 26 Jan 2013 01:34:17 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=970</guid>
		<description><![CDATA[&#160; Click to Make Big &#160;]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p>Click to Make Big</p>
<p><a href="http://jeffmcreynolds.com/2013/01/26/jan-runs-so-far/screen-shot-2013-01-25-at-7-21-17-pm/" rel="attachment wp-att-971"><img alt="Screen Shot 2013-01-25 at 7.21.17 PM" src="http://jeffmcreynolds.com/wp-content/uploads/2013/01/Screen-Shot-2013-01-25-at-7.21.17-PM-300x159.png" width="300" height="159" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2013/01/26/jan-runs-so-far/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Think HIIT is Working!</title>
		<link>http://jeffmcreynolds.com/2013/01/20/i-think-hiit-is-working/</link>
		<comments>http://jeffmcreynolds.com/2013/01/20/i-think-hiit-is-working/#comments</comments>
		<pubDate>Sun, 20 Jan 2013 19:59:15 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[HIIT]]></category>
		<category><![CDATA[Runs]]></category>
		<category><![CDATA[#runs]]></category>
		<category><![CDATA[HIIT Runs]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=963</guid>
		<description><![CDATA[Progress on HIIT runs for the past 3 weeks: (click to enlarge)]]></description>
				<content:encoded><![CDATA[<p>Progress on HIIT runs for the past 3 weeks:</p>
<p>(click to enlarge)</p>
<p><a href="http://jeffmcreynolds.com/2013/01/20/i-think-hiit-is-working/hiit/" rel="attachment wp-att-964"><img class="alignleft  wp-image-964" alt="HIIT" src="http://jeffmcreynolds.com/wp-content/uploads/2013/01/HIIT-300x27.png" width="300" height="27" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2013/01/20/i-think-hiit-is-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blues and Brews 10 miler (Kansas City)</title>
		<link>http://jeffmcreynolds.com/2012/10/05/blues-and-brews-10-miler-kansas-city/</link>
		<comments>http://jeffmcreynolds.com/2012/10/05/blues-and-brews-10-miler-kansas-city/#comments</comments>
		<pubDate>Fri, 05 Oct 2012 11:45:59 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[Blues and Brews]]></category>
		<category><![CDATA[Runs]]></category>
		<category><![CDATA[#runs]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=897</guid>
		<description><![CDATA[I&#8217;m Back! It&#8217;s been 3 years and 4 months since I last completed a race where bling was involved.  It&#8217;s also been 2 years and 1 month since I had knee surgery.  Even 9 months ago I wasn&#8217;t sure I was going to be able to run anymore.  Ben Marx (@marxbj) and a rolling pin [...]]]></description>
				<content:encoded><![CDATA[<p><strong><a href="http://jeffmcreynolds.com/2012/10/05/blues-and-brews-10-miler-kansas-city/home_page_logo/" rel="attachment wp-att-899"><img class="alignleft size-medium wp-image-899" style="border: 0px; margin: 10px 20px;" title="home_page_logo" src="http://jeffmcreynolds.com/wp-content/uploads/2012/10/home_page_logo-300x190.png" alt="" width="168" height="106" /></a>I&#8217;m Back!</strong></p>
<p>It&#8217;s been 3 years and 4 months since I last completed a race where bling was involved.  It&#8217;s also been 2 years and 1 month since I had knee surgery.  Even 9 months ago I wasn&#8217;t sure I was going to be able to run anymore.  Ben Marx (@marxbj) and a rolling pin got me past the first hump of atrophied muscles around my knee and the rest has just been trying to keep a schedule with the rest of life&#8217;s happenings.</p>
<p>It was a great race to come back to.  700 runners and a concert (Blues Traveller) with beer waiting at the finish (video below).   I totally can&#8217;t wait to do this one again next year.  Absolutely perfect weather, 7am start and about 58 degrees.</p>
<p><strong>Video:</strong></p>
<p>Video Note: Don&#8217;t get distracted by the bald guy,  you&#8217;re supposed to be watching the music.</p>
<p><a href="http://www.youtube.com/watch?feature=player_embedded&amp;v=AtM9FKPUlfg">Kansas City Blues and Brews (Blues Traveller)</a></p>
<p><strong>Bling:</strong></p>
<p><a href="http://jeffmcreynolds.com/2012/10/05/blues-and-brews-10-miler-kansas-city/photo/" rel="attachment wp-att-898"><img class="alignleft size-medium wp-image-898" title="photo" src="http://jeffmcreynolds.com/wp-content/uploads/2012/10/photo-140x300.jpg" alt="" width="140" height="300" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>The Run:</strong><br />
<iframe src="http://connect.garmin.com:80/activity/embed/228547056" frameborder="0" width="465" height="548"></iframe><br />
&nbsp;<br />
Next stop is The North Face half in KC! 11/16/12</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2012/10/05/blues-and-brews-10-miler-kansas-city/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>September Workouts and Runs.</title>
		<link>http://jeffmcreynolds.com/2012/10/05/september-workouts-and-runs/</link>
		<comments>http://jeffmcreynolds.com/2012/10/05/september-workouts-and-runs/#comments</comments>
		<pubDate>Fri, 05 Oct 2012 11:08:47 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[Runs]]></category>
		<category><![CDATA[walk]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=890</guid>
		<description><![CDATA[Total Miles: 110.48]]></description>
				<content:encoded><![CDATA[<p>Total Miles: 110.48</p>
<p><a href="http://jeffmcreynolds.com/2012/10/05/september-workouts-and-runs/screen-shot-2012-10-05-at-6-07-31-am/" rel="attachment wp-att-891"><img class="alignleft size-medium wp-image-891" title="Screen Shot 2012-10-05 at 6.07.31 AM" src="http://jeffmcreynolds.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-05-at-6.07.31-AM-300x166.png" alt="" width="450" height="250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2012/10/05/september-workouts-and-runs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>August Workouts and Runs.</title>
		<link>http://jeffmcreynolds.com/2012/10/05/august-workouts-and-runs/</link>
		<comments>http://jeffmcreynolds.com/2012/10/05/august-workouts-and-runs/#comments</comments>
		<pubDate>Fri, 05 Oct 2012 11:06:17 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[Runs]]></category>
		<category><![CDATA[walk]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=886</guid>
		<description><![CDATA[Total Miles: 52.67]]></description>
				<content:encoded><![CDATA[<p>Total Miles: 52.67</p>
<p><a href="http://jeffmcreynolds.com/2012/10/05/august-workouts-and-runs/screen-shot-2012-10-05-at-6-04-45-am/" rel="attachment wp-att-887"><img class="alignleft size-medium wp-image-887" title="Screen Shot 2012-10-05 at 6.04.45 AM" src="http://jeffmcreynolds.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-05-at-6.04.45-AM-300x167.png" alt="" width="450" height="250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2012/10/05/august-workouts-and-runs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>July Workouts and Runs.</title>
		<link>http://jeffmcreynolds.com/2012/10/05/july-workouts-and-runs/</link>
		<comments>http://jeffmcreynolds.com/2012/10/05/july-workouts-and-runs/#comments</comments>
		<pubDate>Fri, 05 Oct 2012 11:03:03 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[Runs]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=879</guid>
		<description><![CDATA[Total Miles: 37.62]]></description>
				<content:encoded><![CDATA[<p>Total Miles: 37.62</p>
<p><a href="http://jeffmcreynolds.com/2012/10/05/july-workouts-and-runs/screen-shot-2012-10-05-at-5-55-30-am/" rel="attachment wp-att-880"><img class="alignleft size-medium wp-image-880" title="Screen Shot 2012-10-05 at 5.55.30 AM" src="http://jeffmcreynolds.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-05-at-5.55.30-AM-300x168.png" alt="" width="450" height="250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2012/10/05/july-workouts-and-runs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>June Workouts and Runs.</title>
		<link>http://jeffmcreynolds.com/2012/07/14/june-workouts-and-runs/</link>
		<comments>http://jeffmcreynolds.com/2012/07/14/june-workouts-and-runs/#comments</comments>
		<pubDate>Sat, 14 Jul 2012 16:39:26 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[Runs]]></category>
		<category><![CDATA[#monthly]]></category>
		<category><![CDATA[#runs]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=866</guid>
		<description><![CDATA[Total Miles: 53.69 &#160; &#160; &#160;]]></description>
				<content:encoded><![CDATA[<p>Total Miles: 53.69</p>
<p>&nbsp;</p>
<p><a href="http://jeffmcreynolds.com/2012/07/14/june-workouts-and-runs/screen-shot-2012-07-14-at-11-30-33-am/" rel="attachment wp-att-867"><img class="alignleft size-medium wp-image-867" title="Screen Shot 2012-07-14 at 11.30.33 AM" src="http://jeffmcreynolds.com/wp-content/uploads/2012/07/Screen-Shot-2012-07-14-at-11.30.33-AM-300x165.png" alt="" width="450" height="250" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2012/07/14/june-workouts-and-runs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GIT and MAMP on the Mac with Virtual Hosts</title>
		<link>http://jeffmcreynolds.com/2012/01/26/git-and-mamp-on-the-mac-with-virtual-hosts/</link>
		<comments>http://jeffmcreynolds.com/2012/01/26/git-and-mamp-on-the-mac-with-virtual-hosts/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 01:40:50 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[GIT]]></category>
		<category><![CDATA[MAMP]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=774</guid>
		<description><![CDATA[This is really just a cheat sheet for me moving forward, I&#8217;ve been through this 3 times in the last 2 months, each time figuring I wouldn&#8217;t need to do it again. So here it is: 1.) Installing GIT - Download the correct version of GIT from here - Run the pkg you downloaded - [...]]]></description>
				<content:encoded><![CDATA[<p>This is really just a cheat sheet for me moving forward, I&#8217;ve been through this 3 times in the last 2 months, each time figuring I wouldn&#8217;t need to do it again. So here it is:</p>
<p><strong>1.) Installing GIT</strong></p>
<p>- Download the correct version of GIT from <a title="GIT for Mac" href="http://www.crainbandy.com/how-to/how-to-install-git-on-mac-os-x-leopard-snow-leopard" target="_blank">here</a></p>
<p>- Run the pkg you downloaded</p>
<p>- From the terminal navigate to /Volumes/Git 1.7.8.3 Snow Leopard Intel Universal</p>
<p>- Run the install script: setup git PATH for non-terminal programs.sh</p>
<p>- Open a new terminal and you&#8217;re good to go.</p>
<p><strong>2.) Installing MAMP</strong></p>
<p>- Download MAMP from <a title="MAMP" href="http://mamp.info/en/index.html" target="_blank">here</a> (Be patient, it&#8217;s big).</p>
<p>- Open the .zip and double click the MAMP.pkg in the following window.</p>
<p>- Walk through the MAMP install screens.</p>
<p>- You&#8217;ll find the program in Applications in it&#8217;s own folder, I usually dock it.</p>
<p>- When you click the icon it will open a control program as well as a web page with some good MAMP detail on it.</p>
<p>- The control panel will let you start and stop MySQL and Apache, though it&#8217;s not always perfect.</p>
<p><strong>3.) Adding a virtual host to your MAMP config.</strong></p>
<p>- Add an entry to your local hosts file for the domain you want to work with</p>
<p>127.0.0.1 me2.com www.me2.com</p>
<p>- Navigate to: /Applications/MAMP/conf/apache</p>
<p>- Edit the httpd.conf file in this directory</p>
<p>- At the bottom of the file add the following:</p>
<pre>NameVirtualHost *

&lt;VirtualHost * &gt;
    DocumentRoot /var/www/html/me2.com
    ServerName me2.com
    ServerAlias www.me2.com
    &lt;Directory /var/www/html/me.com&gt;
        Allow from all
        Options -MultiViews
    &lt;/Directory&gt;
    ErrorLog /Applications/MAMP/logs/me2.com-errors
    CustomLog /Applications/MAMP/logs/me2.com-access combined
&lt;/VirtualHost&gt;</pre>
<pre>You'd change all the 'me2.com' instances to whatever you want them to be, and the ErrorLog and CustomLog to
wherever you want them to go.</pre>
<pre>- Next you'd need to make the directories above to hold your web files. In my case it would look like this:</pre>
<pre>mkdir -p /var/www/html/me2.com</pre>
<pre>- This should do it go back to your MAMP control panel and stop/start your servers.</pre>
<pre>4.) Troubleshooting</pre>
<pre>- Start/Stop Servers button is doing nothing on my MAMP control panel</pre>
<pre>If this happens you gotta get medieval on your box from the CLI.  Typically what I've found is there is a
config error somewhere and one service starts.. the other doesn't and the control panel thingy says neither
are running. So you have to manually kill each, find your error and try again.</pre>
<pre>Killing MySQL:</pre>
<pre>from the CLI do this:</pre>
<pre>ps -ef | grep mysqld | awk '{print $2}' | xargs kill -9</pre>
<pre>Killing Apache:</pre>
<pre>from the CLI do this:</pre>
<pre>ps -ef | grep httpd | awk '{print $2}' | xargs kill -9</pre>
<pre>- Apache won't start and there is nothing in the error logs</pre>
<pre>The apache default log is in /Applications/MAMP/logs/apache_error.log .. Always check it first.</pre>
<pre>If there is nothing useful there, run the binary on it's own and it will typically tell you why it's
not starting:</pre>
<pre>/Applications/MAMP/Library/bin/httpd</pre>
<pre>- I want Apache to run on port 80 in MAMP</pre>
<pre>To make this happen open your httpd.conf and search for "Listen". You'll see an entry that says "Listen 8888"
Add a second entry that says "Listen 80" directly under it.</pre>
<pre>Next you need to modify your virtual hosts config to look like the following:</pre>
<pre></pre>
<pre></pre>
<pre>NameVirtualHost *:80

&lt;VirtualHost *:80&gt;
    DocumentRoot /var/www/html/me2.com
    ServerName me2.com
    ServerAlias www.me2.com
    &lt;Directory /var/www/html/me.com&gt;
        Allow from all
        Options -MultiViews
    &lt;/Directory&gt;
    ErrorLog /Applications/MAMP/logs/me2.com-errors
    CustomLog /Applications/MAMP/logs/me2.com-access combined
&lt;/VirtualHost&gt;</pre>
<pre></pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2012/01/26/git-and-mamp-on-the-mac-with-virtual-hosts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Integrating IRC Into Your Monitoring Regime</title>
		<link>http://jeffmcreynolds.com/2011/08/21/integrating-irc-into-your-monitoring-regime/</link>
		<comments>http://jeffmcreynolds.com/2011/08/21/integrating-irc-into-your-monitoring-regime/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 05:10:15 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[aws]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=652</guid>
		<description><![CDATA[IRC is a great tool.  Beyond the world of networks out there, it&#8217;s also quite handy to use a private server within your organization.  For basically the last decade I have worked for companies that use internal IRC systems, or forced it on the ones that didn&#8217;t.  The ability to use channels for specific groups [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://jeffmcreynolds.com/2011/08/21/integrating-irc-into-your-monitoring-regime/irc/" rel="attachment wp-att-653"><img class="alignleft size-medium wp-image-653" style="margin: 15px;" title="IRC" src="http://jeffmcreynolds.com/wp-content/uploads/2011/08/IRC-300x173.png" alt="" width="270" height="156" /></a>IRC is a great tool.  Beyond the world of networks out there, it&#8217;s also quite handy to use a private server within your organization.  For basically the last decade I have worked for companies that use internal IRC systems, or forced it on the ones that didn&#8217;t.  The ability to use channels for specific groups of people as well as the company as a whole makes it a great means to quickly communicate.  Another great channel usage scenario is for monitoring.  We currently use a #monitor channel to allow the machines to talk to us even before the pager starts going off.  With Nagios for instance, when we get an exit(1), that message hits IRC alone.  It&#8217;s great for disk usage alerts an a lot of other stuff.  You don&#8217;t really want to get paged when you have 20% of your disk left, and email can never really be trusted.  It&#8217;s also good for catching small glitches in the network that may indicate bigger problems on the horizon. Ping timeouts that recover quickly and don&#8217;t make it to the pager and such.</p>
<p>Setting IRC up with Nagios is super easy, as somebody else has already done all the hard work.  There&#8217;s several apps out there but the one we&#8217;ve chosen and stuck with is <a title="Nagios IRC Bot" href="http://exchange.nagios.org/directory/Addons/Notifications/IRC/nagircbot/details">NagIRCBot</a>.  The configuration is as simple as installing it on your nagios server and sending the bot some parameters:</p>
<p>&nbsp;</p>
<div id="code">/usr/bin/nagircbot -f /var/nagios/status.dat -s 192.168.195.99:6668 -n WestCoast-Bot -p *PASSWORD* -c#monitor -S -i 5 -I 3600 -P /tmp/nagircbot.pid</div>
<p>In the example above we&#8217;ve pointed the bot to status.dat for it&#8217;s data (-f), set the server and port to connect to (-s), named our bot (-n), give it the IRC password (-p), told it which channel to live in (-c), set it to check every 5 seconds (-i), set a global status interval (-I) and given it a pid (-P).</p>
<p>Another option for one off monitors is using a raw PHP socket connection to scavenge for messages.  I used this recently in conjunction with a scrape of the AWS RSS status feeds.  Basically I scrape the feed and deposit new messages in a text file.  The PHP bot spins by every 10 seconds to check for new data and post to #monitor.  The PHP bot looks like this:</p>
<p>&nbsp;</p>
<div id="code">
<pre>

$socket = fsockopen("192.168.195.99", 6668);fputs($socket,"USER CM example.com CM :CM \n");
fputs($socket,"PASS *PASSWORD*\n");
fputs($socket,"NICK MSGBOT\n");
fputs($socket,"JOIN #monitor\n");
$count = 0;while(1) {
sleep(10);
fputs($socket, "PONG ".$ex[1]."\n");
$real_message = system("cat $alert_file");
$line_count = system("cat $alert_file | wc -l");
if($line_count &gt; 0){
$message = explode("\n", $real_message);
foreach ($message as $line){
fputs($socket, "PRIVMSG #monitor :$line\n");
sleep(2);
}
system("cp /dev/null $alert_file");}
}

</pre>
</div>
<p>That&#8217;s a hot little script, you can imagine the potential. Basically anything you can stick in the alert file gets dropped off in your IRC channel. At any rate, let your imagination run wild and I hope it helps you keep your systems up.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2011/08/21/integrating-irc-into-your-monitoring-regime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monit: The Cure for Crappy Software.</title>
		<link>http://jeffmcreynolds.com/2011/08/17/monit-the-cure-for-crappy-software/</link>
		<comments>http://jeffmcreynolds.com/2011/08/17/monit-the-cure-for-crappy-software/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 01:00:18 +0000</pubDate>
		<dc:creator>jeffm</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[monit]]></category>
		<category><![CDATA[mssql]]></category>

		<guid isPermaLink="false">http://jeffmcreynolds.com/?p=620</guid>
		<description><![CDATA[I currently manage more than 100 instances of Apache.  Mostly LAMP with some Ruby and Passenger thrown in here and there.  Of all these instances, I&#8217;ve never really had to concern myself with leaky apps that soak up memory and don&#8217;t give it back until restart.  The first  time I ran into this was with Mongrel, [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://jeffmcreynolds.com/2011/08/17/monit-the-cure-for-crappy-software/monit/" rel="attachment wp-att-621"><img class="size-full wp-image-621 alignright" style="margin: 20px;" title="monit" src="http://jeffmcreynolds.com/wp-content/uploads/2011/08/monit.jpg" alt="" width="206" height="126" /></a>I currently manage more than 100 instances of Apache.  Mostly LAMP with some Ruby and Passenger thrown in here and there.  Of all these instances, I&#8217;ve never really had to concern myself with leaky apps that soak up memory and don&#8217;t give it back until restart.  The first  time I ran into this was with Mongrel, what a terrible app.  At any rate, the cure for Mongrel was Monit.  It&#8217;s been at least 3 years since I&#8217;ve installed and used Monit, so I thought I&#8217;d write it up this time for my own reference and to maybe help somebody else.  I believe the culprit this time has something to do with MSSQL.  I knew I felt dirty when I first installed UNIXodbc and FreeTDS with the intent to allow PHP to connect to an MSSQL server.  Now I think I have my first piece of evidence that I have tainted the stack with the Microsoft evil.  These boxes were fine for more than a year until we introduced the MS evil last week.  Today, one of the boxes started randomly dumping curl calls to an upstream API.  One mind you, not both.  So an hour into testing gateways, and running stream checks in loops with Nagios monitors I thought, what the hell, I&#8217;ll HUP apache and pray that it doesn&#8217;t fix anything.  Sure enough, it did.  I didn&#8217;t check the memory usage before hand, as nothing said &#8220;You&#8217;re out of RAM&#8221; but I started watching it afterward and saw it trickling away.  So the short term solution is to use Monit to restart these Apache instances when the memory usage by Apache gets to high.  So lets get on with it.</p>
<p>You can download the Monit source from <a title="Monit Download" href="http://mmonit.com/monit/download/">here</a></p>
<p>I chose to take the sissy route with my CentOS 5.5 loads and add a repo where I knew a good package lives.  So I ran this:</p>
<div id="code">rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-5.noarch.rpm</div>
<p>Once you load up that repo, just run a yum to install Monit:</p>
<div id="code">yum -y install monit</div>
<p>Monit will install an init script, and a monit.conf file that is packed full of instructions for getting started. Some quick config options to start with:</p>
<div id="code">set daemon 120 # Poll at 2 minute intervals<br />
set mailserver mail.yourserver.com #ensure you get alerts when events occur<br />
set mail-format { from: monit@foo.bar } # Change the from user from root (gmail)<br />
set alert sysadm@foo.bar # set the email for all alerts<br />
set httpd port 2812 and allow admin:monit # Setup the Admin web interface with user and pass</div>
<p>Next we need to configure a service. First I want to check Apache memory usage after a fresh restart to get a baseline. Here&#8217;s a handy little one liner to do that:</p>
<div id="code">ps -o rss -C httpd | tail -n +2 | (sed &#8216;s/^/x+=/&#8217;; echo x) | bc</div>
<p>In my case, I&#8217;m using about 130MB. I&#8217;m going to set my threshold at 150MB. There will be plenty of time after setup to tweak these numbers. Next we&#8217;ll configure a basic process in Monit that will tell it to restart Apache if we cross the 150MB mark. Here&#8217;s what it will look like:</p>
<div id="code">check process apache with pidfile /usr/local/apache/logs/httpd.pid<br />
start program = &#8220;/etc/init.d/httpd start&#8221;<br />
stop program = &#8220;/etc/init.d/httpd stop&#8221;<br />
if totalmem &gt; 150.0 MB for 5 cycles then restart</div>
<p>This is a very very simple configuration for Monit, it does much more, but this is where we&#8217;ll start. Basically I&#8217;ve given monit the pid file for my Apache process, my start and stop commands, and I&#8217;ve told it that if Apache&#8217;s total memory consumption is greater than 150MB for 10 minutes, that it needs a restart.</p>
<p>Once this is set, fire up Monit from init.d:</p>
<div id="code">/etc/init.d/monit start</div>
<p>Once it&#8217;s up, you can start watching from the web interface: http://yourserverip:2812.<br />
Login with the credentials you set in the configuration file. Mine looks like this:</p>
<p><em>(click to enlarge)</em></p>
<p><a href="http://jeffmcreynolds.com/2011/08/17/monit-the-cure-for-crappy-software/monit-small/" rel="attachment wp-att-640"><img class="size-medium wp-image-640 alignleft" title="monit-small" src="http://jeffmcreynolds.com/wp-content/uploads/2011/08/monit-small-300x149.png" alt="" width="300" height="149" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>So you can see, Monit is doing exactly what we told it to do. I&#8217;m going to stop here for now, but again, there is a whole lot more you can do with this app. From CPU utilization per process, to overall load, to alerts on file permissions. It&#8217;s really more functional than I remembered it being. The sad thing is, I&#8217;m only using it right now to compensate for other issues, duct tape if you will. Oh well, tomorrow I&#8217;ll be looking at linux mssql driver solutions. MS Evil.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmcreynolds.com/2011/08/17/monit-the-cure-for-crappy-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
