<?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>Brain Matters &#187; unix</title>
	<atom:link href="http://blog.agoragames.com/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.agoragames.com</link>
	<description></description>
	<lastBuildDate>Thu, 29 Jul 2010 19:13:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Watching Trees</title>
		<link>http://blog.agoragames.com/2010/02/23/watching-trees/</link>
		<comments>http://blog.agoragames.com/2010/02/23/watching-trees/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 13:43:00 +0000</pubDate>
		<dc:creator>Jason LaPorte</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[arcana]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=474</guid>
		<description><![CDATA[As a SysAdmin, my job more-or-less exists by knowing miscellaneous arcana that most software engineers aren&#8217;t aware of.
When a particular co-worker here at Agora has a problem with his Linux machine, I provide advice and show him how to fix it. Some months after he had joined Agora, I discovered that after each troubleshooting session, [...]]]></description>
			<content:encoded><![CDATA[<p>As a SysAdmin, my job more-or-less exists by knowing miscellaneous arcana that most software engineers aren&#8217;t aware of.</p>
<p>When a particular co-worker here at Agora has a problem with his Linux machine, I provide advice and show him how to fix it. Some months after he had joined Agora, I discovered that after each troubleshooting session, he copy-and-pastes the entire text terminal log into a text file that he keeps on his desktop. He has dozens of transcripts at this point; I bet if I were to look through it, it would read something like the Tao te Ching or Bhagavad Gita, only concerning UNIX instead of right living.</p>
<p>(Of course, there&#8217;s not much of a difference between UNIX and right living, but that&#8217;s a topic for another day.)</p>
<p>In the spirit of allowing you to build your own little collection, here is a simple trick that came in handy to me yesterday.</p>
<p><span id="more-474"></span>Last night, the cron jobs powering one of our managed sites stopped running. I had stopped them, cleaned up, and restarted them, but I wanted to watch the system and see if they had started running again so I could monitor that they were doing their job.</p>
<p>UNIX has a well-known command called &#8220;<a href="http://linux.die.net/man/1/top" target="_blank">top</a>,&#8221; which shows superlative processes running on your system: which ones are consuming the most CPU time, which ones are consuming the most RAM, which ones have been running the longest, and so on. It&#8217;s a very useful tool, but if you&#8217;re trying to track down processes over time that don&#8217;t necessarily consume very many resources, then it&#8217;s not the tool you&#8217;re looking for.</p>
<p>However, our Linux distribution (and, indeed, most others) provide a useful graphical tool for mapping the current state of the system: &#8220;<a href="http://linux.die.net/man/1/pstree" target="_blank">pstree</a>.&#8221; This command will give you a list of processes (much like the &#8220;<a href="http://linux.die.net/man/1/ps" target="_blank">ps</a>&#8221; command), except that instead of generating a list, it will draw a little tree showing the state of the system. This is perfect for seeing exactly what is going on: which daemons are running, who is on the system and what they&#8217;re executing, and so on. However, it doesn&#8217;t show you what is happening over time; it merely lists what is happening at this moment.</p>
<p>However, our Linux distribution (and, indeed, most others) provides yet another useful tool: &#8220;<a href="http://linux.die.net/man/1/watch" target="_blank">watch</a>.&#8221; It runs a program every 2 seconds (by default) and displays the result to your screen. This allows you to make a ghetto clock by writing something like &#8220;watch <a href="http://linux.die.net/man/1/date" target="_blank">date</a>;&#8221; in our case, we could make a ghetto graphical &#8220;top&#8221; by writing the simple &#8220;watch pstree.&#8221; You can now watch your virtual trees rustle in the wind.</p>
<p>It kept us on top of the cron job, and things were back to normal in no time.</p>
<p>For more information, RTFM. :)</p>




	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fwatching-trees%2F&amp;title=Watching%20Trees" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fwatching-trees%2F&amp;title=Watching%20Trees&amp;bodytext=As%20a%20SysAdmin%2C%20my%20job%20more-or-less%20exists%20by%20knowing%20miscellaneous%20arcana%20that%20most%20software%20engineers%20aren%27t%20aware%20of.%0D%0A%0D%0AWhen%20a%20particular%20co-worker%20here%20at%20Agora%20has%20a%20problem%20with%20his%20Linux%20machine%2C%20I%20provide%20advice%20and%20show%20him%20how%20to%20fix%20it.%20So" title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fwatching-trees%2F&amp;title=Watching%20Trees&amp;notes=As%20a%20SysAdmin%2C%20my%20job%20more-or-less%20exists%20by%20knowing%20miscellaneous%20arcana%20that%20most%20software%20engineers%20aren%27t%20aware%20of.%0D%0A%0D%0AWhen%20a%20particular%20co-worker%20here%20at%20Agora%20has%20a%20problem%20with%20his%20Linux%20machine%2C%20I%20provide%20advice%20and%20show%20him%20how%20to%20fix%20it.%20So" title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2010%2F02%2F23%2Fwatching-trees%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2010/02/23/watching-trees/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RailsConf Wrap Up</title>
		<link>http://blog.agoragames.com/2009/05/29/railsconf-wrap-up/</link>
		<comments>http://blog.agoragames.com/2009/05/29/railsconf-wrap-up/#comments</comments>
		<pubDate>Fri, 29 May 2009 17:42:50 +0000</pubDate>
		<dc:creator>Jason LaPorte</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[monit]]></category>
		<category><![CDATA[overlord]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[railsconf]]></category>
		<category><![CDATA[rrd]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://blog.agoragames.com/?p=281</guid>
		<description><![CDATA[Well, we&#8217;re back from Vegas! And have been, for a couple weeks&#8230; I&#8217;ve been meaning to put up some follow-up resources for my talk (PWN Your Infrastructure: Behind Call of Duty: World at War), but there was just so much work to do when I got back&#8230; such is the life of a system administrator!
That said, I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Well, we&#8217;re back from Vegas! And have been, for a couple weeks&#8230; I&#8217;ve been meaning to put up some follow-up resources for my talk (<em>PWN Your Infrastructure: Behind Call of Duty: World at War</em>), but there was just so much work to do when I got back&#8230; such is the life of a system administrator!</p>
<p>That said, I&#8217;ve got some free moments, so I&#8217;m putting up some reference materials.</p>
<p><span id="more-281"></span></p>
<p>Anyway, for those who didn&#8217;t see it, my talk was about the cloud infrastructure we built to power the <a href="http://callofduty.com/" target="_blank">Call of Duty stats site</a>, and the tools we built to support that. The slides from the talk are available <a href="http://files.agoragames.com/jason/railsconf09/" target="_blank">here</a>, though they probably don&#8217;t mean too much without the audio behind them.</p>
<p>The puzzle pieces I talked about were:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Cloud_computing" target="_blank">Virtualization</a>, which allowed us to not have to worry about hardware failures (and gave us a lot of flexibility unrelated to scaling, such as being able to instantly clone a test environment, do some testing, and shut it back down, for virtually no cost). <a href="http://www.terremark.com/" target="_blank">Terremark</a> is our awesome hosting provider.</li>
<li><a href="http://en.wikipedia.org/wiki/Network_File_System_(protocol)" target="_self">NFS</a>, which allowed us to do away with complicated tools like <a href="http://www.capify.org/" target="_blank">Capistrano</a> and avoid managing server installations separately. It&#8217;s been around for 25 years, so it&#8217;s stable, and it&#8217;s also dead simple. Unfortunately, it is not suitable for tasks requiring heavy IO or a very large number of files, so it must be used with care.</li>
<li><a href="http://mmonit.com/monit/" target="_blank">Monit</a>, which allowed us to monitor our hosts and automatically fix certain problems (such as application failures) without requiring human intervention. As mentioned in the slides, if you want to pull XML from Monit (which we do to aggregate data from all of our hosts), the URL or doing so is &#8220;/_status?format=xml&#8221;. <em>This behavior is not documented.</em></li>
<li>Overlord, a simple internal tool that distributes server configuration and aggregates monitoring information from each Monit instance. Overlord is currently proprietary, but we&#8217;re considering releasing it once it&#8217;s ready (read: once it&#8217;s properly documented). But it&#8217;s really simple. It basically says what files should be on which servers (all of which are just simple text files), and they&#8217;re placed there on boot. Any files put into a particular directory are run as scripts. After that, it&#8217;s just a big cron job to pull XML from all of our servers and make pretty graphs.</li>
<li><a href="http://oss.oetiker.ch/rrdtool/" target="_blank">RRDTool</a>, which has many uses, but specifically makes the aforementioned pretty graphs. These are vital to determine trends and validate results. Also, they&#8217;re really pretty. Double also, RRDTool is extremely well constructed and totally awesome.</li>
<li>Using shell scripts everywhere. Thanks to using NFS, Monit, and Overlord, our distribution needs are already taken care of, so we can do a <strong>lot</strong> via simple shell scripts, which makes our infrastructure self-documenting and easy to work with. The simplest example of this is that we switched to deploying our applications with shell scripts, instead of using Capistrano or other network tools.</li>
</ul>
<p>The end result is a scalable system that, while it still has a few warts we&#8217;re working through, is very simple, self-documenting, and easy for even a non-sys-admin to diagnose and solve problems on&#8211;there&#8217;s very little magic here, just some elegant abstractions.</p>
<p>Some people were interested in getting some more information on our deploy scripts, so I&#8217;ve made them <a href="http://files.agoragames.com/jason/deploy/" target="_blank">available online</a>. They come in two parts: &#8220;core.sh&#8221; defines the core set of functionality, for logging, rollbacks, and some basic &#8220;here&#8217;s how you deploy Rails 101&#8243; functions. &#8220;deploy.sh&#8221; actually performs the deploy itself, and is the script that should be executed.</p>
<p>All told, we had a blast, and are looking forward to future RailsConfs!</p>




	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.agoragames.com%2F2009%2F05%2F29%2Frailsconf-wrap-up%2F&amp;title=RailsConf%20Wrap%20Up" title="Reddit"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.agoragames.com%2F2009%2F05%2F29%2Frailsconf-wrap-up%2F&amp;title=RailsConf%20Wrap%20Up&amp;bodytext=Well%2C%20we%27re%20back%20from%20Vegas%21%20And%20have%20been%2C%20for%20a%20couple%20weeks...%C2%A0I%27ve%20been%20meaning%20to%20put%20up%20some%20follow-up%20resources%20for%20my%20talk%20%28PWN%20Your%20Infrastructure%3A%20Behind%20Call%20of%20Duty%3A%20World%C2%A0at%20War%29%2C%20but%20there%20was%20just%20so%20much%20work%20to%20do%20when%20I%20got%20back.." title="Digg"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.agoragames.com%2F2009%2F05%2F29%2Frailsconf-wrap-up%2F&amp;title=RailsConf%20Wrap%20Up&amp;notes=Well%2C%20we%27re%20back%20from%20Vegas%21%20And%20have%20been%2C%20for%20a%20couple%20weeks...%C2%A0I%27ve%20been%20meaning%20to%20put%20up%20some%20follow-up%20resources%20for%20my%20talk%20%28PWN%20Your%20Infrastructure%3A%20Behind%20Call%20of%20Duty%3A%20World%C2%A0at%20War%29%2C%20but%20there%20was%20just%20so%20much%20work%20to%20do%20when%20I%20got%20back.." title="del.icio.us"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.agoragames.com%2F2009%2F05%2F29%2Frailsconf-wrap-up%2F" title="Technorati"><img src="http://blog.agoragames.com/wp-content/plugins/var/www/waxer-blog/shared/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.agoragames.com/2009/05/29/railsconf-wrap-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->