<?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>Nuclear Rooster &#187; Uncategorized</title>
	<atom:link href="http://dev.nuclearrooster.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.nuclearrooster.com</link>
	<description></description>
	<lastBuildDate>Thu, 22 Dec 2011 17:43:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Sublime Text 2 Whitespace Plugin</title>
		<link>http://dev.nuclearrooster.com/2011/12/22/sublime-text-2-whitespace-plugin/</link>
		<comments>http://dev.nuclearrooster.com/2011/12/22/sublime-text-2-whitespace-plugin/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 17:43:28 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=766</guid>
		<description><![CDATA[I've recently ditched Textmate in favor of Sublime Text 2. I've also recently shelved Ruby for Python, and it's pretty cool to be able to whip together some python to extend my editor. There are some tutorials for creating plugins and decent documentation, but sometimes code is worth a thousand words. I found a nice [...]]]></description>
			<content:encoded><![CDATA[<p>I've recently ditched Textmate in favor of <a href="http://www.sublimetext.com/2">Sublime Text 2</a>.  I've also recently shelved Ruby for Python, and it's pretty cool to be able to whip together some python to extend my editor.  There are some <a href="http://net.tutsplus.com/tutorials/python-tutorials/how-to-create-a-sublime-text-2-plugin/">tutorials</a> for creating plugins and <a href="http://www.sublimetext.com/docs/2/">decent documentation</a>, but sometimes code is worth a thousand words.  </p>
<p>I found a <a href="https://github.com/ehamiter/Sublime-Text-2-Plugins">nice set of plugins</a> on github from <a href="https://github.com/ehamiter">ehamiter</a> to get started with.  It's pretty easy to get the swing of things, just be prepared for a few infinite loops and force closing your editor!</p>
<p>Here's the whitespace plugin I came up with to handle three issues vital to my day-to-day development: 1) removing trailing whitespace, 2) expanding tabs, and 3) adding a single newline at the end of the file.</p>
<p>There is an out-of-the-box Sublime Text 2 command for expanding tabs, which I wanted to run on every save, so the <code>ExpandTabs</code> class is a simple pre-save handler that calls the command.  All three pre-save handlers check for a configuration settings (set via JSON preferences file), so if you don't use one it will still be light-weight.</p>
<p>This works for me, but a slightly cleaner model would be to create TextCommand actions, in addition to EventListeners that call the command, so you get the best of both worlds (call commands with key bindings, or enable event listeners).</p>
<p>To install, I simply clone to the repo into my packages directory, i.e. <code>git clone git@github.com:nstielau/Sublime-Text-2-Plugins.git /Users/nstielau/Library/Application Support/Sublime\ Text\ 2/Packages/nstielau</code>, and then can easily sync the plugins across workstations via github.</p>
<p><script src="http://gist-it.appspot.com/github/nstielau/Sublime-Text-2-Plugins/raw/master/whitespace.py"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/12/22/sublime-text-2-whitespace-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cloudkick Webhooks for Alert Trending and Jabber Notifications</title>
		<link>http://dev.nuclearrooster.com/2011/07/11/cloudkick-webhooks-for-alert-trending-and-jabber-notifications/</link>
		<comments>http://dev.nuclearrooster.com/2011/07/11/cloudkick-webhooks-for-alert-trending-and-jabber-notifications/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 14:03:23 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[grapite]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[monitoring]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=745</guid>
		<description><![CDATA[Like every monitoring solution around, Cloudkick isn't perfect. I think it's overpriced and has too much logic integrated into the web-app UI. Cloudkick does OK, just something lacking in the warm-fuzzies department. Digging into Cloudkick's Webhooks, it proves extensible enough to add some useful functionality. The worst thing a monitoring solution can try to do [...]]]></description>
			<content:encoded><![CDATA[<p>Like every <a href="https://twitter.com/#!/search/%23monitoringsucks">monitoring solution around</a>, <a href="http://www.cloudkick.com">Cloudkick</a> isn't perfect.  I think it's overpriced and has too much logic integrated into the web-app UI.   Cloudkick does OK, just something lacking in the warm-fuzzies department.  Digging into <a href="https://support.cloudkick.com/Addresses">Cloudkick's Webhooks</a>, it proves extensible enough to add some useful functionality.  The worst thing a monitoring solution can try to do is to solve <em>every</em> monitoring/alerting problem, and webhooks are a great model for adding decoupled features.</p>
<p>Two features high on my list were trending alerts ("It seems like these damn alerts are going off CONSTANTLY!") and adding Jabber notifications for alerts I didn't care about quite enough to land in my inbox.</p>
<p>Here's a small Sinatra app that makes these possible:</p>
<p><script src="https://gist.github.com/1075871.js?file=cloudkick_webhook_handlers.rb"></script></p>
<p>Run the Sinatra app somewhere (bug me and I'll release a chef cookbook for it), and add the URL as a new webhook 'Address' in Cloudkick, and then select it for all applicable 'Monitors'.</p>
<p>To test the webhook, save the example payload to a file:</p>
<p><script src="https://gist.github.com/1075871.js?file=alert_payload.json"></script></p>
<p>And use CURL to test:</p>
<p><script src="https://gist.github.com/1075871.js?file=test_webhook.sh"></script></p>
<p>Here's what the graphite graph starts to look like after a few days (using Graphite's drawNonZeroAsInfinite() data function).</p>
<p><img src="http://dev.nuclearrooster.com/wp-content/uploads/2011/07/cloudkick_to_graphite_alerts.png" alt="" title="cloudkick_to_graphite_alerts" width="586" height="308" class="aligncenter size-full wp-image-746" /></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/07/11/cloudkick-webhooks-for-alert-trending-and-jabber-notifications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greppin&#8217; with Knife</title>
		<link>http://dev.nuclearrooster.com/2011/06/30/greppin-logs-with-knife/</link>
		<comments>http://dev.nuclearrooster.com/2011/06/30/greppin-logs-with-knife/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 21:54:45 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=727</guid>
		<description><![CDATA["Got tight last night on absinthe and did knife tricks." -Hemingway Taking some inspiration from good ol' Ernest, I got tight on Tecate last night and did knife tricks. Check 'em out. Grep remote logs across multiple machines Tail and selectively grep logs across multiple nodes, streaming to your console: Sort nodes across a role [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float:left;padding: 10px;" src="http://dev.nuclearrooster.com/wp-content/uploads/2011/06/hemmingway.jpg" alt="" title="hemmingway" width="150" /></p>
<blockquote style="font-size:22px;width:500px;"><p>"Got tight last night on absinthe and did knife tricks." -Hemingway</p></blockquote>
<p><br style="clear:both;"/></p>
<p>Taking some inspiration from good ol' Ernest, I got tight on Tecate last night and did knife tricks.  Check 'em out.</p>
<h2>Grep remote logs across multiple machines</h2>
<p>Tail and selectively grep logs across multiple nodes, streaming to your console:</p>
<pre class="brush: bash; title: ; notranslate">
# Look for 502's in Nginx
knife ssh 'role:load_balancer' 'tail -f /var/log/nginx/*.log | grep 502' 

# Tail the web app logs across all servers.
knife ssh 'role:web_app' 'tail -f /opt/web_app/logs/production.log' 

#
</pre>
<h2>Sort nodes across a role</h2>
<p>Get a glance at the state of servers with a particular role:</p>
<pre class="brush: bash; title: ; notranslate">
# Sort by 5min load average
knife ssh 'role:transcoder' 'cat /proc/loadavg | awk &quot;{print $2}&quot;' | sort -n -k 2

# Sort by uptime
knife ssh 'role:web_app' 'uptime' | sort -n -k 4

#
</pre>
<p>The other day I had the pleasure of asking Adam Jacob and Chris Brown a few questions about Chef.  Chef as a tool is great, but technical changes are easier than cultural changes, since a single person can implement technical change while the entire team has to buy in to cultural change.  Handing off Chef to the dev team, I had a question for Adam and Chris: <strong>"Should everybody on the team learn knife?"</strong>.  Their answer was <strong>"Yes."</strong>  Nobody wants to learn a new tool just for the sake of it, but knife has some pretty awesome capabilities, and learning a little might go a long way.</p>
<p>What knife tricks do you have?</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/06/30/greppin-logs-with-knife/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Simple Chef Cookbook to Install Jenkins</title>
		<link>http://dev.nuclearrooster.com/2011/05/18/simple-chef-cookbook-to-install-jenkins/</link>
		<comments>http://dev.nuclearrooster.com/2011/05/18/simple-chef-cookbook-to-install-jenkins/#comments</comments>
		<pubDate>Wed, 18 May 2011 16:48:59 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[abstraction]]></category>
		<category><![CDATA[Chef]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[jenkins]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=711</guid>
		<description><![CDATA[Cookbooks Require Tweaking Chef Cookbooks are a great way to define server resources. You can abstract configuration across Linux distributions, creates a standardized format for defining resources, and has plenty of flexibility for configuration. Chef is pretty new on the scene, and a lot of best-practices are still being defined and refined. Here are a [...]]]></description>
			<content:encoded><![CDATA[<h3>Cookbooks Require Tweaking</h3>
<p>Chef Cookbooks are a great way to define server resources.  You can abstract configuration across Linux distributions, creates a standardized format for defining resources, and has plenty of flexibility for configuration. Chef is pretty new on the scene, and a lot of best-practices are still being defined and refined.  Here are a reason I end up tweaking all but the most trivial cookbooks.  </p>
<p><strong>1) Appropriate abstraction</strong><br />
The sweet-spot of abstraction for Chef cookbooks is a best-practice that is still unknown.  The official <a href="http://github.com/opscode/cookbooks">Opscode cookbooks</a> are meant to work for everyone, across distros, which means they are full of case statements for Fedora, RHEL, Debian, Ubuntu, etc.  This cross-distro abstraction serves a purpose, but in my world it only adds clutter.  </p>
<p>Take the Opscode Java cookbook for example, which had known bugs and oddities relating to installing OpenJDK vs. the Sun JDK.  For most circumstances, you'll only run one JDK across your entire system, and dealing with bugs to configure the Sun JDK over the default is a waste of time.  Take joy in excising unnecessary recipe abstraction.</p>
<p>Many third-party cookbooks aren't abstract enough, intermingling configuration of dependencies that you have already pulled into a separate, configurable cookbook. </p>
<p><strong>2) They run as root</strong><br />
 Additionally, you should really take a good look at anything that will run as root on your system.  </p>
<p><strong>3) My inner sysadmin is getting particular</strong><br />
Configure enough systems, and you start to get particular.  I, for example, dislike creating non-system users (users with home directories) for applications.  /home is for humans, if you ask me.  Anyway, right or wrong, I browse through new cookbooks, editing away things that would work, but don't suit to my style.</p>
<h3>Bare-bones Jenkins</h3>
<p>I wanted to install Jenkins, but the only cookbook I could find violated all three of these principles (extra clutter, runs-as-root, and did stuff I didn't like).  Granted the other cookbook has more features, but this is a good place to get started.</p>
<p><script src="https://gist.github.com/978920.js?file=default.rb"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/05/18/simple-chef-cookbook-to-install-jenkins/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sending metrics to StatsD with a Shell One-liner</title>
		<link>http://dev.nuclearrooster.com/2011/05/11/sending-metrics-to-statsd-from-bash/</link>
		<comments>http://dev.nuclearrooster.com/2011/05/11/sending-metrics-to-statsd-from-bash/#comments</comments>
		<pubDate>Wed, 11 May 2011 17:04:25 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[etsy]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[release tracking]]></category>
		<category><![CDATA[statsd]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=694</guid>
		<description><![CDATA[Etsy's great post about tracking every release has some good tips about tracking releases with statsd and graphite (including some essential graphite config tweaks). I was wondering how to do this from within a shell script, and I had to dig through lots of StatsD code and examples to find this snippet. I forget where [...]]]></description>
			<content:encoded><![CDATA[<p>Etsy's great post about <a href="http://codeascraft.etsy.com/2010/12/08/track-every-release/">tracking every release</a> has some good tips about tracking releases with <a href="https://github.com/etsy/statsd">statsd</a> and <a href="http://graphite.wikidot.com/">graphite</a> (including some essential graphite config tweaks).  I was wondering how to do this from within a shell script, and I had to dig through lots of StatsD code and examples to find this snippet.  I forget where I eventually found it, and thought it'd make it easier to find.</p>
<p>Deploy scripts are just one place where a concise and safe way to record a metric/event in important.  From Etsy's blog, using vertical lines to represent distinct events (code deployments) to give more context to the login trends:<br />
<img src="http://etsycodeascraft.files.wordpress.com/2010/12/logins3.png?w=500&#038;h=300"/></p>
<p>Sending a metric from the command line, with netcat or curl, is just one bit of  'glue' that is essential for pulling together a complete metrics solution.  This is essentially the base-case, the lowest-common-denominator that all metrics collection can be built upon.</p>
<p>While short-and-sweet, this snippit contains two measures of protection.  First, it limits the run duration to a single second so it don't have to worry about it hanging, and secondly, it uses UDP, so you don't need to worry about the remote server being performant or even up.  True fire-and-forget, so you can recklessly drop this in scripts left and right.</p>
<p>And the bash one-liner:<br />
<script src="https://gist.github.com/966835.js?file=send_metric_to_statsd.sh"></script></p>
<p>What metrics can you collect with a one-liner?  Add some in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/05/11/sending-metrics-to-statsd-from-bash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Chef: Notifying and Logging Updated Resources</title>
		<link>http://dev.nuclearrooster.com/2011/05/10/chef-notifying-and-logging-updated-resources/</link>
		<comments>http://dev.nuclearrooster.com/2011/05/10/chef-notifying-and-logging-updated-resources/#comments</comments>
		<pubDate>Tue, 10 May 2011 18:03:38 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Chef]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[ops]]></category>
		<category><![CDATA[OpsCode]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=688</guid>
		<description><![CDATA[Chef already logs a quite a bit of information, but it's not that useful to me, since it is difficult to wade through, and is located on each individual node. You could log to syslog and collect it centrally, but that still doesn't have the fine grain I'm looking for. Ideally, I could have an [...]]]></description>
			<content:encoded><![CDATA[<p>Chef already logs a quite a bit of information, but it's not that useful to me, since it is difficult to wade through, and is located on each individual node.  You could log to syslog and collect it centrally, but that still doesn't have the fine grain I'm looking for.  Ideally, I could have an <strong>easy way to look at watch actions were actually executed</strong> on which resources for a particular node.</p>
<p>With Chef's flexible reporting handlers and knife plugins, it's a breeze.  Kallistec pointed me towards <a href="https://github.com/danielsdeleo/nom_nom_nom">Nom Nom Nom</a>, a report-handler and redis-backed-sinatra server to collect information about a Chef-client runs.  It looks pretty nice, but Redis and Sinatra seem extraneous when Chef is already running CouchDB and a web app.</p>
<h3>Report Handler</h3>
<p>The report handler gets any resources that were updated in that Chef-client run (i.e., Chef executed commands to converge these resource), and persists some information about those resources under the node[:log] attribute.  By default it stores info about the last 10 updated resources.<br />
<script src="https://gist.github.com/964946.js?file=update_handler.rb"></script></p>
<h3>Example client.rb</h3>
<p>Here's an example client to use the new report handler.  Check out <a href="http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers">the Opscode wiki page</a> for more info.<br />
<script src="https://gist.github.com/964946.js?file=example_client.rb"></script></p>
<h3>Knife Plugin</h3>
<p>Now that our nodes are persisting the data, we can use <a href="http://wiki.opscode.com/display/chef/Knife+Plugins">Chef 0.10.0's handle Knife plguins</a> to create a simple command line tool to query a node's update log.<br />
<script src="https://gist.github.com/964946.js?file=knife_log_plugin.rb"></script></p>
<h3>Ta da!</h3>
<p>And, we're logging node updates, for easy debugging.  The command line output is nicely formatted with Highline.</p>
<p>I'm also playing around with using a similar report handler to Jabber the Ops chatroom to notify about executed actions, but I'd like a little more control over what resources report changes, and haven't found a good way yet.  </p>
<p><script src="https://gist.github.com/964946.js?file=Bash%20example"></script></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/05/10/chef-notifying-and-logging-updated-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forwarding rsyslog to Graylog2</title>
		<link>http://dev.nuclearrooster.com/2011/04/05/forwarding-rsyslog-to-graylog2/</link>
		<comments>http://dev.nuclearrooster.com/2011/04/05/forwarding-rsyslog-to-graylog2/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 06:20:53 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[distributed logging]]></category>
		<category><![CDATA[rsyslog]]></category>
		<category><![CDATA[syslog]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=618</guid>
		<description><![CDATA[Graylog2 Graylog2 is centralized log collector that can collect Syslog and structured log entries. It's a little pink, and I have no idea why the Yeti is wearing a birthday hat (other than the obvious), but I think it will be a critical tool for getting a handle on errant Java webapp and Flash player [...]]]></description>
			<content:encoded><![CDATA[<h4>Graylog2</h4>
<p><a style="float:left; padding: 10px;" href="http://dev.nuclearrooster.com/wp-content/uploads/2011/04/graylog.png"><img src="http://dev.nuclearrooster.com/wp-content/uploads/2011/04/graylog.png" alt="" title="graylog" width="300" height="100" class="aligncenter size-full wp-image-624" /></a></p>
<p><a href="http://www.graylog2.org/">Graylog2</a> is centralized log collector that can collect <a href="http://en.wikipedia.org/wiki/Syslog">Syslog</a> and structured log entries.  It's a little pink, and I have no idea why the Yeti is wearing a birthday hat (other than the obvious), but I think it will be a critical tool for getting a handle on errant Java webapp and Flash player log entries.<br />
<br style="clear:both"/></p>
<h4>Graylog2 and Chef</h4>
<p>It's got a nice stack: Java collector, MongoDB storage and a Rails UI.  With the help of a pretty complete <a href="http://community.opscode.com/cookbooks/graylog2">Chef recipe by JBZ</a>, I got Graylog2 up-and-running in a matter of minutes.  The Chef recipe had one or two quirks, but nothing I haven't come to expect with Chef, and the end-product is definitely worth a few minutes of debugging.  Another quick chef recipe, and 50 servers are sending their syslogs into Graylog2.  </p>
<h4>Graylog2 with Rsyslog</h4>
<p>I've had my eye on Graylog2, but the whole syslog thing scared me away a little.  Syslog definitely falls under the "they don't teach you that in school" banner, and I had no idea how powerful it is.   I was a little sad I couldn't find details on how to run Graylog2 with syslog, but once I googled for the right thing, I found <a href="http://www.rsyslog.com/article355/">this simple video</a> by the creator of rsyslog, the Syslog implementation in use on most of my servers.  All you need is to add something like the following into a new file in /etc/rsyslog.d and you'll be forwarding syslog entries via UDP to Graylog2:</p>
<pre class="brush: bash; title: ; notranslate">
# Forward all logs to Graylog2
# Replace 0.0.0.0 with your own Graylog2 server IP
*.*     @0.0.0.0 #udp forwarding
</pre>
<h4>and with Syslog-ng</h4>
<p>I've also got some servers that use <a href="http://en.wikipedia.org/wiki/Syslog-ng">syslog-ng</a>, which isn't a one-liner but is pretty close:</p>
<pre class="brush: bash; title: ; notranslate">
# Forward all logs to Graylog2
# Replace 0.0.0.0 with your own Graylog2 server IP
destination graylog2 { udp(0.0.0.0); };
log {
        source(s_all);
        filter(f_at_least_info);
        destination(graylog2);
};
</pre>
<p>It's that easy.</p>
<h4>UDP vs TCP</h4>
<p>I'm sticking with UDP forwarding for now.  It's easy to send syslogs over TCP, and I think Graylog should accept them fine.  More to play with!  Make sure you understand the tradeoffs between the different protocols, and see which one works for your needs.</p>
<p>Can't wait to see more improvements to Graylog2, and see how it will sooth some of our distributed logging woes.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/04/05/forwarding-rsyslog-to-graylog2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Gabemc&#8217;s jabber-tee for appropriate monitoring</title>
		<link>http://dev.nuclearrooster.com/2011/04/05/jabber-tee-hotnes/</link>
		<comments>http://dev.nuclearrooster.com/2011/04/05/jabber-tee-hotnes/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 04:24:31 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=602</guid>
		<description><![CDATA[Jabber-tee Gabemc just released a revamped version of jabber-tee, jabberified version of your standard linux tee. And it rocks. Jabber-tee in short provides a dead-simple way to send Jabber alerts via the command line. I'm a huge fan of PartyChat, and after reading Dziuba's monitoring theory post, I feel even stronger that Jabber has a [...]]]></description>
			<content:encoded><![CDATA[<h4>Jabber-tee</h4>
<p>Gabemc just released a revamped version of <a href="https://github.com/gabemc/jabber-tee">jabber-tee</a>, jabberified version of your <a href="http://www.computerhope.com/unix/utee.htm">standard linux tee</a>.  And it rocks.  </p>
<p>Jabber-tee in short provides a dead-simple way to send Jabber alerts via the command line.  I'm a huge fan of <a href="http://partychapp.appspot.com/">PartyChat</a>, and after reading Dziuba's <a href="http://teddziuba.com/2011/03/monitoring-theory.html">monitoring theory</a> post, I feel even stronger that Jabber has a place in an alerting system; it's the right mix of transience and effectiveness for certain notices.</p>
<h4>Jabber-tee with Reptile for MySQL replication alerts</h4>
<p>A gem a wrote (in working but messy state), <a href="https://github.com/nstielau/reptile">Reptile</a>, for MySQL replication monitoring, can spit out information about replication status, or errors if the replication delays are above defined thresholds.  When everything is working, the gem's executable outputs something like:</p>
<pre class="brush: bash; title: ; notranslate">
nstielau@s34:~$ replication_status --status --heartbeat
INFO: Checking slave status.
INFO: 'master1_slave1' is 'running'
INFO: Checking heartbeats.
INFO: The slave delay for 'master1_slave1' is 1 seconds
</pre>
<p>That's all fine, but things start to get interesting when the delays get large, and we need to send some alerts.  This is a perfect example of an 'informational but not actionable' event; replication delay often fixes itself and there is nothing you can do to speed it up.  Thus, it doesn't make sense to email or page about it, but it is nice to know about. Aha!  Jabber.</p>
<p>Run 'replication_status' with the '-l error' flag (only output replication errors) and it makes a great crontab-able check.  Define a  MAILTO var in your crontab, and you've got email alerts about replication status.  But we don't want emails, we want Jabbers. Aha!  Jabber tee.  Write your config file (/etc/jabber-tee.yml) and update your crontab:</p>
<pre class="brush: bash; title: ; notranslate">
replication_status --status --heartbeat | jabber-tee
</pre>
<p>and presto!  Jabber'ed replication alerts.</p>
<h4>Conclusion</h4>
<p>Jabber-tee is a great, lightweight utility that can help you achieve the Zen of knowing what's going on, without being woken up at night or fattening up your inbox.  What can you do with it?</p>
<p>Other ideas:</p>
<ul>
<li>Jabber alerts from munin</li>
<li>Jabber alerts from certain init scripts ("Service X was just restarted on box11.myservers.com")</li>
<ul>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/04/05/jabber-tee-hotnes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alerting is a Feature, Developers are Users</title>
		<link>http://dev.nuclearrooster.com/2011/03/20/real-world-applications-of-monitoring-theory/</link>
		<comments>http://dev.nuclearrooster.com/2011/03/20/real-world-applications-of-monitoring-theory/#comments</comments>
		<pubDate>Sun, 20 Mar 2011 19:40:33 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=574</guid>
		<description><![CDATA[Monitor Classifications I recently read an interesting post on monitoring theory by Ted Dziuba. The post colorfully classifies different monitors by their required reaction. Dziuba's monitor classifications: Neither Actionable nor Informative Informative, not Actionable Actionable and Informative I'd add a tentative fourth, to the complete the permutations: Actionable, not Informative. This is the worst of [...]]]></description>
			<content:encoded><![CDATA[<h3>Monitor Classifications</h3>
<p>  I recently read an interesting post on <a href="http://teddziuba.com/2011/03/monitoring-theory.html">monitoring theory</a> by Ted Dziuba.  The post colorfully classifies different monitors by their required reaction.</p>
<h5>Dziuba's monitor classifications:</h5>
<ul>
<li>Neither Actionable nor Informative</li>
<li>Informative, not Actionable</li>
<li>Actionable and Informative</li>
</ul>
<p>I'd add a tentative fourth, to the complete the permutations: Actionable, not Informative.  This is the worst of all, the equivalent of your boss screaming "It's DOWN! It's DOWN! Stuff if BROKEN!"</p>
<h3>Why monitoring theory is new in 2011</h3>
<p>  This perspective on monitoring theory comes out of read-world experience dealing with software systems.  The first instinct when systems start failing is to add monitors to every circumstantial piece of evidence.  Load average spiked?  Monitor and alert.  Replication delay?  Monitor and alert.  This naive monitoring and alerting will keep your system up, but creates an unsustainable environment for developers and system administrators. With so many alerts flying around, pretty soon your team is either ignoring them or severely sleep-deprived and grumpy.</p>
<p>Dziuba's theory then comes into play here, identifying reactionary measures, classifying monitors, and alerting/persisting with the correct tools such that your system gets the correct amount of attention at the correct time.  Monitoring is not new, and disgruntled sysadmins are not new, but there is something about the devops movement that is changing monitoring.  </p>
<p>As development and operations align, it is easier to picture sysadmins as bonafide users, and users have the right of an optimal user-experience.</p>
<h3>What you need to do, when</h3>
<p>  Here's a little more detail about each level of monitor: the use-case for investigating, and likely frequency.  Like user-features, monitoring should be approached with use-cases.  Developers and Sysadmins are users, and their use-cases and experiences should be defined before solutions are implemented.</p>
<p><strong>Neither Actionable nor Informative</strong><br />
    Frequency: monthly, quarterly<br />
    Purpose: Look at for capacity planning, roadmapping</p>
<p><strong>Informative, not Actionable</strong><br />
Frequency: Daily, weekly<br />
Purpose: Take preventative actions</p>
<p><strong>(Actionable, not Informative)</strong><br />
Frequency: NOW!<br />
Purpose: Figure out what is wrong, and then fix it (suck)</p>
<p><strong>Actionable and Informative</strong><br />
Frequency: NOW!<br />
Purpose: Execute the predefined steps to correct the error</p>
<h3>Communicating and persisting alerts</h3>
<p>There are <a href="http://munin-monitoring.org/">dozens</a> <a href="http://graphite.wikidot.com/">of</a> <a href="https://www.cloudkick.com/">tools</a> to help with monitoring, and almost as many <a href="http://en.wikipedia.org/wiki/Email">different</a> <a href="http://twitter.com/">forms</a> <a href="http://www.jabber.org/">of</a> <a href="http://en.wikipedia.org/wiki/SMS">communication</a>.  Here are few methods for recording monitor alerts.  They key distinction is how much (or how strongly) a specific medium will demand attention. These are listed in order from least attention-demanding to most.</p>
<ul>
<li>Log to file</li>
<li>Graph (munin, collectd, graphite)</li>
<li>Record (dashboard, for later viewing)</li>
<li>Jabber/IM</li>
<li>Twitter feed</li>
<li>Digest Email</li>
<li>Email</li>
<li>Page/SMS</li>
<li> Acknowledged Page/SMS</li>
</ul>
<h3>High-level monitoring objectives</h3>
<p>  As Dziuba notes, a lot of this is subjective.  In one system, maybe a queue with 10 items is a problem.  In another, maybe 1000 items is fine.  The high-level monitoring use-cases give a good picture of the high-level monitoring objectives:</p>
<ul>
<li>What do you want to keep running?</li>
<li>How do you deterministically monitor the health of those systems?</li>
<li>What secondary and tertiary monitors might give some insight into the system, and how can those be effectively monitored without going crazy?</li>
</ul>
<h3>Monitor specific questions</h3>
<p>  Here are a few questions that might narrow-done the correct alerting tool for a particular monitor.</p>
<ul>
<li>If X happens, is user experience necessarily broken?</li>
<li>If X happens, is user experience necessarily degraded?</li>
<li>If X happens, doing Y will fix the problem</li>
<li>If you go back to sleep, will X likely return to normal state?</li>
</ul>
<p>If user experience is significantly degraded, and there are concrete actions that will correct the issue, go ahead and demand a reaction.</p>
<h3>Test Cases</h3>
<p>  Here are a few concrete scenarios we can put to test:</p>
<ul>
<li>
<strong>Replication outside delay</strong><br />
Probably will fix itself, this time, but you should know in general what your delay is.  Let's graph this in general, maybe jabber if it is 15 minutes behind, and email if it is 1 hour behind.
</li>
<li>
    <strong>Chef run failed</strong><br />
Thanks to <a href="http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run">convergence</a> we can be pretty sure this will sort itself out.  In specific circumstances, this could be an issue, so maybe Jabber the error so it's on the radar.
</li>
<li>
    <strong>NTP Time Update failed</strong><br />
In all but the most finicky systems this should be fine, it'll correct itself soon.  No alerting.
</li>
<li>
    <strong>Backend processor CPU/Load Average</strong><br />
This is what processors do.  Graph, no alerts.
</li>
<li>
    <strong>Digest email of processing errors for the past day</strong><br />
These may be actionable or they may not.  The digest is a pretty good way to reduce inbox traffic, but monitors are either they are actionable or they are not.  If they are actionable, demand more attention.  If they are merely informational, a web dashboard is probably better.
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/03/20/real-world-applications-of-monitoring-theory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escape JSON is Rails 3 views</title>
		<link>http://dev.nuclearrooster.com/2011/02/27/escape-json-is-rails-3-views/</link>
		<comments>http://dev.nuclearrooster.com/2011/02/27/escape-json-is-rails-3-views/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 17:13:27 +0000</pubDate>
		<dc:creator>nick.stielau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.nuclearrooster.com/?p=568</guid>
		<description><![CDATA[It's convenient to build up options in your server-side language (Ruby!) even if you are going to output them at JavaScript options for some JavaScript library. This way, you can merge in different options, use server-side logic to specify certain options, etc. The trick is that Rails 3 automatically escapes HTML, so a simple options.to_json [...]]]></description>
			<content:encoded><![CDATA[<p>It's convenient to build up options in your server-side language (Ruby!) even if you are going to output them at JavaScript options for some JavaScript library.  This way, you can merge in different options, use server-side logic to specify certain options, etc.  </p>
<p>The trick is that Rails 3 automatically escapes HTML, so a simple <code>options.to_json</code> doesn't quite cut it.  A <a href="http://stackoverflow.com/questions/3932267/dont-escape-html-in-ruby-on-rails">this StackOverflow post</a> concludes, you can use the <code>html_safe</code> string method to effectively unescape the json before the template escapes it, giving you just what you are looking for.</p>
<pre class="brush: ruby; title: ; notranslate">
&lt;%
options = {
:name =&gt; 'foo',
:color =&gt; 'bar'
}
%&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
console.log(&quot;My Options are:&quot; + &lt;%= options.to_json.html_safe -%&gt;);
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dev.nuclearrooster.com/2011/02/27/escape-json-is-rails-3-views/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

