<?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>btm.geek &#187; Uncategorized</title>
	<atom:link href="http://blog.loftninjas.org/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.loftninjas.org</link>
	<description></description>
	<lastBuildDate>Mon, 23 Jan 2012 23:12:39 +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>Stubbing class constants with rspec and Ruby</title>
		<link>http://blog.loftninjas.org/2012/01/23/stubbing-class-constants-with-rspec/</link>
		<comments>http://blog.loftninjas.org/2012/01/23/stubbing-class-constants-with-rspec/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 23:12:39 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=748</guid>
		<description><![CDATA[I had some Ruby code that utilized File::SEPARATOR and File::PATH_SEPARATOR to run on both unix and windows, so I wanted to stub these values to test for both platforms. There are couple examples out there, building on each other. This example adds a feature that saves and recalls the former value and this example builds [...]]]></description>
			<content:encoded><![CDATA[<p>I had some Ruby code that utilized File::SEPARATOR and File::PATH_SEPARATOR to run on both unix and windows, so I wanted to stub these values to test for both platforms. There are couple examples out there, building on each other. This <a href="http://digitaldumptruck.jotabout.com/?p=551">example</a> adds a feature that saves and recalls the former value and this <a href="http://missingbit.blogspot.com/2011/07/stubbing-constants-in-rspec_20.html">example</a> builds on that to support class constants. Both expect Activerecord, so there&#8217;s a little working around that added here. I&#8217;m ripping this directly from my spec_helper.rb before I throw it away because it feels over-engineered and complicated.</p>
<pre class="brush: ruby; title: ; notranslate">
def with_warnings(flag)
  old_verbose, $VERBOSE = $VERBOSE, flag
  yield
ensure
  $VERBOSE = old_verbose
end

# http://missingbit.blogspot.com/2011/07/stubbing-constants-in-rspec_20.html
def parse_constant(constant)
  source, _, constant_name = constant.to_s.rpartition('::')

  [constantize(source), constant_name]
end

def with_constants(constants, &amp;block)
  saved_constants = {}
  constants.each do |constant, val|
    source_object, const_name = parse_constant(constant)

    saved_constants[constant] = source_object.const_get(const_name)
    with_warnings(nil) {source_object.const_set(const_name, val) }
  end

  begin
    block.call
  ensure
    constants.each do |constant, val|
      source_object, const_name = parse_constant(constant)

      with_warnings(nil) { source_object.const_set(const_name, saved_constants[constant]) }
    end
  end
end
####################

# File activesupport/lib/active_support/inflector/methods.rb, line 209
def constantize(camel_cased_word)
  names = camel_cased_word.split('::')
  names.shift if names.empty? || names.first.empty?

  constant = Object
  names.each do |name|
    constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
  end
  constant
end
</pre>
<p>Then you can perform:</p>
<pre class="brush: ruby; title: ; notranslate">
  it &quot;does something when running on Windows&quot; do
    with_constants &quot;::File::PATH_SEPARATOR&quot; =&gt; &quot;;&quot; do
      # code
    end
  end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2012/01/23/stubbing-class-constants-with-rspec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Downloading All The Github Repositories</title>
		<link>http://blog.loftninjas.org/2012/01/12/downloading-all-the-github-repositories/</link>
		<comments>http://blog.loftninjas.org/2012/01/12/downloading-all-the-github-repositories/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 16:00:31 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=745</guid>
		<description><![CDATA[I had a need to grab all of the Github repositories for Cookbooks, which is a Github user maintained by the Chef community for collecting many cookbooks in one place for development. All of these cookbooks should be on the Opscode Community site, which is where you should go if you&#8217;re browsing for cookbooks to [...]]]></description>
			<content:encoded><![CDATA[<p>I had a need to grab all of the <a href="https://github.com/cookbooks">Github repositories for Cookbooks</a>, which is a Github user maintained by the Chef community for collecting many cookbooks in one place for development. All of these cookbooks should be on the <a href="http://community.opscode.com/">Opscode Community</a> site, which is where you should go if you&#8217;re browsing for cookbooks to use yourself. But I needed to grep through a large number of cookbooks to develop statistics on Chef Cookbook usage patterns, so I needed <a href="http://knowyourmeme.com/memes/x-all-the-y">All The Things</a>.</p>
<pre class="brush: plain; title: ; notranslate">
#!/usr/bin/env ruby
# 2012-01-11 Bryan McLellan &lt;btm@loftninjas.org&gt;
# Fetch the list of repositories from a Github user and 'git clone' them all

require 'rubygems'
require 'json'
require 'net/http'

url = &quot;http://github.com/api/v2/json/repos/show/cookbooks&quot;
dir = &quot;cookbooks&quot;

if File.basename(Dir.getwd) != dir
 if File.exists?(dir)
   puts &quot;Target directory of '#{dir}' already exists.&quot;
   exit 1
 end

 Dir.mkdir(dir)
 Dir.chdir(dir)
end

resp = Net::HTTP.get_response(URI.parse(url))
data = resp.body

result = JSON.parse(data)

result['repositories'].each { |repo|
 puts &quot;Fetching #{repo['url']}&quot;
 system &quot;git clone #{repo['url']}&quot;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2012/01/12/downloading-all-the-github-repositories/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generating entropy in the cloud</title>
		<link>http://blog.loftninjas.org/2011/07/29/generating-entropy-in-the-cloud/</link>
		<comments>http://blog.loftninjas.org/2011/07/29/generating-entropy-in-the-cloud/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 15:01:47 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=736</guid>
		<description><![CDATA[Virtual machines don&#8217;t produce a lot of entropy on their own. Typically the need for additional entropy triggers talk of hardware based entropy generators or network based entropy distribution protocols. Sometimes you just need a little bit of entropy for a moment.

$ sbuild-update --keygen
Generating archive key.

Not enough random bytes available.  Please do some other [...]]]></description>
			<content:encoded><![CDATA[<p>Virtual machines don&#8217;t produce a lot of entropy on their own. Typically the need for additional entropy triggers <a href="http://blog.dt.org/index.php/2009/08/entropy-in-cloud-computing-applications/">talk of hardware based entropy generators</a> or network based entropy distribution protocols. Sometimes you just need a little bit of entropy for a moment.</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
$ sbuild-update --keygen
Generating archive key.

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 279 more bytes)
</pre>
<p>Disk tends to be one of the only remaining sources of entropy on virtual systems. I usually do something like this:</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
$ while true ; do cat /proc/sys/kernel/random/entropy_avail  ; \
    sudo find / &gt; /tmp/find.log ; sync ; done
</pre>
<p>This numbers printed should go up and down as your application consumes the entropy. Hit CTRL+C when you&#8217;ve got enough. This is probably a bad source of entropy, but the world is inherently dangerous.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/07/29/generating-entropy-in-the-cloud/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Disabling Firefox shortcuts on OS X</title>
		<link>http://blog.loftninjas.org/2011/07/15/disabling-firefox-shortcuts-on-os-x/</link>
		<comments>http://blog.loftninjas.org/2011/07/15/disabling-firefox-shortcuts-on-os-x/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 15:10:56 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=731</guid>
		<description><![CDATA[I joined a startup, and they gave me a MacBook Pro. It was bound to happen eventually; all the cool kids use MBPs and startups are cool, right?
The great period of adaption began, as I learned I couldn&#8217;t have simple technology like sloppy focus. One of the greatest inconveniences is the keyboard. I have a [...]]]></description>
			<content:encoded><![CDATA[<p>I joined a startup, and they gave me a MacBook Pro. It was bound to happen eventually; <a href="http://onelessmac.com/">all the cool kids use MBPs</a> and startups are cool, right?</p>
<p>The great period of adaption began, as I learned I couldn&#8217;t have simple technology like <a href="http://en.wikipedia.org/wiki/Focus_%28computing%29#Sloppy_focus">sloppy focus</a>. One of the greatest inconveniences is the keyboard. I have a hard time using the keyboard on the laptop because special keys are in different places than I&#8217;m used to. Even with a <a href="http://pckeyboards.stores.yahoo.net/onthestick.html">Unicomp Spacesaver M</a> (for those of us attached to the <a href="http://en.wikipedia.org/wiki/Model_M_keyboard">Model M</a>), some change is apparent, like Apple using &#8220;delete&#8221; when they mean &#8220;backspace&#8221; (The <a href="http://www.flickr.com/photos/btmspox/5939671807/">Unicomp uses &#8220;delete ->&#8221;</a> when they mean &#8220;delete&#8221;).</p>
<p>Most frustrating of this set of issues is that in Firefox the home and end keys go to the top and bottom of the page, whereas you have to use cmd+left and cmd+right to go to the beginning and end of a line in a textbox. <em>However</em> sometimes these keys represent page forward and page back, and sometimes they don&#8217;t (usually in a flash app, I believe). The solution is to install the <a href="http://forums.mozillazine.org/viewtopic.php?t=72994">keyconfig extension</a>. After you restart firefox, you will find it in the Tools menu where you can disable &#8220;GoBackKb&#8221; and &#8220;GoForwardKb&#8221;. Then these keys work as expected in a text box and you no longer find yourself going back a page unintentionally, possibly losing a textbox full of input along the way.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/07/15/disabling-firefox-shortcuts-on-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>require-rubygems.overrides and gem2deb 0.2.2</title>
		<link>http://blog.loftninjas.org/2011/05/05/require-rubygems-overrides-and-gem2deb-0-2-2/</link>
		<comments>http://blog.loftninjas.org/2011/05/05/require-rubygems-overrides-and-gem2deb-0-2-2/#comments</comments>
		<pubDate>Fri, 06 May 2011 00:43:01 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=720</guid>
		<description><![CDATA[For those working on moving debian ruby library packaging to gem2deb, you can exempt specific hits from the slick built in &#8216;require rubygems&#8217; test by adding the path to debian/require-rubygems.overrides.
For instance, to exempt this:

debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/version'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/dependency'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/spec_fetcher'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/platform'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/format'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/dependency_installer'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/uninstaller'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/specification'
debian/chef/usr/lib/ruby/vendor_ruby/chef/providers.rb: require 'chef/provider/package/rubygems'
Found some [...]]]></description>
			<content:encoded><![CDATA[<p>For those working on moving debian ruby library packaging to gem2deb, you can exempt specific hits from the slick built in &#8216;require rubygems&#8217; test by adding the path to debian/require-rubygems.overrides.</p>
<p>For instance, to exempt this:</p>
<pre class="brush: plain; gutter: false; title: ; toolbar: false; notranslate">
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/version'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/dependency'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/spec_fetcher'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/platform'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/format'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/dependency_installer'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/uninstaller'
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb: require 'rubygems/specification'
debian/chef/usr/lib/ruby/vendor_ruby/chef/providers.rb: require 'chef/provider/package/rubygems'
Found some 'require rubygems' without overrides (see above).
ERROR: Test &quot;require-rubygems&quot; failed. Exiting.
dh_auto_install: dh_ruby --install /«BUILDDIR»/chef-0.10.0/debian/chef returned exit code 1
make: *** [binary] Error 1
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
</pre>
<p>debian/require-rubygems.overrides should contain:</p>
<pre class="brush: plain; gutter: false; title: ; toolbar: false; notranslate">
debian/chef/usr/lib/ruby/vendor_ruby/chef/provider/package/rubygems.rb
debian/chef/usr/lib/ruby/vendor_ruby/chef/providers.rb
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/05/05/require-rubygems-overrides-and-gem2deb-0-2-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>locale errors on debian</title>
		<link>http://blog.loftninjas.org/2011/04/14/locale-errors-on-debian/</link>
		<comments>http://blog.loftninjas.org/2011/04/14/locale-errors-on-debian/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 21:51:00 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=717</guid>
		<description><![CDATA[I received the following error while working on a Debian sid box:

$ schroot -l
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Aborted

With debconf + locales already installed, I ran &#8216;export &#124; grep LANG&#8217; to discover that my locale was set to &#8216;en_US.UTF-8&#8242;. Then I ran &#8216;dpkg-reconfigure locale&#8217; and checked [...]]]></description>
			<content:encoded><![CDATA[<p>I received the following error while working on a Debian sid box:</p>
<pre class="brush: plain; title: ; notranslate">
$ schroot -l
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Aborted
</pre>
<p>With <a href="http://people.debian.org/~schultmc/locales.html">debconf + locales</a> already installed, I ran &#8216;export | grep LANG&#8217; to discover that my locale was set to &#8216;en_US.UTF-8&#8242;. Then I ran &#8216;dpkg-reconfigure locale&#8217; and checked that locale and set it to the default.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/04/14/locale-errors-on-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Debian sid emi for Eucalyptus</title>
		<link>http://blog.loftninjas.org/2011/04/13/creating-a-debian-sid-emi-for-eucalyptus/</link>
		<comments>http://blog.loftninjas.org/2011/04/13/creating-a-debian-sid-emi-for-eucalyptus/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 23:43:52 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=709</guid>
		<description><![CDATA[For the most part, this is the same as any post about creating an image for Eucalyptus, but I had a hard time figuring out exactly how to put it all together. You need an up to date Debian sid system nearby to take the kernel and ramdisk from. I found having a sid VM [...]]]></description>
			<content:encoded><![CDATA[<p>For the most part, this is the same as any post about creating an image for Eucalyptus, but I had a hard time figuring out exactly how to put it all together. You need an up to date Debian sid system nearby to take the kernel and ramdisk from. I found having a sid VM easier than discovering the commands to build a sid initrd on my Ubuntu workstation.</p>
<pre class="brush: plain; title: ; notranslate">
# First, the prerequisites. You need debootstrap and the eucalyptools tools installed.
sudo apt-get install debootstrap euca2ools

# Export your eucalyptus variables to use the tools.
source ~/.euca/eucarc

# Create an empty disk image. You can adjust the count to change the root disk size. 1000 is about a GB.
dd if=/dev/zero of=image count=1000 bs=1M

# Put a filesystem on the new disk image
mkfs.ext3 -F image

# Mount the filesystem
mkdir chroot
sudo mount -o loop image chroot

# Install debian sid to the chroot. Notice that the ssh server and curl are included here
sudo debootstrap --include=openssh-server,curl,vim --arch amd64 sid chroot/ http://ftp.debian.org

# chroot into the image
sudo chroot chroot

# Setup basic networking and disk configurations
echo -e 'auto lo\niface lo inet loopback\nauto eth0\niface eth0 inet dhcp' &gt;&gt; /etc/network/interfaces
echo -e '/dev/sda1 / ext3 defaults 0 1\n/dev/sda2 swap swap defaults 0 0' &gt; /etc/fstab

# Set a default root password if you want
# passwd

# Set up the image to automatically install ssh keys
mkdir /root/.ssh
cat &lt;&lt;EOS &gt; /etc/rc.local
echo &gt;&gt; /root/.ssh/authorized_keys
curl -m 10 -s http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key | grep 'ssh-rsa' &gt;&gt; /root/.ssh/authorized_keys
echo &quot;AUTHORIZED_KEYS:&quot;
echo &quot;************************&quot;
cat /root/.ssh/authorized_keys
echo &quot;************************&quot;
exit 0
EOS

# Leave the image
exit

# Unmount the image
sudo umount chroot

# After you've copied the latest /boot/vmlinuz* and /boot/initrd* from your sid system, upload the kernel + ramdisk
euca-bundle-image --image vmlinuz-2.6.38-2-amd64 --kernel true
euca-upload-bundle --bucket sid --manifest vmlinuz-2.6.38-2-amd64.manifest.xml
euca-register sid/vmlinuz-2.6.38-2-amd64.manifest.xml
euca-bundle-image --image initrd.img-2.6.38-2-amd64 --ramdisk true
euca-upload-bundle --bucket sid --manifest initrd.img-2.6.38-2-amd64.manifest.xml
euca-register sid/initrd.img-2.6.38-2-amd64.manifest.xml

# Prepare the image for upload, use the values given by euca-register above here
euca-bundle-image -i image --kernel eki-XXXXXXXX --ramdisk eri-XXXXXXXX

# Rename to manifest to something descriptive and upload it
mv image.manifest.xml `date +%Y%m%d`.sid.manifest.xml
euca-upload-bundle -b sid -m `date +%Y%m%d`.sid.manifest.xml

# Register the image to get an EMI
euca-register sid/`date +%Y%m%d`.sid.manifest.xml
</pre>
<p>You should be able to use euca-run-instance on the emi that is returned by the last command. Remember to pass an ssh key (that eucalyptus knows about) using -k. If there are any issues, use euca-get-console-output to monitor the instance startup and tail the eucalyptus/nc.log file on the node controller for any errors. Building the initrd this way is a little hackish, because it is actually generated for your sid system, not for the one running in eucalyptus. Chicken, or the egg?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/04/13/creating-a-debian-sid-emi-for-eucalyptus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LVM errors with sbuild</title>
		<link>http://blog.loftninjas.org/2011/03/10/lvm-errors-with-sbuild/</link>
		<comments>http://blog.loftninjas.org/2011/03/10/lvm-errors-with-sbuild/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 19:51:17 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=705</guid>
		<description><![CDATA[Here is a strange one that I fixed but I&#8217;m not sure why. Roughly using the SBuildLVM Howto, and the Chef sbuild cookbook, I have an sbuild server. It was working alright for me, but another user was seeing this:
schroot -c lucid
E: 05lvm: File descriptor 3 (socket:[460392]) leaked on lvcreate invocation.
E: lucid-40c0e109-2d5d-4103-bf92-a44288595dcc: Chroot setup failed: [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a strange one that I fixed but I&#8217;m not sure why. Roughly using the <a href="https://help.ubuntu.com/community/SbuildLVMHowto">SBuildLVM Howto</a>, and the <a href="http://community.opscode.com/cookbooks/sbuild">Chef sbuild cookbook</a>, I have an sbuild server. It was working alright for me, but another user was seeing this:</p>
<p><code>schroot -c lucid<br />
E: 05lvm: File descriptor 3 (socket:[460392]) leaked on lvcreate invocation.<br />
E: lucid-40c0e109-2d5d-4103-bf92-a44288595dcc: Chroot setup failed: stage=setup-start</code></p>
<p>When he ran with verbose mode, this line was particularly interesting:</p>
<p><code>E: 05lvm:   </code></p>
<p>When I su&#8217;d to his user, it worked fine for me without verbose but failed similarly with the verbose flag. </p>
<p>In the course of debugging, I started trying to redirect output and I found that these changes to /etc/schroot/setup.d/05lvm fixed the problem. Unfortunately I&#8217;m running behind on work so I can&#8217;t track down the root cause right now.</p>
<pre class="brush: plain; title: ; notranslate">
--- 05lvm.orig	2011-03-10 19:28:17.000000000 +0000
+++ 05lvm	2011-03-10 19:37:54.000000000 +0000
@@ -36,10 +36,10 @@

 	if [ &quot;$AUTH_VERBOSITY&quot; = &quot;verbose&quot; ]; then
 	    lvcreate $VERBOSE --snapshot --name &quot;$CHROOT_LVM_SNAPSHOT_NAME&quot; \
-		&quot;$CHROOT_DEVICE&quot; $CHROOT_LVM_SNAPSHOT_OPTIONS
+		&quot;$CHROOT_DEVICE&quot; $CHROOT_LVM_SNAPSHOT_OPTIONS 2&gt;&amp;1
 	else
 	    lvcreate $VERBOSE --snapshot --name &quot;$CHROOT_LVM_SNAPSHOT_NAME&quot; \
-		&quot;$CHROOT_DEVICE&quot; $CHROOT_LVM_SNAPSHOT_OPTIONS &gt; /dev/null
+		&quot;$CHROOT_DEVICE&quot; $CHROOT_LVM_SNAPSHOT_OPTIONS 2&gt;&amp;1 &gt; /dev/null
 	fi

     elif [ $1 = &quot;setup-stop&quot; ]; then
@@ -57,9 +57,9 @@
 		--pid=$PID || true

 	    if [ &quot;$AUTH_VERBOSITY&quot; = &quot;verbose&quot; ]; then
-		lvremove $VERBOSE -f &quot;$CHROOT_LVM_SNAPSHOT_DEVICE&quot; || true
+		lvremove $VERBOSE -f &quot;$CHROOT_LVM_SNAPSHOT_DEVICE&quot; 2&gt;&amp;1 || true
 	    else
-		lvremove $VERBOSE -f &quot;$CHROOT_LVM_SNAPSHOT_DEVICE&quot; &gt; /dev/null || true
+		lvremove $VERBOSE -f &quot;$CHROOT_LVM_SNAPSHOT_DEVICE&quot; 2&gt;&amp;1 &gt; /dev/null || true
 	    fi
 	else
 	    # The block device no longer exists, or was never created,
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/03/10/lvm-errors-with-sbuild/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>munin-cgi-graph with fcgid on ubuntu lucid</title>
		<link>http://blog.loftninjas.org/2011/02/24/munin-cgi-graph-with-fcgid-on-ubuntu-lucid/</link>
		<comments>http://blog.loftninjas.org/2011/02/24/munin-cgi-graph-with-fcgid-on-ubuntu-lucid/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 00:02:49 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=695</guid>
		<description><![CDATA[Two and a half years have passed since I wrote about running Munin with fastcgi triggered graphs on Debian etch. Unfortunately, not a lot has changed since then. A revolution in trending would have been nice. When I started here munin was triggering graph generation using CGI and was painfully slow to use. I switched [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.loftninjas.org/wp-content/uploads/2011/02/munin_stats-day.png"><img src="http://blog.loftninjas.org/wp-content/uploads/2011/02/munin_stats-day-300x187.png" alt="" title="munin_stats-day" width="300" height="187" class="alignleft size-medium wp-image-703" /></a>Two and a half years have passed since I wrote about running <a href="http://blog.loftninjas.org/2008/09/16/munin-cgi-graph-with-fastcgi-on-debian-etch/">Munin with fastcgi triggered graphs on Debian etch</a>. Unfortunately, not a lot has changed since then. A revolution in trending would have been nice. When I started here munin was triggering graph generation using CGI and was painfully slow to use. I switched over to cron triggered graph generation and was happy. After a data center migration, drawing the munin graphs for that cluster from cron was taking about 130 seconds. As a precaution I wanted to get this down a bit. </p>
<p>Someone asked me why munin-graph would have caused data loss because munin-update collects the data and I couldn&#8217;t remember. I had problems with both munin-update and munin-update taking over five minutes in certain circumstances back then. The latter was primarily from the slow response time of the SNMP queries I was doing against MSSQL servers. That was back during Munin 1.2 as well and a few things have changed since then, most relevant is that you no longer have to patch Munin for fastcgi support.</p>
<p>This time around I used <a href="http://httpd.apache.org/mod_fcgid/">fcgid</a> instead of fastcgi. There are less licensing hurdles for fcgid, which was written to be compatible with fastcgi. Provided you already have munin running, install the prerequsites first.</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
sudo apt-get install libcgi-fast-perl libdate-manip-perl libapache2-mod-fcgid
</pre>
<p>The packaging should restart Apache as required to load the new module we just installed, but we need to configure our Munin site a bit to link our CGI script to fcgid. Add this to or update the VirtualHost block for your Apache configuration and reload Apache.</p>
<pre class="brush: plain; title: ; notranslate">
  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

  &lt;Directory /usr/lib/cgi-bin/&gt;
    AllowOverride None
    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  &lt;/Directory&gt;

  &lt;Location /cgi-bin/munin-fastcgi-graph&gt;
    SetHandler  fastcgi-script
  &lt;/Location&gt;
</pre>
<p>Add the following lines to your munin.conf. This causes the munin-graph that is run from cron to not generate any graphs (noops) and munin-html will update the img src links to use the CGI script to generate the graphs rather than linking directly to files. You&#8217;ll need to wait for the cron job to run once or run munin-html yourself to trigger this.</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
graph_strategy cgi
cgiurl_graph /cgi-bin/munin-fastcgi-graph
</pre>
<p>Triggering munin-html manually:</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
sudo -s
sudo -u munin /usr/share/munin/munin-html --debug
</pre>
<p>Remember that Apache needs to be able to write the graphs out. You will get no graphs and HTTP 500 errors in your Apache logs if the munin-cgi-graph script cannot write the graphs out. My Munin data directory, /var/www/munin/ is owned by &#8216;munin&#8217; while Apache runs as &#8216;www-data&#8217;. The following commands fix this, but Apache is going to change the user ownership to &#8216;www-data&#8217; when it saves a file by default, so if you try to switch back to munin-graph via cron, you&#8217;ll need to fix permissions again.</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
sudo chgrp -R www-data /var/www/munin
sudo chmod -R g+w /var/www/munin
sudo chgrp www-data /var/log/munin /var/log/munin/munin-graph.log
sudo chmod g+w /var/log/munin /var/log/munin/munin-graph.log
</pre>
<p>After the switch to fcgid generated munin graphs, generating all the graphs for a single node would take minutes and was quite painful. I gave the node more CPU resources, but it still took two minutes to draw a page of graphs. I ended up switching back to cron based graph generation. The additional CPU resources cut about forty seconds off the munin-graph time from cron, which is progress. Having the graphs immediately available when you need them is worth the cost of the CPU resources you could otherwise share that you would save from demand based graph generation via CGI. For the time being I intend to keep giving Munin more CPU until I find settle on a better way to do trending.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/02/24/munin-cgi-graph-with-fcgid-on-ubuntu-lucid/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Monitoring Unicorn connections with munin</title>
		<link>http://blog.loftninjas.org/2011/02/11/monitoring-unicorn-connections-with-munin/</link>
		<comments>http://blog.loftninjas.org/2011/02/11/monitoring-unicorn-connections-with-munin/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 02:00:37 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=673</guid>
		<description><![CDATA[Unicorn doesn&#8217;t have any monitoring hooks. Typically folks either put nginx in front and monitor response time, do some backlog magic and track errors or make guesses based on other available information. I&#8217;ve been using a modified version of the unicorn_status munin plugin for a while. It tracks CPU time for a thread and considers [...]]]></description>
			<content:encoded><![CDATA[<p>Unicorn doesn&#8217;t have any monitoring hooks. Typically folks either put nginx in front and monitor response time, do some <a href="http://rubyforge.org/pipermail/mongrel-unicorn/2010-February/000405.html">backlog magic</a> and track errors or make guesses based on other available information. I&#8217;ve been using a modified version of the <a href="http://exchange.munin-monitoring.org/plugins/unicorn_status/version/1">unicorn_status munin plugin</a> for a while. It tracks CPU time for a thread and considers that thread idle if it hasn&#8217;t changed after sleeping for a second. This doesn&#8217;t pan out under load. Still, here it is.</p>
<pre class="brush: ruby; title: ; notranslate">
#!/usr/bin/env ruby
#
# unicorn_status - A munin plugin for Linux to monitor unicorn processes
#
#  Copyright (C) 2010 Shinji Furuya - shinji.furuya@gmail.com
#  Copyright (C) 2010 Opscode, Inc. - Bryan McLellan &lt;btm@loftninjas.org&gt;
#    - Specify pid file via environment variable
#    - Do not assume process names
#  Licensed under the MIT license:
#  http://www.opensource.org/licenses/mit-license.php
#

module Munin
  class UnicornStatus

    def initialize
      @pid_file = ENV['UNICORN_PID']
    end

    def master_pid
      File.read(@pid_file).to_i
    end

    def worker_pids
      result = []
      ps_output = `ps w --ppid #{master_pid}`
      ps_output.each_line do |line|
        chunks = line.strip.split(/\s+/, 5)
        pid = chunks[0]
        result &lt;&lt; pid.to_i if pid =~ /\A\d+\z/
      end
      result
    end

    def worker_count
      worker_pids.size
    end

    def idle_worker_count
      result = 0
      before_cpu = {}
      worker_pids.each do |pid|
        before_cpu[pid] = cpu_time(pid)
      end
      sleep 1
      after_cpu = {}
      worker_pids.each do |pid|
        after_cpu[pid] = cpu_time(pid)
      end
      worker_pids.each do |pid|
        result += 1 if after_cpu[pid] - before_cpu[pid] == 0
      end
      result
    end

    def cpu_time(pid)
      usr, sys = `cat /proc/#{pid}/stat | awk '{print $14,$15 }'`.strip.split(/\s+/).collect { |i| i.to_i }
      usr + sys
    end
  end
end

case ARGV[0]
when &quot;autoconf&quot;
  puts &quot;yes&quot;
when &quot;config&quot;
  puts &quot;graph_title Unicorn - Status&quot;
  puts &quot;graph_args -l 0&quot;
  puts &quot;graph_vlabel number of workers&quot;
  puts &quot;graph_category Unicorn&quot;
  puts &quot;total_worker.label total_workers&quot;
  puts &quot;idle_worker.label idle_workers&quot;
else
  m = Munin::UnicornStatus.new
  puts &quot;total_worker.value #{m.worker_count}&quot;
  puts &quot;idle_worker.value #{m.idle_worker_count}&quot;
end
</pre>
<p>And the configuration file:</p>
<pre class="brush: plain; title: ; notranslate">
$ sudo cat /etc/munin/plugin-conf.d/unicorn
      [unicorn_*]
      user root
      env.UNICORN_PID /etc/sv/opscode-chef/supervise/pid
</pre>
<p>I wrote another plugin today that uses <a href="http://raindrops.bogomips.org/">raindrops</a> to collect information about the active and queued connections. It is interesting how greatly active connections fluctuates. Thus, active connections don&#8217;t produce a stable munin graph, but having the queue depth recorded is pretty useful for tracking down latency issues.</p>
<pre class="brush: ruby; title: ; notranslate">
#!/usr/bin/env ruby
#  Copyright: 2011 Opscode, Inc.
#  Author: Bryan McLellan &lt;btm@loftninjas.org&gt;
#
#   Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

require 'rubygems'
require 'raindrops'

def collect(port)
  # raindrops requires an array of strings, even if it denies this
  addr = [ &quot;0.0.0.0:#{port}&quot; ]
  stats = Raindrops::Linux.tcp_listener_stats(addr)

  puts &quot;active.value #{stats[addr[0]].active}&quot;
  puts &quot;queued.value #{stats[addr[0]].queued}&quot;
end

if ARGV[0] == &quot;config&quot;
  puts &quot;graph_title Unicorn - connections&quot;
  puts &quot;graph_args -l 0&quot;
  puts &quot;graph_printf %6.0lf&quot;
  puts &quot;graph_vlabel connections&quot;
  puts &quot;graph_category Unicorn&quot;
  puts &quot;active.label active&quot;
  puts &quot;queued.label queued&quot;
  exit 0
end

if $0 =~ /.*_(\d+)/
  # the munin wildcard format of plugin_value
  port = $1
elsif ARGV.size &gt; 0
  port = ARGV[0]
else
  usage = &quot;Usage: #$0 port or #{$0}_port&quot;
  abort usage
end

collect(port)
</pre>
<p>Usage is the same as any wildcard munin plugin. </p>
<ol>
<li>Install the raindrops gem</li>
<li>Drop the above code in &#8220;/usr/share/munin/plugins/unicorn_connections_&#8221;</li>
<li>Create a link from &#8220;/etc/munin/plugins/unicorn_connections_UNICORNPORT&#8221; to the above script</li>
<li>killall -HUP munin-node</li>
</ol>
<p>Graphs should start showing up in five or ten minutes. You can always test like so:</p>
<pre class="brush: plain; title: ; notranslate">
$ nc localhost 4949
# munin node at unicorn.example.org
fetch unicorn_connections_6880
active.value 5
queued.value 0
.
quit
</pre>
<p>Of course, I use the Chef and the munin cookbook&#8217;s <a href="https://github.com/opscode/cookbooks/blob/master/munin/definitions/munin_plugin.rb">munin_plugin definition</a>, so my application&#8217;s cookbook has this additional code:</p>
<pre class="brush: plain; title: ; notranslate">
# required for unicorn_connections_ munin plugin
gem_package &quot;raindrops&quot;

munin_plugin &quot;unicorn_connections_&quot; do
  plugin &quot;unicorn_connections_6880&quot;
  create_file true
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2011/02/11/monitoring-unicorn-connections-with-munin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wrangling 32bit debs on a 64bit system</title>
		<link>http://blog.loftninjas.org/2010/12/23/wrangling-32bit-debs-on-a-64bit-system/</link>
		<comments>http://blog.loftninjas.org/2010/12/23/wrangling-32bit-debs-on-a-64bit-system/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 01:21:35 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=590</guid>
		<description><![CDATA[Typically directions for downloading a i386 version of a library for a x86_64 system link to a specific deb package and tell you to download it with wget. A new release of that package often breaks the link, so I wanted to document how to do this using apt. Unfortunately, it looks like apt won&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Typically directions for downloading a i386 version of a library for a x86_64 system link to a specific deb package and tell you to download it with wget. A new release of that package often breaks the link, so I wanted to document how to do this using apt. Unfortunately, it looks like <a href="http://lists.debian.org/deity/2009/07/msg00064.html">apt won&#8217;t download</a> a single deb if it can&#8217;t resolve dependencies, but aptitude will, so we use them together.</p>
<p>I use a separate sources.list here just to speed up the process, as we need to correct apt when we&#8217;re finished.</p>
<pre class="brush: plain; title: ; wrap-lines: false; notranslate">
# Download 32bit list files from the mirror specified in /tmp/sources.list
apt-get -o=APT::Architecture=&quot;i386&quot; -o=Dir::Etc::sourcelist=&quot;/tmp/sources.list&quot; -o=Dir::Etc::sourceparts=&quot;/dev/null&quot; update
# Download the single library. Set libstdc++5 to whatever library you want
aptitude -o Apt::Architecture=i386 download libstdc++5
# Return apts lists to their preconfigured state
apt-get update
# Optionally, install the package
dpkg --force-architecture -i libstdc++5_1%3a3.3.6-20~lucid1_i386.deb
</pre>
<p>Note that if you install the package, it would overwrite the 64bit version of the library if it is installed. 32bit packages meant for 64bit systems, like the ia32-libs package, install to /lib32 and /usr/lib32 to avoid this. You could also extract the package with &#8216;dpkg -x libstdc++5_1%3a3.3.6-20~lucid1_i386.deb&#8217; and copy the libraries to where you like, then run &#8216;ldconfig&#8217;. The <a href="http://ubuntuforums.org/showthread.php?t=474790">getlibs</a> tool will try to repack debs more appropriately for you, if you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/12/23/wrangling-32bit-debs-on-a-64bit-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>libvirtError: monitor socket did not show up</title>
		<link>http://blog.loftninjas.org/2010/12/03/libvirterror-monitor-socket-did-not-show-up/</link>
		<comments>http://blog.loftninjas.org/2010/12/03/libvirterror-monitor-socket-did-not-show-up/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 02:29:25 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=587</guid>
		<description><![CDATA[Sometimes errors don&#8217;t float to the top of stacks well. 
Our virtualization stack is pretty automated wherein we have a custom script that uses vmbuilder to create the guest, register it with libvirt, create first boot scripts that will have it register with a chef server, and start the VM. We saw this error today [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes errors don&#8217;t float to the top of stacks well. </p>
<p>Our virtualization stack is pretty automated wherein we have a custom script that uses vmbuilder to create the guest, register it with libvirt, create first boot scripts that will have it register with a chef server, and start the VM. We saw this error today <code>libvirtError: monitor socket did not show up.: Connection refused</code>, and I commented that my memory contained a lot of libvirt/kvm errors, and many resolutions, but the two don&#8217;t always stay connected. I checked the libvirt logs in /var/log/libvirt and even ran libvirt with <code>LIBVIRT_DEBUG=1 libvirtd -v</code>. When I tried running kvm by hand using the syntax in the logs, but with the -net options removed from the command line, kvm just spouted <code>Aborted</code>. After starting at it for a bit, I noticed that instead of <code>-m 1024</code> KVM was trying to run with <code>-m 1073741824</code> (1024^3). This was due to a small conversion bug in our custom script.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/12/03/libvirterror-monitor-socket-did-not-show-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon EC2 Network Subnets</title>
		<link>http://blog.loftninjas.org/2010/12/01/amazon-ec2-network-subnets/</link>
		<comments>http://blog.loftninjas.org/2010/12/01/amazon-ec2-network-subnets/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 01:10:56 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=578</guid>
		<description><![CDATA[For a project that exists both in Amazon Web Services EC2 US-EAST-1b and another cloud, I wanted to block network traffic between the two to ensure they didn&#8217;t affect each other. I started by doing an whois looking via ARIN for all of the IP addresses we are currently assigned in EC2, and I ultimately [...]]]></description>
			<content:encoded><![CDATA[<p>For a project that exists both in Amazon Web Services EC2 US-EAST-1b and another cloud, I wanted to block network traffic between the two to ensure they didn&#8217;t affect each other. I started by doing an whois looking via ARIN for all of the IP addresses we are currently assigned in EC2, and I ultimately got the same list that I found registered to the <a href="http://whois.arin.net/rest/org/AMAZO-4/nets">AMAZO-4</a> contact with ARIN, with the exception of AMAZON-AES, which I presume is for Amazon Enterprise Solutions. I couldn&#8217;t tell you offhand if the same IP blocks are used in other AWS zones.</p>
<table border="0" cellspacing="8">
<tbody>
<tr>
<th>Network</th>
<th>CIDR</th>
<th>Netmask</th>
<th>ARIN Name</th>
</tr>
<tr>
<td>72.44.32.0</td>
<td>/19</td>
<td>255.255.224.0</td>
<td>AMAZON-EC2-2</td>
</tr>
<tr>
<td>67.202.0.0</td>
<td>/18</td>
<td>255.255.192.0</td>
<td>AMAZON-EC2-3</td>
</tr>
<tr>
<td>75.101.128.0</td>
<td>/17</td>
<td>255.255.128.0</td>
<td>AMAZON-EC2-4</td>
</tr>
<tr>
<td>174.129.0.0</td>
<td>/16</td>
<td>255.255.0.0</td>
<td>AMAZON-EC2-5</td>
</tr>
<tr>
<td>204.236.128.0</td>
<td>/17</td>
<td>255.255.128.0</td>
<td>AMAZON-EC2-6</td>
</tr>
<tr>
<td>184.72.0.0</td>
<td>/15</td>
<td>255.254.0.0</td>
<td>AMAZON-EC2-7</td>
</tr>
<tr>
<td>50.16.0.0</td>
<td>/14</td>
<td>255.252.0.0</td>
<td>AMAZON-EC2-8</td>
</tr>
</tbody>
</table>
<p>Here are the IOS commands:</p>
<pre class="brush: plain; title: ; notranslate">
name 72.44.32.0 EC2-2 description AMAZON-EC2-2
name 67.202.0.0 EC2-3 description AMAZON-EC2-3
name 75.101.128.0 EC2-4 description AMAZON-EC2-4
name 174.129.0.0 EC2-5 description AMAZON-EC2-5
name 204.236.128.0 EC2-6 description AMAZON-EC2-6
name 184.72.0.0 EC2-7 description AMAZON-EC2-7
name 50.16.0.0 EC2-8 description AMAZON-EC2-8
object-group network ec2-us-east
   network-object 174.129.0.0 255.255.0.0
   network-object 184.72.0.0 255.254.0.0
   network-object 204.236.128.0 255.255.128.0
   network-object 50.16.0.0 255.252.0.0
   network-object 67.202.0.0 255.255.192.0
   network-object 72.44.32.0 255.255.224.0
   network-object 75.101.128.0 255.255.128.0
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/12/01/amazon-ec2-network-subnets/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Script hacks: waiting for the internet</title>
		<link>http://blog.loftninjas.org/2010/11/30/script-hacks-waiting-for-the-internet/</link>
		<comments>http://blog.loftninjas.org/2010/11/30/script-hacks-waiting-for-the-internet/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 03:52:32 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=571</guid>
		<description><![CDATA[Now and then the VMs (kvm, libvirt + vmbuilder) I was cranking out would start up too fast, and the &#8220;first boot&#8221; script would run before the host got an IP address and had internet access. Since the first thing I was doing was downloading the Rubygems source using wget (to install chef), and since [...]]]></description>
			<content:encoded><![CDATA[<p>Now and then the VMs (kvm, libvirt + vmbuilder) I was cranking out would start up too fast, and the &#8220;first boot&#8221; script would run before the host got an IP address and had internet access. Since the first thing I was doing was downloading the Rubygems source using wget (to install chef), and since wget lacks a <a href="https://bugzilla.redhat.com/show_bug.cgi?id=202956#c6">retry for dns failure</a>, I hacked up this script to wait for the internet a bit.</p>
<pre class="brush: plain; title: ; notranslate">
#!/bin/bash

# Wait for internet to come up (DHCP)
MAXWAIT=60
WAITTIME=0
host production.cf.rubygems.org &gt; /dev/null

while [ $? == 1 ] &amp;&amp; [ $WAITTIME -le $MAXWAIT ] ; do
  WAITTIME=$(($WAITTIME + 10))
  sleep 10
  echo -n .
  host production.cf.rubygems.org &gt; /dev/null
done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/11/30/script-hacks-waiting-for-the-internet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DNS-SD, a printer, and a little luck</title>
		<link>http://blog.loftninjas.org/2010/11/29/dns-sd-a-printer-and-a-little-luck/</link>
		<comments>http://blog.loftninjas.org/2010/11/29/dns-sd-a-printer-and-a-little-luck/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 05:21:08 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=565</guid>
		<description><![CDATA[DNS SD, also known as Apple&#8217;s Bonjour, utilizes DNS as a configuration database for automatic service discovery. For the most part, it appears its used by devices more than people. The multicast implementation, or mDNS, is what makes printers automatically show up in OS X when you put them on your network. I recently moved [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt">DNS SD</a>, also known as Apple&#8217;s Bonjour, utilizes DNS as a configuration database for automatic service discovery. For the most part, it appears its used by devices more than people. The multicast implementation, or mDNS, is what makes printers automatically show up in OS X when you put them on your network. I recently moved such a printer from a flat network, to one where the wired and wireless workstations were on separate subnets. In an attempt to make the printer easy to find, I implemented DNS SD over unicast so OS X laptops in the office could detect the <a href="http://developer.apple.com/networking/bonjour/bonjourprinting.pdf">printer with Bonjour</a>.</p>
<p>First, I set the Domain Name to &#8220;office.opscode.com&#8221; using DHCP, so I would have a nice sandbox to mess around with DNS without breaking anything. Then I created a few DNS records:</p>
<pre class="brush: plain; title: ; wrap-lines: false; notranslate">
OfficejetPro8500.office.opscode.com A 172.28.0.5
lb._dns-sd._udp.office.opscode.com PTR office.opscode.com.
b._dns-sd._udp.office.opscode.com PTR office.opscode.com.
_printer._tcp.office.opscode.com PTR _OfficejetPro8500._pdl-datastream._tcp.office.opscode.com.
_pdl-datastream._tcp.office.opscode.com PTR _OfficejetPro8500._pdl-datastream._tcp.office.opscode.com.
_OfficejetPro8500._pdl-datastream._tcp.office.opscode.com SRV 0 0 9100 OfficejetPro8500.office.opscode.com.
_OfficejetPro8500._pdl-datastream._tcp.office.opscode.com TXT &quot;txtvers=1&quot; &quot;note=Office Entry&quot; &quot;usb_MFG=HP&quot; &quot;usb_MDL=Officejet Pro 8500 A909g&quot; &quot;ty=HP Officejet Pro 8500&quot;
</pre>
<ol>
<li>Specifies the internal IP address of the resource. We use this later in the SRV record.</li>
<li>What domain the client should browse if they haven&#8217;t specified one.</li>
<li>What domain a client in this domain should browse.</li>
<li>Define a LPR/LPD printer. LPR is the &#8220;Flagship&#8221; protocol and &#8220;must&#8221; be defined (Port 515)</li>
<li>Define a PDL printer, sometimes called raw (Port 9100)</li>
<li>Specify the printer service. The last four fields there are priority, weight, port and host, per <a href="http://www.ietf.org/rfc/rfc2782.txt">RFC 2782</a>.</li>
<li>Provide additional configuration information related to the printer</li>
</ol>
<p>There isn&#8217;t a lot of clear information regarding how you should specify multiple key/value pairs in the TXT field. <a href="http://www.ietf.org/rfc/rfc1035.txt">RFC 1035</a> specifies, <em>&lt;character-string&gt; is a single length octet followed by that number of characters.  &lt;character-string&gt; is treated as binary information, and can be up to 256 characters in length (including the length octet)</em>. For Microsoft DNS, check out <a href="http://www.grouplogic.com/Knowledge/PDFUpload/Info/WanBonjour_1.pdf">this article</a>. I was using DynInc&#8217;s Dynect, and was able to put all the key/value pairs in double quotes in the single input field. Also, if you are too, use the &#8220;Expert Editor&#8221; which is a menu option under the &#8220;Simple Editor,&#8221; it is a little easier to specify the multi-part hostnames this way. It <a href="http://lists.apple.com/archives/macos-x-server/2007/Mar/msg00781.html">sounds like in bind</a> you put one key/value pair in double quotes per line, with the series wrapped in parenthesis.</p>
<p>Dynect wouldn&#8217;t let me specify the SRV record without a preceding underscore, which is a shame, because this is what OS X detects as the device name which also lower-cased it, making it a little difficult to read. You should be able to spaces in these names, but I wasn&#8217;t about to try escaping that. The key/value pairs in the TXT resource record are documented in the <a href="http://developer.apple.com/networking/bonjour/bonjourprinting.pdf">Apple Bonjour Printing specification</a>.</p>
<ul>
<li>txtvers / Define what version of this format we are using</li>
<li>note / User-readable information about the device, OS X displays this as Location</li>
<li>usb_MFG / the Manufacturer name that the USB driver would specify. I made educated guesses at these.</li>
<li>usb_MDL / the Model that the USB device would specify. Combined with the last field this will choose the driver for the user.</li>
<li>ty / a User-readable name for the device. I had hoped this would be used in the Printer Name field in the GUI, but it wasn&#8217;t.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/11/29/dns-sd-a-printer-and-a-little-luck/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>virt-manager keymaps on OS X</title>
		<link>http://blog.loftninjas.org/2010/11/17/virt-manager-keymaps-on-os-x/</link>
		<comments>http://blog.loftninjas.org/2010/11/17/virt-manager-keymaps-on-os-x/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 03:12:26 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=556</guid>
		<description><![CDATA[I&#8217;m not crazy about the lack of a definitive package manager for OS X. I tried for about a day to work with Open Source on OS X, then I built an Ubuntu VM. I&#8217;ve been using ssh with X forwarding when I need a graphical interface; OS X has reasonable good built in support [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not crazy about the lack of a definitive package manager for OS X. I tried for about a day to work with Open Source on OS X, then I built an Ubuntu VM. I&#8217;ve been using ssh with X forwarding when I need a graphical interface; OS X has reasonable good built in support for X11. However, others have found that the <a href="http://www.arnebrodowski.de/blog/keymap-problems-with-virt-manager.html">keymap</a> and <a href="http://shortbus.org/bloggin/2009/06/01/apples-x11-keymap-and-virt-manager/">meta keys</a> are broken. While I got a kick out of &#8220;After some time I discovered that the number 8 is interpreted as Return,&#8221; I did need to log in to a guest to do some debugging.</p>
<p>The <a href="http://shortbus.org/bloggin/2009/06/01/apples-x11-keymap-and-virt-manager/">accepted solution</a> to making Ctrl+Alt release keyboard focus correctly in the vncviewer spawned by virt-manager is to create a .Xmodmap file in your home directory with this content:</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
clear Mod1
keycode 66 = Alt_L
keycode 69 = Alt_R
add Mod1 = Alt_L
add Mod1 = Alt_R
</pre>
<p>I killed the X server by focusing on it and choosing quit, and it seemed to be read the .Xmodmap file okay without my needing to restart the entire system.</p>
<p>The workaround for the <a href="http://www.arnebrodowski.de/blog/keymap-problems-with-virt-manager.html">broken keymap</a> pointed me in the right direction, but I wasn&#8217;t happy with the solution. A little digging around the <a href="http://libvirt.org/formatdomain.html">libvirt domain xml</a> reference pointed out that you can add a keymap as an attribute to the vnc element in the domain xml definition. Use &#8216;virsh edit&#8217; to edit the domain XML and modify the vnc line to add this attribute so it looks like so:</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
&lt;graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1' keymap='en-us'/&gt;
</pre>
<p>I destroyed the guest and restarted it and the keyboard worked now without any &#8220;8 is now enter&#8221; trickery. I&#8217;m pretty sure you can <a href="http://www.mail-archive.com/libvir-list@redhat.com/msg13340.html">choose any keymap</a> from <code>/usr/share/qemu/keymaps</code>. If you use vmbuilder you will want to add this to <code>/etc/vmbuilder/libvirt/libvirtxml.tmpl</code> as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/11/17/virt-manager-keymaps-on-os-x/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Motorola Backflip charging</title>
		<link>http://blog.loftninjas.org/2010/10/23/motorola-backflip-charging/</link>
		<comments>http://blog.loftninjas.org/2010/10/23/motorola-backflip-charging/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 21:22:43 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=552</guid>
		<description><![CDATA[Nightmare.
Chargers:
AC1) Motorola DC4050US0301 5.1V DC 850MA
AC2) AT&#038;T 03577 5.0V 1000ma
DC1) AT&#038;T USB VPC03578
DC2) AT&#038;T USB + MiniUSB MV302927
Cables:
M1) Motorola SKN6378A
M2) &#8220;Motorola&#8221; SKN6238A
M3) Monoprice generic microusb
Dead Phone, AC1, M1 OR M2 OR M3
Green light on Phone, OS starts, displays charging battery
Dead Phone, AC2, M1 OR M2 OR M3
Blue light on AC2, Green light on Phone, OS [...]]]></description>
			<content:encoded><![CDATA[<p>Nightmare.</p>
<p>Chargers:</p>
<p>AC1) Motorola DC4050US0301 5.1V DC 850MA<br />
AC2) AT&#038;T 03577 5.0V 1000ma<br />
DC1) AT&#038;T USB VPC03578<br />
DC2) AT&#038;T USB + MiniUSB MV302927</p>
<p>Cables:</p>
<p>M1) Motorola SKN6378A<br />
M2) &#8220;Motorola&#8221; SKN6238A<br />
M3) Monoprice generic microusb</p>
<p>Dead Phone, AC1, M1 OR M2 OR M3<br />
Green light on Phone, OS starts, displays charging battery</p>
<p>Dead Phone, AC2, M1 OR M2 OR M3<br />
Blue light on AC2, Green light on Phone, OS starts<br />
Green light / OS cycle every 15 seconds</p>
<p>Dead Phone, DC1, M1 OR M2 OR M3<br />
White light on DC1, Green light on Phone, OS starts<br />
Green light / OS cycle every 15 seconds</p>
<p>Dead Phone, DC2, M1 OR M2 OR M3<br />
White light on DC2, Green light alternates on/off on Phone</p>
<p>Phone on, AC1, M1 OR M2 OR M3<br />
Green light on, charge symbol in battery on display</p>
<p>Phone on, AC2, M1<br />
Blue light on AC2 for five seconds</p>
<p>Phone on, AC2, M2 OR M3<br />
Blue light on AC2<br />
Green light on, no charge symbol in battery on display</p>
<p>I have an AT&#038;T AC charger at work that I believe works as well as the stock Motorola. The AT&#038;T AC charger here at home, listed above, is a &#8220;five star&#8221; model that consumes 0W when not charging, I assume that is what the blue light turning off indicates. Hopefully the combinations that keep the green light on the phone on are charging, just very slowly, and are still somewhat useful. More to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/10/23/motorola-backflip-charging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Munin Aggregation with Multigraph</title>
		<link>http://blog.loftninjas.org/2010/10/22/munin-aggregation-with-multigraph/</link>
		<comments>http://blog.loftninjas.org/2010/10/22/munin-aggregation-with-multigraph/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 00:33:50 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=535</guid>
		<description><![CDATA[Six months ago I made note to the pattern for referring to stacked graph data sources in munin:

load.double.stack one=localhost.localdomain:load.load two=localhost.localdomain:load.load
This syntax evaluates to:
graph.value.stack line=host.domain:plugin.value
I&#8217;ve been using multigraph more since then, which is a boon to performance, but it complicates stacked graphs a little. This hurts because it remains very difficult to tell why your graphs [...]]]></description>
			<content:encoded><![CDATA[<p>Six months ago I made note to the pattern for referring to <a href="http://blog.loftninjas.org/2010/04/08/an-evening-with-munin-graph-aggregation/">stacked graph data sources in munin</a>:</p>
<blockquote>
<pre>load.double.stack one=localhost.localdomain:load.load two=localhost.localdomain:load.load</pre>
<p>This syntax evaluates to:<br />
graph.value.stack line=host.domain:plugin.value</p></blockquote>
<p>I&#8217;ve been using multigraph more since then, which is a boon to performance, but it complicates stacked graphs a little. This hurts because it remains very difficult to tell why your graphs are not drawing when you incorrectly reference a data source. To debug, as the munin user (use &#8217;su -l munin&#8217;, &#8217;sudo -s -u munin&#8217; or &#8216;chpst -u munin&#8217;) run:<br />
<code>/usr/share/munin/munin-graph --service 'load.double.stack' --debug</code><br />
Be sure to replace &#8220;load.double.stack&#8221; with the name of the graph you&#8217;re trying to draw.</p>
<p>The <a href="http://munin-monitoring.org/wiki/aggregate_examples">munin wiki example for stacked graphs</a> explains data source names as:</p>
<pre class="brush: plain; title: ; notranslate">
snmp_ups_current.inputtotal.sum \
---------------- ---------- ---
        |             |      |
        |             |      `-- The sum mechanism
        |             `--------- One of this virtual plugin's values
        `----------------------- The name of the virtual plugin

ups-5a:snmp_ups_ups-5a_current.inputcurrent \
ups-5b:snmp_ups_ups-5b_current.inputcurrent
------ ----------------------- ------------
   |               |                 |
   |               |                 `------ The &quot;inputcurrent&quot; value from the real plugin
   |               `------------------------ The real plugin's name (symlink)
   `---------------------------------------- The host name from which to seek information
</pre>
<p>However, with multigraph the name of the plugins symlink isn&#8217;t necessarily the name of the graph. The trick I found was to connect the the munin node and call the multigraph plugin, looking for the &#8216;multigraph&#8217; line.</p>
<pre class="brush: plain; title: ; notranslate">
$ nc localhost 4949
# munin node at server.example.org
cap multigraph # tell munin-node that you are multigraph aware
cap multigraph
fetch diskstats # fetch the diskstats multigraph plugin
multigraph diskstats_latency
sdb_avgwait.value 0
multigraph diskstats_latency.sdb
avgwait.value 0
.
</pre>
<p>I&#8217;ve removed a significant portion of the returned data here. Pay attention to the fact that this plugin returned a &#8220;diskstats_latency&#8221; graph that contains data for all of the disks, as well as individual graphs for each disk, here &#8220;diskstats_latency.sdb&#8221; In this example your stacked graph configuration would be:</p>
<pre class="brush: plain; title: ; notranslate">
disk.double.stack \
  one=localhost.localdomain:diskstats_latency.sdb.avgwait \
  two=localhost.localdomain:diskstats_latency.sdb.avgwait
  -1- ----------2---------- -----------3--------- ---4---
</pre>
<p>(1) The alias and label for this host or data point<br />
(2) The configured node name of the host<br />
(3) The original graphs name, either the plugin or multigraph name<br />
(4) The value from the plugin/graph</p>
<p>Notice that while the period is used to separate the value from the rest of the field, there may be periods in the rest of the field. Also keep in mind that in the past I have seen dashes in configured graph names become underscores at the end of the day.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/10/22/munin-aggregation-with-multigraph/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Silent Ruby install on Windows</title>
		<link>http://blog.loftninjas.org/2010/09/28/silent-ruby-install-on-windows/</link>
		<comments>http://blog.loftninjas.org/2010/09/28/silent-ruby-install-on-windows/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 20:09:36 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=499</guid>
		<description><![CDATA[I dug up unattended ruby install directions while working on Chef installation directions for windows. Most of the secrets can be found in the RubyInstaller discussion group, such as here and here.
Grab the RubyInstaller for windows, then run: rubyinstaller-1.8.7-p302.exe /tasks="assocfiles,modpath" /silent. The tasks option checks (enables) the options to associated .rb files with ruby and [...]]]></description>
			<content:encoded><![CDATA[<p>I dug up unattended ruby install directions while working on <a href="http://wiki.opscode.com/display/chef/Installation+on+Windows">Chef installation directions for windows</a>. Most of the secrets can be found in the <a href="http://groups.google.com/group/rubyinstaller">RubyInstaller discussion group</a>, such as <a href="http://groups.google.com/group/rubyinstaller/browse_thread/thread/4b2cb71cf5567080/ec94510f5e2c2a0d">here</a> and <a href="http://groups.google.com/group/rubyinstaller/browse_thread/thread/8b936114861f6e30/3231e9ec2fbb2c36">here</a>.</p>
<p>Grab the <a href="http://rubyinstaller.org/downloads/">RubyInstaller</a> for windows, then run: <code>rubyinstaller-1.8.7-p302.exe /tasks="assocfiles,modpath" /silent</code>. The tasks option checks (enables) the options to associated .rb files with ruby and adding the ruby binary directory to the path. You probably wouldn&#8217;t want these if you were installing multiple versions of ruby.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/09/28/silent-ruby-install-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dependant Paradigms</title>
		<link>http://blog.loftninjas.org/2010/07/21/dependant-paradigms/</link>
		<comments>http://blog.loftninjas.org/2010/07/21/dependant-paradigms/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 06:33:10 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=489</guid>
		<description><![CDATA[The Systems Administrator is likely the closet technological trade to skilled manual labor. They troubleshoot complex systems that others take for granted, until they fail, with a deceptive ease. Explaining to another how they had a hunch to look at a certain part of the system is either a retrospective tale of why it made [...]]]></description>
			<content:encoded><![CDATA[<p>The Systems Administrator is likely the closet technological trade to skilled manual labor. They troubleshoot complex systems that others take for granted, until they fail, with a deceptive ease. Explaining to another how they had a hunch to look at a certain part of the system is either a retrospective tale of why it made sense, or a sarcastic nod to magic. This tale attempts to work out how one could have deduced the solution, but even if someone assembled a collection of symptoms and solutions into a step-by-step guide, they would not be able to replace the role of a Systems Administrator. Like an automotive mechanic can detect a blown head gasket from the smell of the oil, a Systems Administrator can sense infrastructure issues from how systems are behaving. And like a fondness for a make of automobile, we grow attached to Linux distributions that have treated us well and editors whose dark secrets we can manipulate skillfully.</p>
<p>I once had a student who didn&#8217;t understand why we couldn&#8217;t repair board-level hardware issues ourselves as easily as replacing a stick of memory, as their uncle was capable of repairing any engine problems by opening up the hood and quite literally &#8220;jiggling some wires.&#8221; A mystic knowledge exists in both worlds that is challenging to articulate to the layman. It can be difficult enough to explain a single component, but when a part of a system falls over and causes cascading failures in other parts of a system, outsiders are tempted to believe that they&#8217;ve just learned a truth about the solution. That is, that when certain symptoms occur, it is always caused by the failure of a particular part and that this part should be restarted to &#8217;solve&#8217; the problem. Yet, the experienced know that this only resolves the symptoms and the still problem lurks, now with fewer hints as to its origin.</p>
<blockquote><p>The future is already here &#8211; it is just unevenly distributed. &#8212; William Gibson</p></blockquote>
<p>The trouble with paradigm shifts is that they aren&#8217;t necessarily direct improvements on existing technology with a clear lineage. Critics ask why the new ways are better than that which they replace, and we struggle to draw the path that led us to this new place of understanding. The struggle is because instead of making a choice at a clear intersection of a path, we stepped through the bushes to another path not as obviously traveled. This alternate path may lead us to the same end, but its course has an entirely different shape. </p>
<p>To further exacerbate the problem, new innovations stand on the shoulders of giants. Some people have been convinced of the merits of leveraging cloud computing on a strictly financial basis, and have missed the tenants of Undifferentiated Heavy Lifting (UHL), where running servers and building networks may not be ones core business and ultimately a distraction. Some have yet to grasp the concept of treating systems, even built on internal hardware, as disposable, still accustomed to legacy processes of maintaining a system for the lifetime of the hardware.</p>
<p>It is essential to realize that these new technologies are not minor improvements to business as usual. Like the birth of globalization changing business around the world, nursed by the multi-modal shipping container&#8217;s head fake as just another way of moving cargo, todays innovations will surely reshape the face of operations permanently, in substantial and non-incremental ways.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/07/21/dependant-paradigms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Amazon ELB requires CRLF for HTTP Requests</title>
		<link>http://blog.loftninjas.org/2010/04/09/amazon-elb-requires-crlf-for-http-requests/</link>
		<comments>http://blog.loftninjas.org/2010/04/09/amazon-elb-requires-crlf-for-http-requests/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 20:13:48 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=486</guid>
		<description><![CDATA[Here&#8217;s an interesting bit I stumbled upon while playing with Amazon Web Services (AWS) Elastic Load Balancing (ELB): HTTP requests must have their lines terminated with CRLF and not just a line feed. When using netcat to test a web server by speaking HTTP, it only sends LFs by default (\n). While RFC 2616 specifies:
&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an interesting bit I stumbled upon while playing with Amazon Web Services (AWS) Elastic Load Balancing (ELB): HTTP requests must have their lines terminated with CRLF and not just a line feed. When using netcat to test a web server by speaking HTTP, it only sends LFs by default (\n). While <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> specifies:</p>
<blockquote><p>&#8230; a bare CR or LF MUST NOT be substituted for CRLF within any of the HTTP control structures &#8230;</p></blockquote>
<p>Using netcat to connect to a web server typically works just fine. I&#8217;m inputting the HTTP requests by hand and [ENTER] is where I hit the enter key.</p>
<pre>
$ nc www.google.com 80
GET / HTTP/1.0[ENTER]
[ENTER]
HTTP/1.0 200 OK
Date: Fri, 09 Apr 2010 20:07:25 GMT
Expires: -1
[snip]
</pre>
<p>This works against Apache. However when connecting to an Apache server through ELB, one must run netcat with the -C option to send a CRLF instead of a lone LF upon return.</p>
<pre>
$ nc -C elb.example.org 80
GET / HTTP/1.0[ENTER]
[ENTER]
HTTP/1.1 302 Found
Content-Type: text/html; charset=iso-8859-1
Date: Fri, 09 Apr 2010 20:09:39 GMT
Location: http://elb.example.org/404/
Server: Apache
Vary: Accept-Encoding
Content-Length: 290
Connection: Close
</pre>
<p>Sans the -C option, the connection simply hangs. Which asks the question, what is Amazon doing with your HTTP traffic in between?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/04/09/amazon-elb-requires-crlf-for-http-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>an evening with Munin graph aggregation</title>
		<link>http://blog.loftninjas.org/2010/04/08/an-evening-with-munin-graph-aggregation/</link>
		<comments>http://blog.loftninjas.org/2010/04/08/an-evening-with-munin-graph-aggregation/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 02:44:01 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=466</guid>
		<description><![CDATA[Trending?
I&#8217;m often a bit surprised by the lack of substance about trending that leaks out on the Internet. I mean, everybody is doing it. Right? Munin is a great introduction to trending due to its simplicity in getting started and the wealth of plugins.
I&#8217;m a believer of collecting as much data as possible and sorting [...]]]></description>
			<content:encoded><![CDATA[<h3>Trending?</h3>
<p>I&#8217;m often a bit surprised by the lack of substance about trending that leaks out on the Internet. I mean, everybody is doing it. <em>Right? </em><a href="http://munin-monitoring.org/">Munin</a> is a great introduction to trending due to its simplicity in getting started and the wealth of <a href="http://muninexchange.projects.linpro.no/">plugins</a>.</p>
<p>I&#8217;m a believer of <a href="http://lethargy.org/~jesus/writes/reconnoiter-and-another-platform">collecting as much data as possible and sorting it out later</a>. Without data, you can only speculate wildly at what it might have said. <a href="http://mettadore.com/ruby/ruby-cant-scale/">So will others</a>, so it&#8217;s nice having a response; often they won&#8217;t. I don&#8217;t need to be looking at the disk latency or available entropy for dozens of servers every day, but the time saved by being able to look at these graphs when something occurs and make correlations between trends is revolutionary to how you will spend your day. When having too much data can feel overwhelming, it&#8217;s time to post-process it into something more bite-size.</p>
<p>Still, I run operations for a web product and there is data I do want to see every day, both to monitor the health of the product and <a href="http://www.amazon.com/Art-Capacity-Planning-Scaling-Resources/dp/0596518579">plan capacity</a> for upcoming growth. Aggregating data for multiple systems and creating a sort of executive trending console helps accomplish this.</p>
<h3>Getting Started</h3>
<p>The best way to get familiar with munin is to install it on a debian or ubuntu workstation. Installing the &#8216;munin&#8217; (server) and &#8216;munin-node&#8217; (client) packages will be enough to generate some graphs about your local machine. Go ahead and run:</p>
<p><code>sudo su munin -s /bin/bash -c 'time /usr/bin/munin-cron'</code></p>
<p>Then point your browser at file:///var/cache/munin/www/index.html.</p>
<h3>Aggregates</h3>
<p>Aggregate graphs are created by munin-graph from existing data in the <a href="http://oss.oetiker.ch/rrdtool/">RRDs</a> collected by munin-update. There are two types of aggregates: <a href="http://munin-monitoring.org/wiki/faq#Q:HowdoIusefieldname.sum">sum</a> and <a href="http://munin-monitoring.org/wiki/faq#Q:HowdoIusefieldname.stack">stack</a>. Sum will show you the total of multiple data sets. The Munin wiki uses the aggregate current between two UPS&#8217;s as <a href="http://munin-monitoring.org/wiki/aggregate_examples">an example</a>. Sum is most useful when the data sets are relatively meaningless individually. For instance if you wanted to know the total current CPU usage in a 50-node cluster, each node is not particularly interesting alone, but the sum would be. Stack provides the data sets visually stacked on a single graph. The Munin wiki uses the total entropy between two systems as <a href="http://munin-monitoring.org/wiki/stack_examples">their example</a>, which isn&#8217;t particularly interesting. I&#8217;ll use some similarly uninteresting examples, but later I&#8217;ll show one that produces a stack comparing data in multiple datacenters.</p>
<p>Lets look at a simple example /etc/munin/munin.conf file with an aggregate graph similar to what is in the munin.conf man page:</p>
<pre class="brush: plain; title: ; notranslate">
[localhost.localdomain]
address 127.0.0.1
use_node_name yes

[localdomain;Totals]
update no

load.graph_title 2xload
load.double.stack one=localhost.localdomain:load.load two=localhost.localdomain:load.load
</pre>
<p>This will create a graph that shows the local systems load twice in a graph by stacking the same value.</p>
<p>Munin separates hosts by domain in more ways than just the html index that munin-html puts out. By default hosts are put into a &#8220;group&#8221; by their domain name. If an aggregate graph attempts to reference data values from a host in another group, munin may not find it and fail to clearly notify as to why. You can manually place a node in a group as we do above where we put the virtual host &#8220;Totals&#8221; in the &#8220;localdomain&#8221; group by entitling the section &#8220;[localdomain;Totals]&#8221; on line 5. Your groups can be called anything, they don&#8217;t have to be a domain name.</p>
<p>The &#8220;update no&#8221; directive on line 6 tells munin-update to skip this section, or hos since these graphs are created entirely from data collected from other hosts. Please note that you typically still need to run munin-update <strong>before</strong> munin-graph to get configuration changes to aggregate graphs to appear in the graph. Munin appears to bailout on drawing a graph if it sees no new data for that graph pretty early in the process.</p>
<p>Typically failures in this area of configuration result in a new graph not being created but munin-graph appearing to run successfully otherwise. Note that <a href="http://munin-monitoring.org/wiki/graph_title">graph_title</a> is <strong>required</strong>. If you see an error that looks like:</p>
<p><code>2010/04/08 18:43:46 [RRD ERROR] Unable to graph /var/cache/munin/www/localdomain/Totals/load-year.png : opening '': No such file or directory</code></p>
<p>This is because munin was unable to find a data set, or specifically the RRD file, based on the value you specified. Both of the following lines cause this error and the graph to not be drawn:</p>
<pre>load.double.stack one=localhost.localdomain:load.load two=localhost.localdomainX:load.load
load.double.stack one=localhost.localdomain:load.load two=localhost.localdomain:load.loadX</pre>
<p>This syntax evaluates to:<br />
graph.value.stack line=host.domain:plugin.value</p>
<p>Line, also called alias, ends up being the label for that line. Often dashes are inconsistently converted to underscores in Munin. I have a working plugin called &#8216;foo_js-3_0&#8242;, which I have to specify as &#8216;foo_js_3_0&#8242; in the above syntax.</p>
<pre class="brush: plain; title: ; notranslate">
[localhost.localdomain]
    address 127.0.0.1
    use_node_name yes

[localdomain;Totals]
  update no

  load.graph_title 2xload
  load.double.sum localhost.localdomain:load.load localhost.localdomain:load.load
  load.double.label Double the load
</pre>
<p>Here is the same example but displayed as a sum. Note that we&#8217;ve added &#8216;load.double.label&#8217;, and this is <strong>required</strong>. This replaces the &#8216;alias&#8217; or &#8216;line&#8217; value we were just discussing in stacked graphs, which you will notice is no longer in the configuration line for &#8216;fieldname.sum&#8217; on line 9.</p>
<h3>Making it useful</h3>
<p>Here is a proof of concept configuration that I made that counts some javascript calls in different datacenters</p>
<pre class="brush: plain; title: ; notranslate">
# Aggregrates
[example.org;OTS]
  update no
  contacts no

  js-3_0.update no
  js-3_0.graph_category example
  js-3_0.graph_title CAPI3 OTS Calls
  js-3_0.graph_total Total calls per minute
  js-3_0.graph_scale no
  js-3_0.graph_period minute
  js-3_0.graph_args --base 1000 -l 0
  js-3_0.graph_order iad irl las
  js-3_0.total.graph no
    js-3_0.iad.label IAD calls per minute
    js-3_0.iad.sum \
      iadots02.example.org:example_js_3_0.calls \
      iadots01.example.org:example_js_3_0.calls   

    js-3_0.irl.label IRL calls per minute
    js-3_0.irl.sum \
      irlots02.example.org:example_js_3_0.calls \
      irlots01.example.org:example_js_3_0.calls   

    js-3_0.las.label LAS calls per minute
    js-3_0.las.sum \
      lasots02.example.org:example_js_3_0.calls \
      lasots03.example.org:example_js_3_0.calls \
      lasots06.example.org:example_js_3_0.calls \
      lasots04.example.org:example_js_3_0.calls \
      lasots05.example.org:example_js_3_0.calls \
      lasots01.example.org:example_js_3_0.calls
</pre>
<p>This creates the below graph. The jagged lines at the left edge are from missing data values while I was working out some of the issues I describe in this post. There are a couple new directives in this configuration. The &#8216;contacts&#8217; directive on line 4 specifies that if we had munin configured for monitoring (as opposed to trending) we don&#8217;t want it to provide any notification based on the graph values for this virtual host. This is the job of <a href="http://munin-monitoring.org/wiki/munin-limits">munin-limits</a>. The &#8216;graph_category&#8217; directive allows us to put this graph in a category that we specify, otherwise Munin puts it in &#8216;other&#8217;. This is particularly useful if you have different types of aggregate graphs data such as CPU and Apache related data on the same virtual host. The &#8216;graph_total&#8217; directive on line 9 isn&#8217;t that well documented but provides a simple way to add the black total line you see in the graph and is therefore quite useful. Lines 10-12 control <a href="http://munin-monitoring.org/wiki/plugin-bcp#Graphscaling">how the graph is drawn</a> and are outside the scope of this post. The &#8216;<a href="http://munin-monitoring.org/wiki/graph_order">graph_order</a>&#8216; directive seems to give us the ability to control the order in which the fields are drawn on the graph, but is documented as a method to control the order in which the graphs are drawn to specify complex data dependencies.<br />
<img src="http://blog.loftninjas.org/wp-content/uploads/2010/04/js-3_0-day.png" alt="JS3 Calls Per Day" title="JS3 Calls Per Day" width="481" height="311" /></p>
<h3>Configuration Management!</h3>
<p>For fun, here is the <a href="http://wiki.opscode.com/display/chef/Home">Chef</a> template that created this, which allows additional nodes be added automatically, but is still ultimately incomplete.</p>
<pre class="brush: plain; title: ; notranslate">
[example.org;OTS]
  update no
  contacts no

  &lt;% wop_datacenters = [ &quot;iad&quot;, &quot;irl&quot;, &quot;las&quot; ] -%&gt;

  js-3_0.update no
  js-3_0.graph_category example
  js-3_0.graph_title CAPI3 OTS Calls
  js-3_0.graph_total Total calls per minute
  js-3_0.graph_scale no
  js-3_0.graph_period minute
  js-3_0.graph_args --base 1000 -l 0
  js-3_0.graph_order &lt;%= wop_datacenters.join(&quot; &quot;) %&gt;
  js-3_0.total.graph no
  &lt;% wop_datacenters.each do |dc| -%&gt;
    js-3_0.&lt;%= dc %&gt;.label &lt;%= dc.upcase %&gt; calls per minute
    js-3_0.&lt;%= dc %&gt;.sum \
    &lt;% dc_servers = @ots_servers.select { |host| host['hostname'] =~ Regexp.new(dc) }.select { |host| host['hostname'] !~ /pp/ } -%&gt;
    &lt;% dc_servers.each_with_index do |host, index| -%&gt;
      &lt;%= host['fqdn'] %&gt;:example_js_3_0.calls &lt;%= '\\' unless dc_servers.length - 1 == index %&gt;
    &lt;% end -%&gt;

  &lt;% end -%&gt;
</pre>
<h3>When it does not work</h3>
<p>Debugging munin can be really tough. I keep stopping myself from breaking into explanation of munin&#8217;s process, but something as innocent as as an omitted &#8216;graph_title&#8217; can cause munin to all but silently fail at producing a graph for you. Normally munin runs every give minutes via cron, usually via the &#8216;munin-cron&#8217; wrapper, but you can run the parts individually to look for issues. These tools create a lockfile when they run so they won&#8217;t interfere with the regular process if it is started by cron.</p>
<p><code>user@localhost:~$ </code><code>sudo su - munin -s /bin/bash<br />
</code><code>munin@localhost:~$ </code><code>/usr/share/munin/munin-update --debug --nofork<br />
</code><code>munin@localhost:~$ </code><code>/usr/share/munin/munin-graph --debug --nofork --nolazy<br />
</code><code>munin@localhost:~$ </code><code>/usr/share/munin/munin-html --debug</code></p>
<p>In larger infrastructures, you can limit munin-update and munin-graph to specific host and service combinations while testing.  Be wary that these sometimes will appear more successful than they are:</p>
<p><code>munin@localhost:~$ /usr/share/munin/munin-update --debug --nofork --host nonexistent --service nonexistent<br />
2010/04/08 17:13:23 [DEBUG] Creating new lock file /tmp/munin-update.lock<br />
2010/04/08 17:13:23 [DEBUG] Creating lock : /tmp/munin-update.lock succeeded<br />
2010/04/08 17:13:23 [INFO]: Starting munin-update<br />
2010/04/08 17:13:23 [DEBUG] Creating new lock file /tmp/munin-datafile.lock<br />
2010/04/08 17:13:23 [DEBUG] Creating lock : /tmp/munin-datafile.lock succeeded<br />
2010/04/08 17:13:23 [INFO]: Munin-update finished (0.00 sec)<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/04/08/an-evening-with-munin-graph-aggregation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting a permanent Windows Hostname on EC2</title>
		<link>http://blog.loftninjas.org/2010/02/12/setting-a-permanent-windows-hostname-on-ec2/</link>
		<comments>http://blog.loftninjas.org/2010/02/12/setting-a-permanent-windows-hostname-on-ec2/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 07:56:36 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=464</guid>
		<description><![CDATA[In less than obvious fashion, Amazon EC2 Windows Server AMIs reset their hostname on startup due to the Ec2ConfigService. To disable this feature, select &#8216;EC2ConfigService Settings&#8217; from the start menu, and uncheck the first checkbox under &#8216;Set Computer Name&#8217;
]]></description>
			<content:encoded><![CDATA[<p>In less than obvious fashion, Amazon EC2 Windows Server AMIs reset their hostname on startup due to the Ec2ConfigService. To disable this feature, select &#8216;EC2ConfigService Settings&#8217; from the start menu, and uncheck the first checkbox under &#8216;Set Computer Name&#8217;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/02/12/setting-a-permanent-windows-hostname-on-ec2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Configuration Management vs Meatcloud: 5 reasons CM wins</title>
		<link>http://blog.loftninjas.org/2010/01/22/configuration-management-vs-meatcloud-5-reasons-cm-wins/</link>
		<comments>http://blog.loftninjas.org/2010/01/22/configuration-management-vs-meatcloud-5-reasons-cm-wins/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 22:21:45 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[configuration management]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=462</guid>
		<description><![CDATA[First, a bit of social commentary.
Sometimes we refer to the way something ought to be accomplished as the RightWay[tm], sarcastically noting that every best practice contains a certain degree of opinion. As we dedicate more time to doing something our way, we become invested in it being the RightWay, and risk becoming defensive about our [...]]]></description>
			<content:encoded><![CDATA[<p>First, a bit of social commentary.</p>
<p>Sometimes we refer to the way something ought to be accomplished as the RightWay<a href="http://en.wikipedia.org/wiki/Trademark">[tm]</a>, sarcastically noting that every best practice contains a certain degree of opinion. As we dedicate more time to doing something our way, we become invested in it being the RightWay, and risk becoming defensive about our choices. Adam Jacob calls this &#8220;survivorship-bias,&#8221; and I&#8217;ve spent some time listening to him think about what he feels the risks are, and considering them myself. When we make significant personal investment in a choice, it becomes a personal challenge to remain impartial about the merits of that choice over time.</p>
<p>I&#8217;ve <a href="http://blog.loftninjas.org/2009/06/20/the-configuration-management-revolution/">previously</a> said that Configuration Management is the act of programatically configuring your systems. Cloud computing says that building servers is undifferentiated heavy lifting; unless your service is building servers, you should really let someone else do it and focus on the product or service you&#8217;re actually trying to sell. Configuration Management is the first step in bringing this same ideology to configuring systems. We are not in the business of selling configured servers any more than we are in the business of providing coffee to our employees, we happen to do both.  We build our systems to enable our business to conduct business. In my case, operations is enabling our customers to use the web product that we develop.</p>
<p>We are all members of the Configuration Management community, because we believe it is ultimately a better process for building systems. We naturally have different ideas about <a href="http://stochasticresonance.wordpress.com/2010/01/20/puppet-chef-dependencies-and-worldviews/">how that process should execute</a>, which among other differentiating factors is often that &#8220;<a href="http://sysdyn.clexchange.org/sdep/Roadmaps/RM1/D-4468-2.pdf">goals are different but are left unstated</a>&#8221; in the community. The level of preference here and resulting fragmentation is not any different than holding an opinion over what open source operating system one should use for a specific task. The merits of our choices are worth discussing, but the implication that tools and libraries should all come to the same conclusions about design is like implying that the world only needs one type of <a href="http://en.wikipedia.org/wiki/Hammer">hammer</a>.</p>
<p>So, defining the <a href="http://stochasticresonance.wordpress.com/2008/04/27/shared-metaphor-gnome-cloud-meat-pastries-20/">meatcloud</a> as the established notion that having your internet presence grow forms a direct relationship with hiring more people to rack servers, <a href="http://stochasticresonance.wordpress.com/2009/04/01/meatcloud-manifesto/">install software</a>, and update configuration files; I asked around a little, why do we think Configuration Management is better?</p>
<ul>
<li><strong>Abstractation</strong></li>
<p>You don&#8217;t need to be a mechanic to drive a car, should you need to be a subject matter expert on Apache to run a webserver? <a href="http://stochasticresonance.wordpress.com/2009/07/12/infrastructure-renaissance/">Infrastructure as code</a> shows us how and <a href="http://blog.loftninjas.org/2009/10/30/opscode-cookbooks-community-announced/">the resulting communities</a> are starting to implement this. When we spend less time getting the parts working, we can spend more time innovating better solutions with the parts.</p>
<li><strong>Self-documenting</strong></li>
<p>Ever rebuild a server that someone built long ago and is no longer with the organization, and find many small parts necessary to make it work that nobody bothered to write down? Placing those small changes and required files in configuration management ensures that even if the code doesn&#8217;t run flawlessly on an upgraded operating system, you know everything that went in to making it work. Since you&#8217;re configuring the system through configuration management, a lot less falls through the cracks because documentation is often an afterthought to getting the system working.</p>
<li><strong>Consistency and Repeatability</strong></li>
<p>What is on that system? Everything you told CM to put there. &#8216;<a href="http://madstop.com/2009/02/04/golden-image-or-foil-ball/">Golden image</a>&#8216; disk images often leave you in the aforementioned situation where you don&#8217;t know how to recreate them, but often you don&#8217;t know what else ended up there. Configuration Management allows you to build many copies of the same system easily, from scratch every time.</p>
<li><strong>Agility</strong></li>
<p>Did sales tell you they had fifty customers and it turned out to be five hundred? How long will it take you to build the extra servers by hand? How many extra people do you have to put into the meatcloud to get that done in time? Business requirements always change, and slow moving businesses are at a disadvantage to dealing with this. The inability to build and deploy servers fast enough should never be a reason your business fails.</p>
<li><strong>Flexibility, or Don&#8217;t Repeat Yourself</strong></li>
<p>Three applications on one server? Or one application on three servers? Apache doing different jobs on multiple servers? Moving applications between servers and leveraging existing infrastructure code for new projects is easy. We automate tasks that are repeatable, but often scripts are written to accomplish one repeatable task. Here we say, how can we treat configuration as sets of modular tasks that we can mix and match?</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/01/22/configuration-management-vs-meatcloud-5-reasons-cm-wins/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Got recursion not available and Cisco SSL VPN</title>
		<link>http://blog.loftninjas.org/2010/01/06/got-recursion-not-available-and-cisco-ssl-vpn/</link>
		<comments>http://blog.loftninjas.org/2010/01/06/got-recursion-not-available-and-cisco-ssl-vpn/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 21:37:12 +0000</pubDate>
		<dc:creator>btm</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.loftninjas.org/?p=455</guid>
		<description><![CDATA[I&#8217;ve periodically been having DNS lookup issues with internal domains and isolated them to remote SSL VPN clients connecting to a Cisco ASA 5520 using the Anyconnect SSL VPN client. I eventually got frustrated and troubleshooted the issue by using the command line &#8216;vpn&#8217; client to initiate a connection on a remote Ubuntu Linux machine [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve periodically been having DNS lookup issues with internal domains and isolated them to remote SSL VPN clients connecting to a Cisco ASA 5520 using the Anyconnect SSL VPN client. I eventually got frustrated and troubleshooted the issue by using the command line &#8216;vpn&#8217; client to initiate a connection on a remote Ubuntu Linux machine while here in the office. nslookup would produce the error &#8220;Got recursion not available from x.x.x.x, trying next server&#8221; and dig would respond with &#8220;status: REFUSED&#8221; and &#8220;;; WARNING: recursion requested but not available&#8221;. I noticed traffic was not making it to the Windows Server 2008 DNS server by watching wireshark and enabling DNS debugging.</p>
<p>Having been acquired six months ago our list of internal domains increased quite a bit. I found the &#8217;split-dns&#8217; setting in the default group access policy set to the old list of internal domains and set this to &#8217;split-dns none&#8217;. This resolved the issue. Apparently the client was comparing the query to its list of split-dns domains, and the match was failing so it was sending the resolver (operating system) an error message so it would go through the list of DNS servers until it tried the local server. Rather than trying to make a list of all the possible domain names in the company, I&#8217;m going to leave this off since the internal DNS servers have recursion enabled and can handle DNS lookups just fine for the remote clients.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.loftninjas.org/2010/01/06/got-recursion-not-available-and-cisco-ssl-vpn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

