<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>sheepy.org</title>
 <link href="http://sheepy.org/atom.xml" rel="self"/>
 <link href="http://sheepy.org/"/>
 <updated>2011-12-11T23:39:26+00:00</updated>
 <id>http://sheepy.org/</id>
 <author>
   <name>sheepy.org</name>
   <email>cornet@sheepy.org</email>
 </author>

 
 <entry>
   <title>Munin and Graphite, using bunny this time.</title>
   <link href="http://sheepy.org/2011/12/11/munin-graphite-bunny/"/>
   <updated>2011-12-11T00:00:00+00:00</updated>
   <id>http://sheepy.org/2011/12/11/munin-graphite-bunny</id>
   <content type="html">&lt;p&gt;After reading &lt;a href='http://www.devco.net/archives/2011/12/11/common-messaging-patterns-using-stomp-%E2%80%93-part-2.php'&gt;this&lt;/a&gt; post by &lt;a href='https://twitter.com/#!/ripienaar'&gt;@ripienaar&lt;/a&gt; I decided I would re-visit my munin-graphite setup to make it somewhat more elegant.&lt;/p&gt;

&lt;p&gt;While the article advocates the use of stop I would prefer to stick with Graphite&amp;#8217;s built in AMQP support if possible but I agree that the amqp gem is far from elegant. Not what you want if you&amp;#8217;re a sysadmin needing to solve a problem quickly.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve seen &lt;a href='https://github.com/ruby-amqp/bunny/wiki'&gt;bunny&lt;/a&gt; in passing but never used it before. Turns out it&amp;#8217;s quite nice. Also, again from a previous article from &lt;a href='http://www.devco.net/archives/2011/10/02/interact-with-munin-node-from-ruby.php'&gt;@ripienaar&lt;/a&gt;, the &lt;a href='https://github.com/sosedoff/munin-ruby'&gt;munin-ruby&lt;/a&gt; gem caught my eye.&lt;/p&gt;

&lt;p&gt;Not too long later I&amp;#8217;d replaced my original implementation with something a lot simpler. As ever it needs some work whch I&amp;#8217;ll hopefully get round to this week however here is the new code:&lt;/p&gt;
&lt;script src='https://gist.github.com/1463505.js?file=munin-graphite.rb' /&gt;</content>
 </entry>
 
 <entry>
   <title>Munin and Graphite</title>
   <link href="http://sheepy.org/2011/12/02/munin-graphite/"/>
   <updated>2011-12-02T00:00:00+00:00</updated>
   <id>http://sheepy.org/2011/12/02/munin-graphite</id>
   <content type="html">&lt;p&gt;&lt;a href='http://munin-monitoring.org/'&gt;Munin&lt;/a&gt; is a great piece of software for monitoring servers. However it&amp;#8217;s well known that it&amp;#8217;s central poller sucks at scale.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://graphite.wikidot.com/'&gt;Graphite&lt;/a&gt; looks like just the ticket for collating stats so I spent of my spare time recently investigating. After some research I found &lt;a href='https://github.com/adamhjk/munin-graphite'&gt;munin-graphite&lt;/a&gt; which was what I wanted to punt data from Munin to Graphite. However I wanted to decouple the two by using AMQP.&lt;/p&gt;

&lt;p&gt;Graphite now supports AMQP nateively although doesn&amp;#8217;t admit to it. If you check out the latest version you&amp;#8217;ll find carbon.amqp.conf.example which contains all you need to get started.&lt;/p&gt;

&lt;p&gt;So now I&amp;#8217;ve got Graphite consuming from AMQP I just needed to modify &lt;a href='https://github.com/adamhjk/munin-graphite'&gt;munin-graphite&lt;/a&gt; submit it&amp;#8217;s data how I wanted.&lt;/p&gt;

&lt;p&gt;The result of which is my own &lt;a href='https://github.com/cornet/munin-graphite'&gt;fork&lt;/a&gt;. Just customise munin-graphite-daemon.rb to your needs. I&amp;#8217;ve hhad it running for around a month now with no problems. YMMV as always.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Rake for config deployment</title>
   <link href="http://sheepy.org/2011/12/02/Rake-for-config-deployment/"/>
   <updated>2011-12-02T00:00:00+00:00</updated>
   <id>http://sheepy.org/2011/12/02/Rake-for-config-deployment</id>
   <content type="html">&lt;p&gt;I&amp;#8217;m a great advocator of &lt;a href='http://puppetlabs.com/'&gt;puppet&lt;/a&gt; or any configuration management tool. However sometimes it&amp;#8217;s an overkill. We have a number of servers which are not puppet controlled for various reason but we push new configurations out to them regularly.&lt;/p&gt;

&lt;p&gt;For some things we have scripts to push the configs out and of course, some we don&amp;#8217;t. This occasionally leads to problems.&lt;/p&gt;

&lt;p&gt;Taking the example of a DNS server, easy to configure, easy to mess up and easy not to notice when you&amp;#8217;ve messed up (until the TTL runs out).&lt;/p&gt;

&lt;p&gt;The more commands you have to issue, the more likely a mistake is to be made.&lt;/p&gt;

&lt;p&gt;There are many hammers for this nail but ruby is my weapon of choice these days so I&amp;#8217;ve knocked up a quick Rakefile to do everything. So all I need do is rake deploy and it&amp;#8217;ll do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sync the config out&lt;/li&gt;

&lt;li&gt;Set the correct permissions&lt;/li&gt;

&lt;li&gt;Run named-checkzone against all the zonefiles&lt;/li&gt;

&lt;li&gt;Reload the config if the checks pass&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To avoid creating loads of SSH connections I&amp;#8217;ve employed the &lt;a href='https://github.com/jamis/net-ssh-multi'&gt;Net::SSH::Multi&lt;/a&gt; gem which is definitly worth a look.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='ruby'&gt;&lt;span class='c1'&gt;#&lt;/span&gt;
&lt;span class='c1'&gt;# Configuration&lt;/span&gt;
&lt;span class='c1'&gt;#&lt;/span&gt;
&lt;span class='vg'&gt;$ssh_user&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;foo&amp;quot;&lt;/span&gt;
&lt;span class='vg'&gt;$ssh_host&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;example.com&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;remote_root&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;/etc/bind&amp;quot;&lt;/span&gt;

&lt;span class='n'&gt;rsync&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;rsync -a -e &amp;quot;ssh&amp;quot; --rsync-path=&amp;quot;sudo rsync&amp;quot;&amp;#39;&lt;/span&gt;
&lt;span class='n'&gt;remote_dir&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_user&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;@&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;:&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;remote_root&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;/zones/&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;local_dir&lt;/span&gt;  &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;zones/&amp;quot;&lt;/span&gt;

&lt;span class='k'&gt;def&lt;/span&gt; &lt;span class='nf'&gt;remote&lt;/span&gt;
  &lt;span class='vi'&gt;@remote&lt;/span&gt; &lt;span class='o'&gt;||=&lt;/span&gt; &lt;span class='k'&gt;begin&lt;/span&gt;
    &lt;span class='nb'&gt;require&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;net/ssh/multi&amp;#39;&lt;/span&gt;
    &lt;span class='n'&gt;session&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='no'&gt;Net&lt;/span&gt;&lt;span class='o'&gt;::&lt;/span&gt;&lt;span class='no'&gt;SSH&lt;/span&gt;&lt;span class='o'&gt;::&lt;/span&gt;&lt;span class='no'&gt;Multi&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;start&lt;/span&gt;
    &lt;span class='n'&gt;session&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;use&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_user&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;@&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
    &lt;span class='n'&gt;session&lt;/span&gt;
  &lt;span class='k'&gt;end&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;

&lt;span class='n'&gt;desc&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Get config from &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;task&lt;/span&gt; &lt;span class='ss'&gt;:get&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt;
  &lt;span class='nb'&gt;puts&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;*** Getting config from &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; ***&amp;quot;&lt;/span&gt;
  &lt;span class='nb'&gt;system&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;rsync&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;remote_dir&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;local_dir&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;

&lt;span class='n'&gt;desc&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Put config to &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;task&lt;/span&gt; &lt;span class='ss'&gt;:put&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt;
  &lt;span class='nb'&gt;puts&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;*** Deploying config files to &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; ***&amp;quot;&lt;/span&gt;
  &lt;span class='nb'&gt;system&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;rsync&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;local_dir&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;remote_dir&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;

&lt;span class='n'&gt;desc&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Set correct permissions&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;task&lt;/span&gt; &lt;span class='ss'&gt;:set_perms&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt;
  &lt;span class='nb'&gt;puts&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;*** Setting correct file permissions ***&amp;quot;&lt;/span&gt;
  &lt;span class='n'&gt;remote&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;exec&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;sudo chmod 640 /etc/bind/zones/db.*&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;wait&lt;/span&gt;
  &lt;span class='n'&gt;remote&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;exec&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;sudo chown bind:bind /etc/bind/zones/db.*&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;wait&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;

&lt;span class='n'&gt;desc&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Test config on &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;task&lt;/span&gt; &lt;span class='ss'&gt;:test&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt;
  &lt;span class='nb'&gt;puts&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;*** Testing zone files ***&amp;quot;&lt;/span&gt;

  &lt;span class='n'&gt;errors&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nb'&gt;Array&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;new&lt;/span&gt; 

  &lt;span class='no'&gt;FileList&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;new&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;zones/*&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;each&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt; &lt;span class='o'&gt;|&lt;/span&gt;&lt;span class='n'&gt;zone&lt;/span&gt;&lt;span class='o'&gt;|&lt;/span&gt;
    &lt;span class='n'&gt;output&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nb'&gt;Array&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;new&lt;/span&gt;
    &lt;span class='n'&gt;channel&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;remote&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;exec&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;sudo named-checkzone &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;zone&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;sub&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='sr'&gt;/zones\/db./&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;remote_root&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;/&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;zone&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt; &lt;span class='o'&gt;|&lt;/span&gt;&lt;span class='n'&gt;ch&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;stream&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;data&lt;/span&gt;&lt;span class='o'&gt;|&lt;/span&gt;
      &lt;span class='n'&gt;output&lt;/span&gt; &lt;span class='o'&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;[&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;ch&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:host&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; : &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;stream&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;] &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;data&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
    &lt;span class='k'&gt;end&lt;/span&gt;

    &lt;span class='n'&gt;channel&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;wait&lt;/span&gt;

    &lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='n'&gt;channel&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;any?&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt; &lt;span class='o'&gt;|&lt;/span&gt;&lt;span class='n'&gt;c&lt;/span&gt;&lt;span class='o'&gt;|&lt;/span&gt; &lt;span class='n'&gt;c&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:exit_status&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt; &lt;span class='o'&gt;!=&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt; &lt;span class='p'&gt;}&lt;/span&gt;
      &lt;span class='n'&gt;errors&lt;/span&gt; &lt;span class='o'&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;zone&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; failed to validate&amp;quot;&lt;/span&gt;
      &lt;span class='n'&gt;errors&lt;/span&gt; &lt;span class='o'&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class='n'&gt;output&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;join&lt;/span&gt;
    &lt;span class='k'&gt;end&lt;/span&gt;

  &lt;span class='k'&gt;end&lt;/span&gt;

  &lt;span class='k'&gt;unless&lt;/span&gt; &lt;span class='n'&gt;errors&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;empty?&lt;/span&gt;
    &lt;span class='nb'&gt;abort&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;errors&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;join&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='se'&gt;\n&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
  &lt;span class='k'&gt;end&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;

&lt;span class='n'&gt;desc&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Reload bind on &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$ssh_host&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;task&lt;/span&gt; &lt;span class='ss'&gt;:reload&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt;
  &lt;span class='nb'&gt;puts&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;*** Reloading Bind ***&amp;quot;&lt;/span&gt;

  &lt;span class='n'&gt;channel&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;remote&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;exec&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;sudo rndc reload&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt; &lt;span class='o'&gt;|&lt;/span&gt;&lt;span class='n'&gt;ch&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;stream&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;data&lt;/span&gt;&lt;span class='o'&gt;|&lt;/span&gt;
    &lt;span class='nb'&gt;puts&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;[&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;ch&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:host&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt; : &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;stream&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;] &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;data&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
  &lt;span class='k'&gt;end&lt;/span&gt;

  &lt;span class='n'&gt;channel&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;wait&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;

&lt;span class='n'&gt;desc&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;Put config, test and reload&amp;quot;&lt;/span&gt;
&lt;span class='n'&gt;task&lt;/span&gt; &lt;span class='ss'&gt;:deploy&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:put&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:set_perms&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:test&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:reload&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt; &lt;span class='k'&gt;do&lt;/span&gt;
  &lt;span class='nb'&gt;puts&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;*** Zonefiles deployed ***&amp;quot;&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Yes it&amp;#8217;s hacky and could do with some improvement but then I&amp;#8217;m a sysadmin and not a developer. I might have a go at writting a gem to make these sort of Rakefiles cleaner but it&amp;#8217;s not too bad.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Fairwell Drupal</title>
   <link href="http://sheepy.org/2011/09/27/fairwell-drupal/"/>
   <updated>2011-09-27T00:00:00+01:00</updated>
   <id>http://sheepy.org/2011/09/27/fairwell-drupal</id>
   <content type="html">&lt;p&gt;Fairwell &lt;a href='http://www.drupal.org/'&gt;Drupal&lt;/a&gt;. It has been fun but things have changed and it&amp;#8217;s time to move on to something &lt;a href='https://github.com/mojombo/jekyll/'&gt;new&lt;/a&gt;.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Arduino fun</title>
   <link href="http://sheepy.org/2010/11/09/arduino-fun/"/>
   <updated>2010-11-09T00:00:00+00:00</updated>
   <id>http://sheepy.org/2010/11/09/arduino-fun</id>
   <content type="html">&lt;p&gt;So after all the weekend plans got cancelled I decided to do a bit of tidying&amp;#8230; right up until the point I discovered a female RJ45 socket on the bottom of my energy meter.&lt;/p&gt;

&lt;p&gt;Doing what any self-respecting geek would do I plugged in a piece of cat5 and waved a DHCP lease at it. No dice, time for some research,&lt;/p&gt;

&lt;p&gt;The energy meter in question is a re-branded &lt;a href='http://www.currentcost.com/product-theclassic.html'&gt;current cost classic&lt;/a&gt; of which, at least on initial research, there are 2 versions. (I&amp;#8217;ll come back to this in a bit).&lt;/p&gt;

&lt;p&gt;Now the basic principle as to how these devices work is thus: You clamp an induction meter round your main electric feed connected to a wireless transmitter which talks to a unit with an LCD which has this handy RJ45 socket. The RJ45 socket actually turns out to speak 3.3V TTL for which you can acquire a data cable from &lt;a href='http://stores.ebay.co.uk/Current-Cost-Ltd'&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But it&amp;#8217;s Saturday and I want this working now! Enter, stage left, Arduino. Some reading of &lt;a href='http://e.inste.in/2008/06/16/interfacing-the-currentcost-meter-to-an-arduino/'&gt;this&lt;/a&gt; and &lt;a href='http://mungbean.org/blog/?p=477'&gt;this&lt;/a&gt; there are 2 versions: &lt;ul&gt;
&lt;li&gt;4200 Baud over pins 4 &amp;amp; 8&lt;/li&gt;
&lt;li&gt;9600 Baud over pins 6 &amp;amp; 7&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;Mine obviously has some personality issues and decided that it would operate using pins 4 &amp;#38; 8 at 9600 Baud.&lt;/p&gt;

&lt;p&gt;A quick Ardunio sketch later I had it spewing out XML over the hardware serial port using &lt;a href='http://arduiniana.org/libraries/newsoftserial/'&gt;NewSoftSerial&lt;/a&gt; to do the conversion.&lt;/p&gt;

&lt;p&gt;All going well I decided to punt this data out using the &lt;a href='http://www.arduino.cc/en/Main/ArduinoEthernetShield'&gt;Arduino Ethernet Shield&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cue timing problems&amp;#8230;&lt;/p&gt;

&lt;p&gt;It appears the poor little Arduino couldn&amp;#8217;t cope and was missing/corrupting the output and was missing quite a lot of characters whitest trying to parse and punt data out over Ethernet. Throwing some buffers into the mix appears to have resolved the issue and it now appears to get 90%+ of the readings using this &lt;a href='https://gist.github.com/667488'&gt;sketch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All in all a productive weekend and hopefully I should have some graphs soon to show what sort of power I&amp;#8217;m consuming.&lt;/p&gt;

&lt;p&gt;Current TODO list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tidy up the code&lt;/li&gt;

&lt;li&gt;Write agent to connect to the Arduino and get current usage&lt;/li&gt;

&lt;li&gt;Stick this into my &lt;a href='http://munin-monitoring.org/'&gt;munin&lt;/a&gt; install &lt;a href='https://secure.sheepy.org/munin'&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>JBoss woes</title>
   <link href="http://sheepy.org/2009/11/07/jboss-woes/"/>
   <updated>2009-11-07T00:00:00+00:00</updated>
   <id>http://sheepy.org/2009/11/07/jboss-woes</id>
   <content type="html">&lt;p&gt;JBoss, on the whole, does hold up surprisingly well. This can probably be attributed to our skilled developers who, to be fair, I don&amp;#8217;t always give enough credit to.&lt;/p&gt;

&lt;p&gt;However every so often JBoss plays up and the symptoms presented seem to point to obvious problems. However all is not as it appears.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s release day and shiny new software is just itching to be deployed. The sysadmin gets up early and rocks up to the office to go through the standard deployment procedure. If only things always went to plan!&lt;/p&gt;

&lt;p&gt;We have a cluster of a number of servers and use the &lt;a href='http://www.jboss.org/community/wiki/JBossFarmDeployment'&gt;JBoss Farm Deployment&lt;/a&gt; service to deploy applications. It&amp;#8217;s fairly straight forward, you build and deploy .ear, .war, .spring, etc&amp;#8230; files to the &lt;em&gt;$JBOSS_HOME/server/default/farm/&lt;/em&gt; directory and all the nodes pick up the new code.&lt;/p&gt;

&lt;p&gt;Here comes the first gotcha, which we have known about for quite a while now. If you re-farm an already running package then by default it won&amp;#8217;t free itself from the PermGen heap so continuous redeploying will eventually mean you run out of PermGen memory.&lt;/p&gt;

&lt;p&gt;The solution we have is to make sure we restart every node after deployment to clear out this memory.&lt;/p&gt;

&lt;p&gt;What I&amp;#8217;ve found out recently is this issue can be resolved by setting the following Java options: &lt;code&gt;
-XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled
&lt;/code&gt; which will free up the PermGen memory.&lt;/p&gt;

&lt;p&gt;This will be going into testing out or dev and test environments shortly and hopefully on live (once we are sure there are no adverse affects). This should mean no restarting required in most cases.&lt;/p&gt;

&lt;p&gt;I say in most cases as we do have some applications we can&amp;#8217;t &amp;#8220;hot deploy&amp;#8221;. We have been instructed to do the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Shutdown the build node&lt;/li&gt;
&lt;li&gt;Build and farm the application&lt;/li&gt;
&lt;li&gt;Shutdown all other nodes&lt;/li&gt;
&lt;li&gt;Bring up the build node&lt;/li&gt;
&lt;li&gt;Bring up the other nodes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This obviously leads to a complete outage lasting a few minutes, but we can live with that for the most part.&lt;/p&gt;

&lt;p&gt;Once such morning a co-worker followed this procedure and all appeared to go fine. However not long after some of our application started throwing &amp;#8220;Broken Pipe&amp;#8221; exceptions. The applications in question were communicating with our JBoss clusting using RMI. From the exceptions this initially looked like some network issue. The load balancers (LVS ones) were checked but no issues. More investigation required&amp;#8230;&lt;/p&gt;

&lt;p&gt;The nodes throwing the exception were part of a 6 node Tomcat cluster communicating to a 3 node JBoss cluster. On closer exception only nodes 1 and 4 of the Tomcat cluster were throwing exceptions. These were restarted but to no avail.&lt;/p&gt;

&lt;p&gt;Then I remembered that we we do Source Hashing on our LVS nodes. Source hashing is used to make sure the same clients hit the servers, normally for session tracking purposes, this helped with diagnosis.&lt;/p&gt;

&lt;p&gt;I found that 1 JBoss cluster node was at fault, but there were no exceptions in the logs. Further more most transactions were working fine. Just to be safe JBoss was restarted on the offending node but no difference. On with investigation I guess&amp;#8230;&lt;/p&gt;

&lt;p&gt;Eventually I found something that didn&amp;#8217;t make sense. &lt;em&gt;$JBOSS_HOME/server/default/tmp/deploy&lt;/em&gt; had a timestamp older than I expected.&lt;/p&gt;

&lt;p&gt;This directory is used to hold the expanded files from &lt;em&gt;$JBOSS_HOME/server/default/farm/&lt;/em&gt; and &lt;b&gt;should&lt;/b&gt; disappear when JBoss is shut down. I shutdown JBoss again and, for whatever reason, it still remained. So I deleted the directory by hand and started up JBoss. Sure enough the &amp;#8220;Broken Pipe&amp;#8221; exceptions disappeared.&lt;/p&gt;

&lt;p&gt;I shutdown JBoss on offending node again and this time it removed the directory. Started up again and all fine.&lt;/p&gt;

&lt;p&gt;After much playing around I&amp;#8217;ve no idea what causes this. I know that if JBoss doesn&amp;#8217;t shut down correctly then this directory can remain causing clustering issues (which really don&amp;#8217;t make sense to me) but I&amp;#8217;ve seen a number of occasions on our Test Environment where this directory has remained after a successful shutdown.&lt;/p&gt;

&lt;p&gt;To make sure this doesn&amp;#8217;t happen again I&amp;#8217;ve modified out start scripts to check for the presence of this directory and refuse to start up if it exists.&lt;/p&gt;

&lt;p&gt;Fingers crossed we won&amp;#8217;t see this issue again.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Committing to Git</title>
   <link href="http://sheepy.org/2009/10/22/committing-to-git/"/>
   <updated>2009-10-22T00:00:00+01:00</updated>
   <id>http://sheepy.org/2009/10/22/committing-to-git</id>
   <content type="html">&lt;p&gt;Unfortunately for me I still have to use and administer CVS at work for our developers. Personally I ditched it a long time ago in favour of SVN and then Bazaar.&lt;/p&gt;

&lt;p&gt;Lately I&amp;#8217;ve been looking because, well&amp;#8230;.just because really (us tech&amp;#8217;s have a habit of trying out things for the hell of it).&lt;/p&gt;

&lt;p&gt;So I&amp;#8217;ve decided to commit to using it. I&amp;#8217;ve also gone and got myself a &lt;a href='http://github.com/cornet'&gt;GitHub account&lt;/a&gt; which I will use to store configurations, scripts and any public dev work that might be of use.&lt;/p&gt;

&lt;p&gt;Will see how it all pans out, I&amp;#8217;ll hopefully get round to adding more repositories soon.&lt;/p&gt;

&lt;p&gt;For now probably the only one worth a look is my &lt;a href='http://github.com/cornet/dotvim/tree/'&gt;vim configuration&lt;/a&gt;. Of course you can get a copy by just doing: &lt;code&gt;
git clone git://github.com/cornet/dotvim.git
&lt;/code&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Microsoft's BPOS Using Postfix</title>
   <link href="http://sheepy.org/2009/06/10/microsofts-bpos-using-postfix/"/>
   <updated>2009-06-10T00:00:00+01:00</updated>
   <id>http://sheepy.org/2009/06/10/microsofts-bpos-using-postfix</id>
   <content type="html">&lt;p&gt;Nice to see MS using opensource software :)&lt;/p&gt;

&lt;p&gt;Email received today from someone using BPOS:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; Received: from mail187-tx2-R.bigfish.com (10.9.14.251) by
  TX2EHSOBE009.bigfish.com (10.9.40.29) with Microsoft SMTP Server id
  8.1.340.0; Wed, 10 Jun 2009 10:33:02 +0000
 Received: from mail187-tx2 (localhost.localdomain [127.0.0.1])	by
  mail187-tx2-R.bigfish.com (Postfix) with ESMTP id 520131100037  for
  &amp;lt;******@*******.***&amp;gt;; Wed, 10 Jun 2009 10:33:02 +0000 (UTC)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Looks like bigfish.com are using the &lt;a href='http://www.postfix.org/'&gt;Postfix&lt;/a&gt; mail server.&lt;/p&gt;

&lt;p&gt;Quick whois on bigfish.com reveals:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Registrant: 
  Microsoft Corporation
  Domain Administrator
  One Microsoft Way 
  Redmond, WA 98052
  US
  Email: domains@microsoft.com&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Most interesting ;)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Failover hosts using Xen, DRBB and Heartbeat</title>
   <link href="http://sheepy.org/2009/04/08/failover-hosts-using-xen-drbb-and-heartbeat/"/>
   <updated>2009-04-08T00:00:00+01:00</updated>
   <id>http://sheepy.org/2009/04/08/failover-hosts-using-xen-drbb-and-heartbeat</id>
   <content type="html">&lt;p&gt;After quite a lot of reading and a morning playing I managed to get failover Xen hosts working.&lt;/p&gt;

&lt;p&gt;The idea was to have 2 physical servers to run 2 (or more) Xen hosts between them. If one server was to die or needed some work doing on it then the domU would automatically move to the other node.&lt;/p&gt;
&lt;div style='text-align:center'&gt;
&lt;img alt='Failover Diagram' height='169' src='/images/failover.png' width='499' /&gt;
&lt;/div&gt;
&lt;p&gt;I&amp;#8217;ve done some testing and all appears to work fine. However let me stress that this is not live migration so you would suffer about a minute or so outage (not really a big deal in the grand scheme of things).&lt;/p&gt;

&lt;p&gt;Click the &amp;#8220;Read More&amp;#8221; button for full details on the setup. &lt;!--break--&gt; &lt;br /&gt;&lt;/p&gt;
&lt;h3&gt;Requirements&lt;/h3&gt;&lt;ul&gt;
  &lt;li&gt;Debian Etch&lt;/li&gt;
  &lt;li&gt;Xen Installed&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Installing DRBD&lt;/h3&gt;&lt;em&gt;To be done on both Xen nodes&lt;/em&gt;
&lt;p&gt;DRBD is only at version 7 in Debian Etch, so we pull in version 8 from &lt;a href='http://www.backports.org'&gt;backports.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Version 8 comes with some helper scripts for Xen which make the failover a lot easier to configure.&lt;/p&gt;

&lt;p&gt;These are the packages we need: &lt;ul&gt;
  &lt;li&gt;[drbd8-utils](http://packages.debian.org/etch-backports/drbd8-utils)&lt;/li&gt;
  &lt;li&gt;[drbd8-source](http://packages.debian.org/etch-backports/drbd8-source)&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;If you are unsure on how to install stuff from backports then please read the documentation located &lt;a href='http://backports.org/dokuwiki/doku.php?id=instructions'&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installing the packages we need to build the DRBD kernel module. The easiest way to achieve this is to do: &lt;pre&gt;module-assistant auto-install drbd8&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Then load the module by doing &lt;pre&gt;modprobe drbd&lt;/pre&gt;&lt;/p&gt;
&lt;h3&gt;Installing Heartbeat&lt;/h3&gt;&lt;em&gt;To be done on both Xen nodes&lt;/em&gt;
&lt;p&gt;This can be installed straight from the Debian repos: &lt;pre&gt;aptitude install heartbeat-2&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Next there is some basic configuration to do. First we need to create &lt;em&gt;/etc/heartbeat/ha.cf&lt;/em&gt; with the following contents: &lt;pre&gt;
  # Enable new cluster manager
  crm on
  # Specify interface to send bcast packets out on
  bcast eth0
  # Specify nodes in cluster, these must correspond with &quot;uname -n&quot;
  nodes xen-1 xen-2
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Then we create &lt;em&gt;/etc/heartbeat/authkeys&lt;/em&gt; with the following contents: &lt;pre&gt;
  auth 1
  1 sha1 SomeLongStringWithRandomChars
&lt;/pre&gt; Note that &lt;em&gt;SomeLongStringWithRandomChars&lt;/em&gt; should be randomly generated and the same on both nodes.&lt;/p&gt;
&lt;h3&gt;Setting up DRBD resources&lt;/h3&gt;&lt;em&gt;To be done on both Xen nodes&lt;/em&gt;
&lt;p&gt;I generally use LVM for my Xen hosts, so first off I create all the paritions required for my 2 hosts: &lt;pre&gt;
  lvcreate -L10G -n host1-root xenhostfs
  lvcreate -L1G  -n host1-swap xenhostfs
  lvcreate -L10G -n host2-root xenhostfs
  lvcreate -L1G  -n host2-swap xenhostfs
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Next we need to create &lt;em&gt;/etc/drbd.conf&lt;/em&gt; and configure our resources (DRBD devices):&lt;/p&gt;
&lt;pre&gt;
#
# Global Parameters
#
global {
        # Participate in http://usage.drbd.org
        usage-count yes;
}

#
# Settings common to all resources
#
common {
        # Set sync rate
        syncer { rate 10M; }

        # Protocol C : Both nodes have to commit before write
        # is considered successful
        protocol C;
        net {
                # Xen tests that it can write to block device
                # before starting up. Not allowing this causes
                # migration to fail.
                allow-two-primaries;
                
                # Split-brain recovery parameters
                after-sb-0pri discard-zero-changes;
                after-sb-1pri discard-secondary;
        }
}

#
# Resource Definitions
#
resource &quot;host1_root&quot; {

        on xen1 {
                # The block device it will appear as
                device    /dev/drbd0;

                # The device we are mirroring
                disk      /dev/xenhostfs/host1-root;

                # Store DRBD meta data the above disk
                meta-disk internal;

                # Address of *this* host and port to replicate over
                # You must use a different port for each resource
                address   10.0.0.1:7790;
        }

        on xen2 {
                device    /dev/drbd0;
                disk      /dev/xenhostfs/host1-root;
                meta-disk internal;
                address   10.0.0.2:7790;
        }

}

resource &quot;host1_swap&quot; {

        on xen1 {
                device    /dev/drbd1;
                disk      /dev/xenhostfs/host1-swap;
                meta-disk internal;
                address   10.0.0.1:7791;
        }

        on xen2 {
                device    /dev/drbd1;
                disk      /dev/xenhostfs/host1-swap;
                meta-disk internal;
                address   10.0.0.2:7791;
        }
}

resource &quot;host2_root&quot; {

        on xen1 {
                device    /dev/drbd2;
                disk      /dev/xenhostfs/host2-root;
                meta-disk internal;
                address   10.0.0.1:7792;
        }

        on xen2 {
                device    /dev/drbd2;
                disk      /dev/xenhostfs/host2-root;
                meta-disk internal;
                address   10.0.0.2:7792;
        }
}

resource &quot;host2_swap&quot; {

        on xen1 {
                device    /dev/drbd3;
                disk      /dev/xenhostfs/host2-swap;
                meta-disk internal;
                address   10.0.0.1:7793;
        }

        on xen2 {
                device    /dev/drbd3;
                disk      /dev/xenhostfs/host2-swap;
                meta-disk internal;
                address   10.0.0.2:7793;
        }
}
&lt;/pre&gt;
&lt;p&gt;Now we have to initialise the metadata on the DRBD resources. This takes some time so I advise a coffee or lunch at this point ;) &lt;pre&gt;
 drbdadm create-md host1_root
 drbdadm create-md host1_swap
 drbdadm create-md host2_root
 drbdadm create-md host2_swap
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Now that we have done that we can start up drbd: &lt;pre&gt;
/etc/init.d/drbd restart
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Right now all that is set up we now need to select one node as the primary, (say xen1).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;On xen1 only&amp;lt;/em&amp;gt; we now do the following which does 2 things:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sets xen1 as the primary for the DRBD devices&lt;/li&gt;

&lt;li&gt;Syncs all the data from xen1 to xen2&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;
drbdadm -- --overwrite-data-of-peer primary host1_root
drbdadm -- --overwrite-data-of-peer primary host1_swap
drbdadm -- --overwrite-data-of-peer primary host2_root
drbdadm -- --overwrite-data-of-peer primary host2_swap
&lt;/pre&gt;
&lt;p&gt;You can check the process of his by doing &lt;pre&gt;
cat /proc/drbd
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;which will give you output something like &lt;pre&gt;
version: 8.0.14 (api:86/proto:86)
GIT-hash: bb447522fc9a87d0069b7e14f0234911ebdab0f7 build by phil@fat-tyre, 2008-11-12 16:40:33
 0: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
    ns:52120 nr:1016 dw:503652 dr:203481 al:121 bm:872 lo:0 pe:0 ua:0 ap:0
        [&gt;...................] sync'ed:  1.0% (10380903/10485760)K
        finish: 0:07:43 speed: 10,836 (10,836) K/sec
        resync: used:0/61 hits:2296 misses:10 starving:0 dirty:0 changed:10
        act_log: used:0/127 hits:120616 misses:128 starving:0 dirty:7 changed:121
 1: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r---
    ns:0 nr:0 dw:4 dr:1348 al:1 bm:12 lo:0 pe:0 ua:0 ap:0
...
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Note that you do not have to wait for this to finish, you can carry on using your /dev/drbdN devices but preformance will be reduced until it has completed the sync.&lt;/p&gt;
&lt;h3&gt;Creating Xen DomU&lt;/h3&gt;
&lt;p&gt;I&amp;#8217;m not going to go through the complete details of this as its a reasonable assumption that if you&amp;#8217;re reading this then you have used Xen before, or at least are capable of reading around.&lt;/p&gt;
&lt;em&gt;This is done only on the primary host&lt;/em&gt;
&lt;p&gt;However here are the edited highlights. Firstly create the filesystems: &lt;pre&gt;
mkfs.ext3 /dev/drbd0
mkswap    /dev/drbd1
mkfs.ext3 /dev/drbd2
mkswap    /dev/drbd3
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Now mount and use debootstrap to create the base installs: &lt;pre&gt;
mkdir /mnt/host1 /mnt/host2
mount /dev/drbd0 /mnt/host1
mount /dev/drbd2 /mnt/host2
debootstrap --arch i386 etch /mnt/host1 http://ftp.uk.debian.org/debian/
debootstrap --arch i386 etch /mnt/host2 http://ftp.uk.debian.org/debian/
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Create &lt;em&gt;/mnt/host1/etc/fstab&lt;/em&gt; and &lt;em&gt;/mnt/host2/etc/fstab&lt;/em&gt; with the following content: &lt;pre&gt;
proc          /proc        proc    defaults                     0   0
/dev/xvda     /            ext3    defaults,errors=remount-ro   0   1
/dev/xvdb     none         swap    sw                           0   0
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Then unmount &lt;em&gt;/mnt/host1&lt;/em&gt; &amp;#38; &lt;em&gt;/mnt/host2&lt;/em&gt; and we are ready to configure Xen.&lt;/p&gt;
&lt;h3&gt;Xen Domain Config&lt;/h3&gt;&lt;em&gt;To be done on both Xen nodes&lt;/em&gt;
&lt;p&gt;Create &lt;em&gt;/etc/xen/host1.dom&lt;/em&gt; with the following contents:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#  -*- mode: python; -*-
#----------------------------------------------------------------------------
# Kernel image file.
kernel = &amp;quot;/boot/vmlinuz-2.6.18-6-xen-686&amp;quot;
ramdisk = &amp;quot;/boot/initrd.img-2.6.18-6-xen-686&amp;quot;

# Initial memory allocation (in megabytes) for the new domain.
memory = 1024

# A name for your domain. All domains must have different names.
name = &amp;quot;host1&amp;quot;

# Filesystems
disk = [ &amp;#39;drbd:host1_root,xvda,w&amp;#39;, &amp;#39;drbd:host1_swap,xvdb,w&amp;#39;]

# Network
vif = [&amp;#39;bridge=xenbr0&amp;#39;]

# Set root device.
root = &amp;quot;/dev/xvda ro&amp;quot;

# Sets runlevel 4.
extra = &amp;quot;4&amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and&lt;/p&gt;
&lt;em&gt;/etc/xen/host2.dom&lt;/em&gt;
&lt;pre&gt;&lt;code&gt;#  -*- mode: python; -*-
#----------------------------------------------------------------------------
# Kernel image file.
kernel = &amp;quot;/boot/vmlinuz-2.6.18-6-xen-686&amp;quot;
ramdisk = &amp;quot;/boot/initrd.img-2.6.18-6-xen-686&amp;quot;

# Initial memory allocation (in megabytes) for the new domain.
memory = 1024

# A name for your domain. All domains must have different names.
name = &amp;quot;host2&amp;quot;

# Filesystems
disk = [ &amp;#39;drbd:host2_root,xvda,w&amp;#39;, &amp;#39;drbd:host2_swap,xvdb,w&amp;#39;]

# Network
vif = [&amp;#39;bridge=xenbr0&amp;#39;]

# Set root device.
root = &amp;quot;/dev/xvda ro&amp;quot;

# Sets runlevel 4.
extra = &amp;quot;4&amp;quot;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now on ONE of the nodes ONLY you can start the xen instances by doing: &lt;pre&gt;
xm create /etc/xen/host1.dom
xm create /etc/xen/host2.dom
&lt;/pre&gt;&lt;/p&gt;
&lt;h3&gt;Configuring Heartbeat&lt;/h3&gt;
&lt;p&gt;We need to create 3 XML files: &lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;bootstrap.xml&lt;/strong&gt;: This sets up the defaults for heartbeat Cluster Resource Manager (CRM)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;host1.xml&lt;/strong&gt;: Heartbeat config for host1&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;host2.xml&lt;/strong&gt;: Heartbeat config for host2&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;Now the documentation for these XML files is somewhat thin on the ground. The only real thing to go on is the DTD which, on Debian, lives here:&lt;em&gt;/usr/lib/heartbeat/crm.dtd&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can also refer to the online version &lt;a href='http://hg.clusterlabs.org/pacemaker/dev/file/tip/xml/crm-1.0.dtd'&gt;here&lt;/a&gt; which is always the latest version.&lt;/p&gt;

&lt;p&gt;Anyway here are the contents of the 3 files (just save them to your home directory for now).&lt;/p&gt;
&lt;em&gt;bootstrap.xml&lt;/em&gt;&lt;em&gt;To be done on one Xen node only&lt;/em&gt;&lt;pre&gt;
&amp;lt;cluster_property_set id=&quot;bootstrap&quot;&amp;gt;
   &amp;lt;attributes&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap01&quot; name=&quot;transition_idle_timeout&quot; value=&quot;60&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap02&quot; name=&quot;default_resource_stickiness&quot; value=&quot;0&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap03&quot; name=&quot;default_resource_failure_stickiness&quot; 
       value=&quot;-500&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap04&quot; name=&quot;stonith_enabled&quot; value=&quot;false&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap05&quot; name=&quot;stonith_action&quot; value=&quot;reboot&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap06&quot; name=&quot;symmetric_cluster&quot; value=&quot;true&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap07&quot; name=&quot;no_quorum_policy&quot; value=&quot;stop&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap08&quot; name=&quot;stop_orphan_resources&quot; value=&quot;true&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap09&quot; name=&quot;stop_orphan_actions&quot; value=&quot;true&quot;/&amp;gt;
      &amp;lt;nvpair id=&quot;bootstrap10&quot; name=&quot;is_managed_default&quot; value=&quot;true&quot;/&amp;gt;
   &amp;lt;/attributes&amp;gt;
&amp;lt;/cluster_property_set&amp;gt;
&lt;/pre&gt;&lt;em&gt;host1.xml&lt;/em&gt;&lt;pre&gt;
&amp;lt;resources&amp;gt;
 &amp;lt;primitive id=&quot;host1&quot; class=&quot;ocf&quot; type=&quot;Xen&quot; provider=&quot;heartbeat&quot;&amp;gt;

  &amp;lt;operations&amp;gt;
   &amp;lt;op id=&quot;host1-op01&quot; name=&quot;monitor&quot; interval=&quot;10s&quot; timeout=&quot;60s&quot; prereq=&quot;nothing&quot;/&amp;gt;
   &amp;lt;op id=&quot;host1-op02&quot; name=&quot;start&quot; timeout=&quot;60s&quot; start_delay=&quot;0&quot;/&amp;gt;
   &amp;lt;op id=&quot;host1-op03&quot; name=&quot;stop&quot; timeout=&quot;300s&quot;/&amp;gt;
 &amp;lt;/operations&amp;gt;

 &amp;lt;instance_attributes id=&quot;host1&quot;&amp;gt;
  &amp;lt;attributes&amp;gt;
   &amp;lt;nvpair id=&quot;host1-attr01&quot; name=&quot;xmfile&quot; value=&quot;/etc/xen/host1.dom&quot;/&amp;gt;
   &amp;lt;nvpair id=&quot;host1-attr02&quot; name=&quot;target_role&quot; value=&quot;started&quot;/&amp;gt;
  &amp;lt;/attributes&amp;gt;
 &amp;lt;/instance_attributes&amp;gt;

 &amp;lt;meta_attributes id=&quot;host1-meta01&quot;&amp;gt;
  &amp;lt;attributes&amp;gt;
   &amp;lt;nvpair id=&quot;host1-meta-attr01&quot; name=&quot;allow_migrate&quot; value=&quot;true&quot;/&amp;gt;
  &amp;lt;/attributes&amp;gt;
 &amp;lt;/meta_attributes&amp;gt;

 &amp;lt;/primitive&amp;gt;
&amp;lt;/resources&amp;gt;
&lt;/pre&gt;&lt;em&gt;host2.xml&lt;/em&gt;&lt;pre&gt;
&amp;lt;resources&amp;gt;
 &amp;lt;primitive id=&quot;host2&quot; class=&quot;ocf&quot; type=&quot;Xen&quot; provider=&quot;heartbeat&quot;&amp;gt;

  &amp;lt;operations&amp;gt;
   &amp;lt;op id=&quot;host2-op01&quot; name=&quot;monitor&quot; interval=&quot;10s&quot; timeout=&quot;60s&quot; prereq=&quot;nothing&quot;/&amp;gt;
   &amp;lt;op id=&quot;host2-op02&quot; name=&quot;start&quot; timeout=&quot;60s&quot; start_delay=&quot;0&quot;/&amp;gt;
   &amp;lt;op id=&quot;host2-op03&quot; name=&quot;stop&quot; timeout=&quot;300s&quot;/&amp;gt;
 &amp;lt;/operations&amp;gt;

 &amp;lt;instance_attributes id=&quot;host2&quot;&amp;gt;
  &amp;lt;attributes&amp;gt;
   &amp;lt;nvpair id=&quot;host2-attr01&quot; name=&quot;xmfile&quot; value=&quot;/etc/xen/host2.dom&quot;/&amp;gt;
   &amp;lt;nvpair id=&quot;host2-attr02&quot; name=&quot;target_role&quot; value=&quot;started&quot;/&amp;gt;
  &amp;lt;/attributes&amp;gt;
 &amp;lt;/instance_attributes&amp;gt;

 &amp;lt;meta_attributes id=&quot;host2-meta01&quot;&amp;gt;
  &amp;lt;attributes&amp;gt;
   &amp;lt;nvpair id=&quot;host2-meta-attr01&quot; name=&quot;allow_migrate&quot; value=&quot;true&quot;/&amp;gt;
  &amp;lt;/attributes&amp;gt;
 &amp;lt;/meta_attributes&amp;gt;

 &amp;lt;/primitive&amp;gt;
&amp;lt;/resources&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Then we need to load them: &lt;pre&gt;
cibadmin -C -o crm_config -x bootstrap.xml
cibadmin -C -o resources -x host1.xml
cibadmin -C -o resources -x host2.xml
&lt;/pre&gt;&lt;/p&gt;
&lt;h3&gt;Monitoring&lt;/h3&gt;
&lt;p&gt;Basic monitoing is done with &lt;em&gt;crm_mon&lt;/em&gt;. Issuing this command will result in the following which is updated every 15 seconds:&lt;/p&gt;
&lt;pre&gt;
============
Last updated: Wed Apr  8 21:08:56 2009
Current DC: xen2 (1b3dbdb3-f9ca-4d16-bf7d-8a57167b85ed)
2 Nodes configured.
2 Resources configured.
============

Node: xen2 (1b3dbdb3-f9ca-4d16-bf7d-8a57167b85ed): online
Node: xen1 (ea043f8c-5afc-4aee-9ffc-d17cb3cfed06): online

host1     (heartbeat::ocf:Xen):   Started xen1
host2     (heartbeat::ocf:Xen):   Started xen1
&lt;/pre&gt;&lt;h3&gt;Basic Operations&lt;/h3&gt;&lt;strong&gt;Migrating&lt;/strong&gt;
&lt;p&gt;To move host2 from xen1 to xen2 you do: &lt;pre&gt;
crm_resource --migrate --resource host2 --host-uname xen2
&lt;/pre&gt;&lt;/p&gt;
&lt;strong&gt;Stopping/Starting&lt;/strong&gt;
&lt;p&gt;To stop host2: &lt;pre&gt;
crm_resource --resource host2 --set-parameter target_role \
             --property-value stopped
&lt;/pre&gt; &amp;#8230;and to start it again: &lt;pre&gt;
crm_resource --resource host2 --set-parameter target_role \
             --property-value started
&lt;/pre&gt;&lt;/p&gt;
&lt;h3&gt;Credits&lt;/h3&gt;
&lt;p&gt;Thanks to &lt;a href='http://www.netdotnet.net/'&gt;Doug&lt;/a&gt; for pointing out all my lame mistakes.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>MySQL AUTO_INCREMENT  Madness</title>
   <link href="http://sheepy.org/2009/04/02/mysql-auto_increment-madness/"/>
   <updated>2009-04-02T00:00:00+01:00</updated>
   <id>http://sheepy.org/2009/04/02/mysql-auto_increment-madness</id>
   <content type="html">&lt;p&gt;Can anyone explain this behaviour ?&lt;/p&gt;
&lt;pre&gt;
mysql&gt; select version();
+--------------+
| version()    |
+--------------+
| 5.1.30-2-log | 
+--------------+
1 row in set (0.00 sec)

mysql&gt; create database foo;
Query OK, 1 row affected (0.01 sec)
mysql&gt; use foo;
Database changed
mysql&gt; CREATE TABLE test ( 
   id bigint(20) NOT NULL AUTO_INCREMENT,
   stuff varchar(10) DEFAULT NULL,
   PRIMARY KEY (id)
) ENGINE=InnoDB;
Query OK, 0 rows affected (0.04 sec)

mysql&gt; SHOW CREATE TABLE test \G
*************************** 1. row ***************************
       Table: test
Create Table: CREATE TABLE `test` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `stuff` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql&gt; INSERT INTO test (id, stuff) VALUES (-1,'Hello!');
Query OK, 1 row affected (0.04 sec)

mysql&gt; SELECT * FROM test;
+----+--------+
| id | stuff  |
+----+--------+
| -1 | Hello! | 
+----+--------+
1 row in set (0.00 sec)

mysql&gt; INSERT INTO test (id, stuff) VALUES (0,'Hello!');
ERROR 1467 (HY000): Failed to read auto-increment value from storage engine

mysql&gt; SHOW CREATE TABLE test \G
*************************** 1. row ***************************
       Table: test
Create Table: CREATE TABLE `test` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `stuff` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

&lt;/pre&gt;
&lt;p&gt;We have found a workaround (sort of):&lt;/p&gt;
&lt;pre&gt;
mysql&gt; DROP TABLE test;
Query OK, 0 rows affected (0.04 sec)

mysql&gt; CREATE TABLE test (
   `id` bigint(20) NOT NULL AUTO_INCREMENT,
   stuff varchar(10) DEFAULT NULL,
   PRIMARY KEY (`id`) 
) ENGINE=InnoDB;
Query OK, 0 rows affected (0.10 sec)

mysql&gt; INSERT INTO test (id, stuff) VALUES (-1,'Hello!');
Query OK, 1 row affected (0.03 sec)

mysql&gt; SHOW CREATE TABLE test \G
*************************** 1. row ***************************
       Table: test
Create Table: CREATE TABLE `test` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `stuff` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql&gt; INSERT INTO test (id, stuff) VALUES (0,'Hello!');
Query OK, 1 row affected (0.03 sec)

mysql&gt; SELECT * FROM test;
+----+--------+
| id | stuff  |
+----+--------+
| -1 | Hello! | 
|  1 | Hello! | 
+----+--------+
2 rows in set (0.00 sec)
&lt;/pre&gt;
&lt;p&gt;For those that missed it, the difference is the backticks in the CREATE TABLE line. Also I&amp;#8217;ve yet to test with other versions.&lt;/p&gt;
&lt;h4&gt;Update&lt;/h4&gt;
&lt;p&gt;Looks like this is a bug that was fixed in 5-1-31&lt;/p&gt;

&lt;p&gt;&lt;a href='http://bugs.mysql.com/bug.php?id=41841'&gt;http://bugs.mysql.com/bug.php?id=41841&lt;/a&gt; &lt;a href='http://bugs.mysql.com/bug.php?id=36411'&gt;http://bugs.mysql.com/bug.php?id=36411&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>This morning, in #mysql</title>
   <link href="http://sheepy.org/2008/10/02/this-morning-in-mysql/"/>
   <updated>2008-10-02T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/10/02/this-morning-in-mysql</id>
   <content type="html">&lt;p&gt;Some people are just too transparent :)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;05:23 &amp;lt;MyName&amp;gt; if i have a table of 3 columns, and 3 rows, and i do a cartesian     
          product of the table with itself, do i get 6 columns and 9 rows? 
05:24 &amp;lt;MyName&amp;gt; if the table originally have column names (A B C), do i get ( A
          B C A B C) as the column names after the cartesian product?
05:24 &amp;lt;MyName&amp;gt; then all the entries are just each entry of the original tables
          with each of the entreis again?
05:25 &amp;lt;MyName&amp;gt; or do i eliminate any duplicate columns?&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;#8230; after no response for some time&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;06:21 &amp;lt;MyName&amp;gt; hello?
06:22 &amp;lt;pc_&amp;gt; hello
06:22 &amp;lt;Gm4n&amp;gt; hello!
06:27 &amp;lt;MyName&amp;gt; ok
06:27 &amp;lt;MyName&amp;gt; if i have two tables , one is movies(title, studio), and the other is stars(name, title)
06:28 &amp;lt;MyName&amp;gt; i want to find all stars who played in ALL movies by studio &amp;quot;ABC&amp;quot; for example
06:28 &amp;lt;MyName&amp;gt; not all stars who played in movies by studio ABC, but all stars who played in ALL movies by ABC
06:28 &amp;lt;pc_&amp;gt; MyName, when is it due?
06:28 &amp;lt;MyName&amp;gt; tomorrow
06:28 &amp;lt;pc_&amp;gt; lol
06:28 &amp;lt;Gm4n&amp;gt; haha&lt;/code&gt;&lt;/pre&gt;</content>
 </entry>
 
 <entry>
   <title>Sun Java on Debian/Ubuntu</title>
   <link href="http://sheepy.org/2008/09/18/sun-java-on-debian-ubuntu/"/>
   <updated>2008-09-18T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/09/18/sun-java-on-debian-ubuntu</id>
   <content type="html">&lt;p&gt;It would appear that even if you install ONLY the sun java package it drags in some GNU java stuff as well.&lt;/p&gt;

&lt;p&gt;You can go through everything in /etc/alternatives and update it manually but that is somewhat time consuming.&lt;/p&gt;

&lt;p&gt;Instead just run:&lt;/p&gt;
&lt;code&gt;sudo /usr/sbin/update-java-alternatives --set java-1.5.0-sun&lt;/code&gt;
&lt;p&gt;and this will sort everything :)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Dropbox</title>
   <link href="http://sheepy.org/2008/09/18/dropbox/"/>
   <updated>2008-09-18T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/09/18/dropbox</id>
   <content type="html">&lt;p&gt;Somone appears to have created a online storage and sync thing that actually works:&lt;br /&gt;&lt;br /&gt;&lt;a href='http://www.getdropbox.com/'&gt;Dropbox - Home - Secure backup, sync and sharing made easy.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Few grips thou:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;It requires nautilus&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Not obvious how to create an account (it's not on the website, the client does it)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The initial dialog box (which you use to sign up for an account) takes an age to appear&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;All that aside it works wonderfully, copy file into ~/Dropbox and it syncs automatically :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;#8230; oh and it versions files too&lt;br /&gt;&amp;#8230; and only sends binary diffs&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Another blog added</title>
   <link href="http://sheepy.org/2008/08/07/another-blog-added/"/>
   <updated>2008-08-07T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/08/07/another-blog-added</id>
   <content type="html">&lt;p&gt;Another one I&amp;#8217;ve just added to my feedlist,&lt;/p&gt;

&lt;p&gt;&lt;a href='http://blog.kovyrin.net/'&gt;http://blog.kovyrin.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;some interesting stuff, especially on the MySQL front.&lt;/p&gt;

&lt;p&gt;He is also the author of the MySQL Master-Master Replication Manager which can be found here:&lt;/p&gt;

&lt;p&gt;&lt;a href='http://code.google.com/p/mysql-master-master/'&gt;http://code.google.com/p/mysql-master-master/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;definitely something I&amp;#8217;ll be looking at.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Nokia MMSC Server</title>
   <link href="http://sheepy.org/2008/07/25/nokia-mmsc-server/"/>
   <updated>2008-07-25T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/07/25/nokia-mmsc-server</id>
   <content type="html">&lt;p&gt;Nokia&amp;#8217;s MMSC is a stunning example of how to make problems as hard as possible to debug.&lt;/p&gt;

&lt;p&gt;The MMSC can speak a number of protocols over HTTP including EAIF and MM7. As you would expect you submit your POST and get back a HTTP Error Code and Message. However the Codes and Messages leave a lot to be desired:&lt;/p&gt;

&lt;p&gt;So lets take the 499 Error code which, according to their spec, can mean: &lt;ul&gt;
&lt;li&gt;Address Hiding - basically reject all messages to this Number&lt;/li&gt;
&lt;li&gt;Desired Delivery Time Error - aka delivery time set too far in the future&lt;/li&gt;
&lt;li&gt;No Credit&lt;/li&gt;
&lt;li&gt;Recipient Barred&lt;/li&gt;
&lt;li&gt;Sender Barred&lt;/li&gt;
&lt;li&gt;Rejected - or &quot;We ain't gonna tell you why&quot;&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;No surprises for guessing which one I&amp;#8217;m seeing at the moment :)&lt;/p&gt;

&lt;p&gt;Next comes the legendary 599 Error Code, again lets look at the spec. This can mean: &lt;ul&gt;
&lt;li&gt;CCR Error - Rejected as the MMSC has exceeded the number of messages licensed&lt;/li&gt;
&lt;li&gt;Capacity Exceeded - Number of msgs/second exceeded&lt;/li&gt;
&lt;li&gt;Kernel Overloaded&lt;/li&gt;
&lt;li&gt;DB Error - Message could not be stored in database&lt;/li&gt;
&lt;/ul&gt; although in our case we normally see &amp;#8220;No reason given or reason given not included in EAIF specification&amp;#8221;.&lt;/p&gt;

&lt;p&gt;If the above wasn&amp;#8217;t fun enough, Nokia obviously doesn&amp;#8217;t think it is, if you use the Nokia MMSC Client libs they will generate their own 666 error code if they don&amp;#8217;t get anything back from the MMSC. Great!&lt;/p&gt;

&lt;p&gt;Seriously, how do people manage to come up with this crap. If you&amp;#8217;re going to define Error codes and Messages then FFS use them and don&amp;#8217;t have a &lt;em&gt;&quot;Oh we can't be bothered to tell you why&quot;&lt;/em&gt; message.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>XMLStarlet</title>
   <link href="http://sheepy.org/2008/06/24/xmlstarlet/"/>
   <updated>2008-06-24T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/06/24/xmlstarlet</id>
   <content type="html">&lt;p&gt;I&amp;#8217;m not the greatest fan of XML for much the same reasons as &lt;a href='http://www.codinghorror.com/'&gt;Jeff Atwood&lt;/a&gt; who wrote a controversial &lt;a href='http://www.codinghorror.com/blog/archives/001114.html'&gt;blog post&lt;/a&gt; on the subject&amp;lt;/a&amp;gt;.&lt;/p&gt;

&lt;p&gt;Sometimes though I&amp;#8217;m forced to deal with it. &lt;a href='http://xmlstar.sourceforge.net/'&gt;XMLStarlet&lt;/a&gt; looks like it might relieve some of my frustration.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href='http://bashcurescancer.com/'&gt;BASH Cures Cancer&lt;/a&gt; for &lt;a href='http://bashcurescancer.com/the-best-in-command-line-xml-xmlstarlet.html'&gt;flagging&lt;/a&gt; this.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Log Levels</title>
   <link href="http://sheepy.org/2008/06/18/log-levels/"/>
   <updated>2008-06-18T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/06/18/log-levels</id>
   <content type="html">&lt;p&gt;As a sysadmin I spend much of my day trawling though log files looking for problems. Unfortunately many developers don&amp;#8217;t appear to know how to use log levels effectively which can make a sysadmin&amp;#8217;s life a small hell when it comes to debugging.&lt;/p&gt;

&lt;p&gt;As a general rule I advise the following: &lt;blockquote&gt;
Be quiet about successful operations and verbose about unsuccessful ones.
&lt;/blockquote&gt;&lt;/p&gt;

&lt;p&gt;Yes I like to see what an application is doing but I don&amp;#8217;t need to know every function call that it&amp;#8217;s making, yes this is useful when developing an application but can make isolating a problem in production a real pain.&lt;/p&gt;

&lt;p&gt;Generally I use 4 different log levels:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DEBUG&lt;/li&gt;
&lt;li&gt;INFO&lt;/li&gt;
&lt;li&gt;WARN&lt;/li&gt;
&lt;li&gt;ERROR&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The definitions for these go something as follows:&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;DEBUG&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Things that should happen but you don't want to see in production. This includes function tracing, SQL statements, variable values etc...&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;INFO&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Things that should happen that give you just enough idea about what's going on. This should be limited to 1 or 2 lines per transaction,&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;WARN&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Things that shouldn't happen but the end user should see no difference. For example $foo failed so falling back to $bar instead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;b&gt;ERROR&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;Houston we have a problem! This is a serious error that has caused a problem for the end user. If you want to dump variables to the logs then now is a good time to do it.&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;Some applications do logging in a completely different way, they have more log levels. Generally in production you want to know just enough to know what the application is doing + all the warnings and errors.&lt;/p&gt;

&lt;p&gt;If something goes wrong then you need enough information to be able to replicate it. If all is well then, as sysadmins, we don&amp;#8217;t care.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>MySQL 5.1 on Debian Etch</title>
   <link href="http://sheepy.org/2008/06/04/mysql-5-1-on-debian-etch/"/>
   <updated>2008-06-04T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/06/04/mysql-5-1-on-debian-etch</id>
   <content type="html">&lt;p&gt;Here is a quick guide to getting MySQL installed on Debian Etch without pulling in anything from testing or unstable.&lt;/p&gt;

&lt;p&gt;Now there are a number of different ways you could do this but I wanted a debian package (as I have banned installing anything from source on new servers at work).&lt;/p&gt;

&lt;p&gt;After some google action I found that &lt;a href='http://tretkowski.de/blog/'&gt;Norbert Tretkowski&lt;/a&gt; had submitted packages to &lt;a href='http://packages.debian.org/experimental/misc/mysql-server'&gt;experimental&lt;/a&gt; However after checking these out they wanted to pull things in from testing and/or unstable and I didn&amp;#8217;t want that (especially considering it wanted to upgrade libc6)&lt;/p&gt;

&lt;p&gt;That said it turned out that this package would build fine on Etch by doing the following:&lt;/p&gt;

&lt;p&gt;Add the following to &lt;em&gt;/etc/apt/sources.list&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;deb http://ftp.uk.debian.org/debian/ experimental main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ experimental main contrib non-free&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then create &lt;em&gt;/etc/apt/preferences&lt;/em&gt; with the following in:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Package: *
Pin: release o=Debian,a=stable
Pin-Priority: 900
Package: *
Pin: release o=Debian
Pin-Priority: -1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which basically says &amp;#8220;only install stuff from stable&amp;#8221;.&lt;/p&gt;

&lt;p&gt;Next we get the dev tools and the build dependencies:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;aptitude install dpkg-dev devscripts
apt-get build-dep mysql-server-5.1
apt-get source mysql-server-5.1&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then build the .debs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd mysql-dfsg-5.1-5.1.24rc
debuild &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once that has finished get the run time deps:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;aptitude install libdbd-mysql-perl libdbi-perl&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And finally install the .debs we created earlier:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd ..
dpkg -i *.deb&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;#8230;and there you go, MySQL 5.1 on Debian Etch :)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>gnome-do</title>
   <link href="http://sheepy.org/2008/05/29/gnome-do/"/>
   <updated>2008-05-29T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/05/29/gnome-do</id>
   <content type="html">&lt;p&gt;So after a mate a work started raving about &lt;a href='http://do.davebsd.com/'&gt;Gnome Do&lt;/a&gt; I decided to give it another go, not quite remembering which I gave up with it last time.&lt;/p&gt;

&lt;p&gt;&lt;a href='ttp://docs.blacktree.com/quicksilver/what_is_quicksilver'&gt;Quicksilver&lt;/a&gt; is a program I&amp;#8217;ve always installed first when using any Mac and Gnome Do is a very similar thing for Linux.&lt;/p&gt;

&lt;p&gt;It wasn&amp;#8217;t long before I worked out why I had ditched it. I keep switching between window managers and seem to always end up back with &lt;a href='http://pekwm.org'&gt;pekwm&lt;/a&gt;. Launching Gnome Do in pekwm for some reason causes the &amp;#8220;window&amp;#8221; to end up behind all the other windows.&lt;/p&gt;

&lt;p&gt;A quick RTFM later and I found the answer. In my ~/.pekwm/autoproperties I added:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Property = &amp;quot;Do,Do&amp;quot; {
        ApplyOn = &amp;quot;Start New Reload&amp;quot;
        Layer   = &amp;quot;Menu&amp;quot;
        Title   = &amp;quot;^Do&amp;quot;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which forces it above all other windows.&lt;/p&gt;

&lt;p&gt;With that sorted the only thing left is the occasional erratic behavior of the window placement, but I can live with that for now :)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>irssi + screen + UTF-8</title>
   <link href="http://sheepy.org/2008/05/27/irssi-screen-utf-8/"/>
   <updated>2008-05-27T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/05/27/irssi-screen-utf-8</id>
   <content type="html">&lt;p&gt;I thought I&amp;#8217;d sorted this once but apparently not :(&lt;/p&gt;

&lt;p&gt;I&amp;#8217;d managed to get things sorted so that I could input pound signs and they would appear fine to me and everyone else but if someone else typed a pound sign I got a question mark.&lt;/p&gt;

&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; what was happening was that it was taking UTF-8 input and converting it to latin1&amp;#8230; not entirely sure.&lt;/p&gt;

&lt;p&gt;Anyway for those suffering the same issues take a look at &lt;a href='http://www.iovene.com/the-ultimate-guide-for-utf-8-in-irssi-and-gnuscreen/'&gt;The ultimate guide for UTF-8 in irssi and GNU/Screen&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Debian 'fixes' OpenSSL</title>
   <link href="http://sheepy.org/2008/05/14/debian-fixes-openssl/"/>
   <updated>2008-05-14T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/05/14/debian-fixes-openssl</id>
   <content type="html">&lt;p&gt;So it would appear that Debian &amp;#8221;&lt;a href='http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=363516&amp;quot;'&gt;fixed&lt;/a&gt;&amp;#8221; a problem in OpenSSL a few years ago. Unfortunately this &amp;#8220;fix&amp;#8221; has meant that they have had to release &lt;a href='http://lists.debian.org/debian-security-announce/2008/msg00152.html'&gt;this&lt;/a&gt; security announcement.&lt;/p&gt;

&lt;p&gt;Now this vulnerability is quite bad, so much so that Debian have stated the following:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is strongly recommended that all cryptographic key material which has been generated by OpenSSL versions starting with 0.9.8c-1 on Debian systems is recreated from scratch. Furthermore, all DSA keys ever used on affected Debian systems for signing or authentication purposes should be considered compromised; the Digital Signature Algorithm relies on a secret random value used during signature generation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href='http://www.links.org'&gt;Ben Laurie&lt;/a&gt; has posted a great &lt;a href='http://www.links.org?p=327'&gt;blog entry&lt;/a&gt; as to why this so stupid. This quote from that entry sums the problem up nicely: &lt;blockquote&gt;
Secondly, if you are going to fix bugs, then you should install this maxim of mine firmly in your head: never fix a bug you don’t understand.
&lt;/blockquote&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Temporary Solutions</title>
   <link href="http://sheepy.org/2008/04/25/temporary-solutions/"/>
   <updated>2008-04-25T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/04/25/temporary-solutions</id>
   <content type="html">&lt;p&gt;I&amp;#8217;m a firm believer that temporary solutions become permanent very quickly however this quote from &lt;a href='http://mysqldba.blogspot.com/2008/04/avoid-storing-markup-html-in-database.html'&gt;mySQL DBA&lt;/a&gt; is by far the best way of putting it.&lt;/p&gt;

&lt;p&gt;Remember kids &lt;blockquote&gt;There is nothing more Permanent then a temporary solution&lt;/blockquote&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Upgraded</title>
   <link href="http://sheepy.org/2008/04/05/upgraded/"/>
   <updated>2008-04-05T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/04/05/upgraded</id>
   <content type="html">&lt;p&gt;Upgraded to Drupal 6.1&lt;/p&gt;

&lt;p&gt;No major problems other than I forgot to set my site back to the default theme before updating.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Railscasts</title>
   <link href="http://sheepy.org/2008/04/05/railscasts/"/>
   <updated>2008-04-05T00:00:00+01:00</updated>
   <id>http://sheepy.org/2008/04/05/railscasts</id>
   <content type="html">&lt;p&gt;So I was pointed in the direction of &lt;a href='http://railscasts.com/'&gt;Railscasts.com&lt;/a&gt; and duly leeched the site:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;curl &amp;quot;http://feeds.feedburner.com/railscasts_ipod&amp;quot;  \
   | grep -Eo &amp;quot;http://media.railscasts.com/ipod_videos/.*m4v&amp;quot; \
   | sort | xargs -n1 wget -c&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;did the trick.&lt;/p&gt;

&lt;p&gt;Now I need to find time to watch them all :)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Bash Cures Cancer</title>
   <link href="http://sheepy.org/2008/02/24/bash-cures-cancer/"/>
   <updated>2008-02-24T00:00:00+00:00</updated>
   <id>http://sheepy.org/2008/02/24/bash-cures-cancer</id>
   <content type="html">&lt;p&gt;Another site that I&amp;#8217;ve just added to my feed list.&lt;/p&gt;

&lt;p&gt;Quite a few things on here I wasn&amp;#8217;t aware of such as:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;find . -name &amp;#39;file-*&amp;#39; -delete&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;is much faster than&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;find . -name &amp;#39;file-*&amp;#39; -exec rm {} \;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;although I need to test how it compares to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;find . -name &amp;#39;file-*&amp;#39; | xargs rm&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href='http://bashcurescancer.com/'&gt;BASH Cures Cancer&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Drupal 6 Released</title>
   <link href="http://sheepy.org/2008/02/23/drupal-6-released/"/>
   <updated>2008-02-23T00:00:00+00:00</updated>
   <id>http://sheepy.org/2008/02/23/drupal-6-released</id>
   <content type="html">&lt;p&gt;Apparently the Drupal 6.0 passed me by completely..&lt;br /&gt;&lt;br /&gt;Will look at upgrading soon to see what&amp;#8217;s new&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href='http://drupal.org/drupal-6.0'&gt;Drupal 6.0 released | drupal.org&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>XKCD Bug</title>
   <link href="http://sheepy.org/2008/01/30/xkcd-bug/"/>
   <updated>2008-01-30T00:00:00+00:00</updated>
   <id>http://sheepy.org/2008/01/30/xkcd-bug</id>
   <content type="html">&lt;a href='http://xkcd.com/376/'&gt;
&lt;img src='http://imgs.xkcd.com/comics/bug.png' /&gt;
&lt;/a&gt;</content>
 </entry>
 
 <entry>
   <title>Hacking BT Home Hubs</title>
   <link href="http://sheepy.org/2008/01/15/hacking-bt-home-hubs/"/>
   <updated>2008-01-15T00:00:00+00:00</updated>
   <id>http://sheepy.org/2008/01/15/hacking-bt-home-hubs</id>
   <content type="html">&lt;p&gt;So first we have the BT Voyger that gave out your username and password if you &lt;a href='http://www.securityfocus.com/bid/10589/exploit'&gt;asked it nicely&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Then, yet again, BT ship a router which another &lt;a href='http://www.gnucitizen.org/blog/bt-home-flub-pwnin-the-bt-home-hub-5'&gt;flaw&lt;/a&gt; in it.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve always had this gut feeling that &lt;a href='http://en.wikipedia.org/wiki/Universal_Plug_and_Play'&gt;UPnP&lt;/a&gt; was bad. It allows machines on your network to modify, for example, settings on your router without any authentication.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Check Email Script</title>
   <link href="http://sheepy.org/2008/01/13/check-email-script/"/>
   <updated>2008-01-13T00:00:00+00:00</updated>
   <id>http://sheepy.org/2008/01/13/check-email-script</id>
   <content type="html">&lt;p&gt;So I&amp;#8217;ve been playing with &lt;a href='http://conky.sf.net/'&gt;conky&lt;/a&gt; again and wanted it to check all my email accounts for new mail.&lt;/p&gt;

&lt;p&gt;I found &lt;a href='http://gentoo-wiki.com/TIP_conky#IMAP_Email_Checking_Script'&gt;this&lt;/a&gt; script but I wanted to check multiple accounts and show the total mail count in my inbox.&lt;/p&gt;

&lt;p&gt;After some hacking here is what I came up with&amp;#8230; and yes I&amp;#8217;ve removed the base64 encoding as it doesn&amp;#8217;t add any security what so ever!&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby

require &amp;quot;optparse&amp;quot;
require &amp;quot;net/imap&amp;quot;
#
# Parse options
#
def parse_options(args)

  # Hash to hold options
  options = Hash.new

  parser = OptionParser.new do |opts|

    opts.on(&amp;#39;-H host&amp;#39;, &amp;#39;--host host&amp;#39;, &amp;#39;Host&amp;#39;) do |v|
      options[:host] = v
    end

    opts.on(&amp;#39;-u user&amp;#39;, &amp;#39;--user user&amp;#39;, &amp;#39;User&amp;#39;) do |v|
      options[:user] = v
    end

    opts.on(&amp;#39;-p password&amp;#39;, &amp;#39;--password password&amp;#39;, &amp;#39;Password&amp;#39;) do |v|
      options[:password] = v
    end

    opts.on(&amp;#39;-h&amp;#39;, &amp;#39;--help&amp;#39;, &amp;#39;Displays usage information&amp;#39;) do
      puts opts
      exit 1
    end
  end

  # Parse Parameters
  begin
    parser.parse!(args)
  rescue OptionParser::ParseError =&amp;gt; e
    puts &amp;quot;Parse Error: &amp;quot; + e
    puts parser.to_a
  end

  # Check for required params
  if (options.has_key?(:host) &amp;amp;&amp;amp; options.has_key?(:user) &amp;amp;&amp;amp; options.has_key?(:password))
    #
    # Return options
    #
    options
  else
    puts parser.to_a
    exit 1
  end

end
options = parse_options(ARGV)

#
# Lets check some mail!
#
imap = Net::IMAP.new(options[:host])
imap.login(options[:user], options[:password])

#
# Get total mail
#
status = imap.status(&amp;quot;inbox&amp;quot;, [&amp;quot;MESSAGES&amp;quot;, &amp;quot;UNSEEN&amp;quot;])
puts &amp;quot;#{status[&amp;#39;UNSEEN&amp;#39;]}/#{status[&amp;#39;MESSAGES&amp;#39;]}&amp;quot;
imap.disconnect&lt;/code&gt;&lt;/pre&gt;</content>
 </entry>
 
 <entry>
   <title>DVD Ripping</title>
   <link href="http://sheepy.org/2007/12/19/dvd-ripping/"/>
   <updated>2007-12-19T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/12/19/dvd-ripping</id>
   <content type="html">&lt;p&gt;Just found a few scripts that look like they will make the process of ripping a DVD somewhat easier (for backup purposes of course!)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href='http://www.matusiak.eu/numerodix/blog/index.php/2007/01/30/undvd-dvd-ripping-made-easy/'&gt;undvd&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href='http://wonkabar.org/archives/373'&gt;dvd2mkv&lt;/a&gt; Although the 2nd one rips to &lt;a href='http://www.matroska.org/'&gt;Matroska&lt;/a&gt; format which can play on your phone :)&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Wombat Vim Theme</title>
   <link href="http://sheepy.org/2007/10/16/wombat-vim-theme/"/>
   <updated>2007-10-16T00:00:00+01:00</updated>
   <id>http://sheepy.org/2007/10/16/wombat-vim-theme</id>
   <content type="html">&lt;p&gt;Might have actually found a theme I like for gvim :)&lt;/p&gt;

&lt;p&gt;&lt;a href='http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/'&gt;http://dengmao.wordpress.com/2007/01/22/vim-color-scheme-wombat/&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Sysadmin tools</title>
   <link href="http://sheepy.org/2007/03/01/sysadmin-tools/"/>
   <updated>2007-03-01T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/03/01/sysadmin-tools</id>
   <content type="html">&lt;p&gt;There are a number of tools sysadmins should be looking at in order to make their life less hellish when it comes to configuration management.&lt;/p&gt;

&lt;p&gt;Some tools that I have found so far are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[cfengine](http://www.cfengine.org/)&lt;/li&gt;
&lt;li&gt;[Puppet](http://reductivelabs.com/projects/puppet/)&lt;/li&gt;
&lt;li&gt;[Bcfg2](http://trac.mcs.anl.gov/projects/bcfg2)&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Password Analysis</title>
   <link href="http://sheepy.org/2007/02/21/password-analysis/"/>
   <updated>2007-02-21T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/02/21/password-analysis</id>
   <content type="html">&lt;p&gt;After a recent phishing scam, which resulted in someone gaining over 55,000 passwords for my space, someone has posted some analysis on the passwords.&lt;/p&gt;

&lt;p&gt;See the results &lt;a href='http://www.schneier.com/blog/archives/2006/12/realworld_passw.html'&gt;here&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Kernel Sorted</title>
   <link href="http://sheepy.org/2007/02/12/kernel-sorted/"/>
   <updated>2007-02-12T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/02/12/kernel-sorted</id>
   <content type="html">&lt;p&gt;Upgrading my kernel to 2.6.18 appears to have fixed the issue I was having with aircrack.&lt;/p&gt;

&lt;p&gt;Now just need to write a script to make things a bit easier.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Aircrack</title>
   <link href="http://sheepy.org/2007/02/08/aircrack/"/>
   <updated>2007-02-08T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/02/08/aircrack</id>
   <content type="html">&lt;p&gt;Finally got a 1/2 decent wireless card that will do packet injection.&lt;/p&gt;

&lt;p&gt;All I need to do is wait for my kernel to compile again to remove SMP support. At which point I can get on with &lt;a href='http://www.aircrack-ng.org/doku.php?id=how_to_crack_wep_with_no_clients'&gt;this&lt;/a&gt; tutorial.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Ophcrack</title>
   <link href="http://sheepy.org/2007/02/01/ophcrack/"/>
   <updated>2007-02-01T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/02/01/ophcrack</id>
   <content type="html">&lt;p&gt;I&amp;#8217;ve yet &lt;em&gt;really&lt;/em&gt; understand Rainbow Tables but &lt;a href='https://www.isc2.org/cgi-bin/content.cgi?page=738'&gt;this article&lt;/a&gt; gives a good overview on the subject.&lt;/p&gt;

&lt;p&gt;Using this concept &lt;a href='http://ophcrack.sourceforge.net/'&gt;Ophcrack&lt;/a&gt; allows you to recover passwords from Windows based machines very quickly (we are talking single figure minutes at the most here) by exploiting the fact that, by default, Windows uses saltless hashes for passwords.&lt;/p&gt;

&lt;p&gt;The iso is downloading at the moment and will be put to good use ;)&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>MySQL Monitoring</title>
   <link href="http://sheepy.org/2007/02/01/mysql-monitoring/"/>
   <updated>2007-02-01T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/02/01/mysql-monitoring</id>
   <content type="html">&lt;p&gt;Database monitoring is a must if unless you like living on the edge.&lt;/p&gt;

&lt;p&gt;Here are some tools to help monitor MySQL so you don&amp;#8217;t get any nasty surprises:&lt;/p&gt;
&lt;h3&gt;
	&lt;a href='http://forums.cacti.net/about6108.html'&gt;
		The MySQL Graph Collection for cacti
	&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;a href='http://www.cacti.net'&gt;Cacti&lt;/a&gt; is a great tool for monitoring, giving you pretty graphs allowing you to easily spot sudden and long term trends.&lt;/p&gt;

&lt;p&gt;It takes some setting up but well worth it.&lt;/p&gt;

&lt;p&gt;I do not currently know how much extra load this will put on a database but I don&amp;#8217;t expect it to be much. Expect and updated post once I&amp;#8217;ve done some testing.&lt;/p&gt;
&lt;h3&gt;
	[mytop](http://jeremy.zawodny.com/mysql/mytop/)
&lt;/h3&gt;
&lt;p&gt;mytop is a console based monitoring tool by &lt;a href='http://jeremy.zawodny.com/'&gt;Jeremy Zawodny&lt;/a&gt; who helps look after &lt;a href='http://www.yahoo.com/'&gt;Yahoo&amp;#8217;s&lt;/a&gt; MySQL databases.&lt;/p&gt;

&lt;p&gt;It is basically a clone of &lt;em&gt;top&lt;/em&gt; for MySQL and is useful for seeing, in real time, what is happening on you MySQL server.&lt;/p&gt;
&lt;h3&gt;
	[innotop](http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/)
&lt;/h3&gt;
&lt;p&gt;innotop is much like mytop with but specifically for InnoDB tablespace. It can show loads of things such as &lt;a href='http://www.xaprb.com/innotop/innotop-screenshot-T-mode.png'&gt;transactions&lt;/a&gt;, &lt;a href='http://www.xaprb.com/innotop/innotop-screenshot-D-mode.png'&gt;deadlocks&lt;/a&gt; and &lt;a href='http://www.xaprb.com/innotop/innotop-screenshot-V-mode.png'&gt;statistics&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
	[MySQL Report](http://hackmysql.com/mysqlreport)
&lt;/h3&gt;
&lt;p&gt;This tool does nothing other than take the output of SHOW STATUS and puts it into a more readable form. The main thing is not necessarly the tool itself but the &lt;a href='http://hackmysql.com/mysqlreportguide'&gt;documentation&lt;/a&gt; that goes through a sample report and explains it line by line.&lt;/p&gt;

&lt;p&gt;This tool is extreamely use for for quickly diagnosing problems related to high load on a database.&lt;/p&gt;
&lt;h3&gt;
	Other Notes
&lt;/h3&gt;
&lt;p&gt;You really should monitor the size of your InnoDB table space and also individual table sizes. Its often the case that tables which grow rapidly contain redundant or old data eating up space and reducing the performance of the server.&lt;/p&gt;

&lt;p&gt;I have yet to find a nice script that will do this for you, especially when you have 100s or 1000s of tables, although it shouldn&amp;#8217;t be that tricky to hack one together.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Vista: The most secure operating system avaliable</title>
   <link href="http://sheepy.org/2007/01/31/vista-the-most-secure-operating-system-avaliable/"/>
   <updated>2007-01-31T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/01/31/vista-the-most-secure-operating-system-avaliable</id>
   <content type="html">&lt;p&gt;So apparently &lt;a href='http://news.bbc.co.uk/1/hi/technology/6313981.stm'&gt;Windows Vista is &amp;#8220;dramatically more secure than any other operating system released&amp;#8221;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While I suspect my definition of &amp;#8220;secure&amp;#8221; is wildly different that of Mr Gates, there are many other &lt;a href='http://arstechnica.com/articles/paedia/hardware/hdcp-vista.ars'&gt;worrying&lt;/a&gt; &lt;a href='http://www.theregister.co.uk/2006/10/29/microsoft_vista_eula_analysis/'&gt;things&lt;/a&gt; to consider.&lt;/p&gt;

&lt;p&gt;I don&amp;#8217;t think i&amp;#8217;ll be leaving my little Linux/BSD/OS X world just yet.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Bash Scripting Guide</title>
   <link href="http://sheepy.org/2007/01/24/bash-scripting-guide/"/>
   <updated>2007-01-24T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/01/24/bash-scripting-guide</id>
   <content type="html">&lt;p&gt;I&amp;#8217;m not convinced on some of the coding style but definitly looks useful.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://freeos.com/guides/lsst/'&gt;http://freeos.com/guides/lsst/&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Suspect Nation</title>
   <link href="http://sheepy.org/2007/01/23/suspect-nation/"/>
   <updated>2007-01-23T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/01/23/suspect-nation</id>
   <content type="html">&lt;p&gt;&lt;a href='http://youtube.com/watch?v=Qo0a23YDXLM'&gt;Watch on youtube&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well worth watching if you are at all interested in security.&lt;/p&gt;

&lt;p&gt;Its a documentary on the &amp;#8220;Security&amp;#8221; measures that the british goverment are putting in place, making you think if they are really a &amp;#8220;good thing&amp;#8221;.&lt;/p&gt;

&lt;p&gt;For hard core tech people, features include: &lt;ul&gt;
&lt;li&gt;RFID Exploits (including UK Passports)&lt;/li&gt;
&lt;li&gt;CCTV Security&lt;/li&gt;
&lt;li&gt;Wireless Security&lt;/li&gt;
&lt;li&gt;Mobile Phone exploits&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Bluetooth Obex DoS</title>
   <link href="http://sheepy.org/2007/01/23/bluetooth-obex-dos/"/>
   <updated>2007-01-23T00:00:00+00:00</updated>
   <id>http://sheepy.org/2007/01/23/bluetooth-obex-dos</id>
   <content type="html">&lt;p&gt;DoS your mobile phone with lots of Obex pushes. It would seem that most mobiles force you to either accept or deny the push, this disables any other usage of the phone including the ability to turn off bluetooth.&lt;/p&gt;

&lt;p&gt;This has apparently been confirmed on the following phones: &lt;ul&gt;
&lt;li&gt;Sony Ericsson K700i&lt;/li&gt;
&lt;li&gt;Nokia N70&lt;/li&gt;
&lt;li&gt;Motorola MOTORAZR V3&lt;/li&gt;
&lt;li&gt;Sony Ericsson W810i&lt;/li&gt;
&lt;li&gt;LG Chocolate KG800&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;

&lt;p&gt;No doubt many other phones are effected.&lt;/p&gt;

&lt;p&gt;Attached is the current release of the &lt;a href='http://www.xmailserver.org/ussp-push.html'&gt;ussp-push&lt;/a&gt; program which uses the &lt;a href='http://www.bluez.org/'&gt;Bluez&lt;/a&gt; bluetooth stack to do a Obex push.&lt;/p&gt;

&lt;p&gt;All that is required is a wrapper script of the form: &lt;pre&gt;
while true
do
        ./ussp-push $MAC@$OCHAN $FILENAME $FILENAME
done
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;You can work the rest out yourself&amp;#8230;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Cafepress</title>
   <link href="http://sheepy.org/2006/12/09/cafepress/"/>
   <updated>2006-12-09T00:00:00+00:00</updated>
   <id>http://sheepy.org/2006/12/09/cafepress</id>
   <content type="html">&lt;p&gt;Started a cafepress store.&lt;br /&gt;&lt;br /&gt;Find goodies at &lt;a href='http://www.afepress.com/cowjuice'&gt;http://www.afepress.com/cowjuice&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>GnuPlot</title>
   <link href="http://sheepy.org/2006/11/23/gnuplot/"/>
   <updated>2006-11-23T00:00:00+00:00</updated>
   <id>http://sheepy.org/2006/11/23/gnuplot</id>
   <content type="html">&lt;p&gt;&lt;a href='http://t16web.lanl.gov/Kawano/gnuplot/index-e.html'&gt;Excellent site&lt;/a&gt; on &lt;a href='http://gnuplot.info'&gt;GNUPlot&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>tar exploit in the wild</title>
   <link href="http://sheepy.org/2006/11/21/tar-exploit-in-the-wild/"/>
   <updated>2006-11-21T00:00:00+00:00</updated>
   <id>http://sheepy.org/2006/11/21/tar-exploit-in-the-wild</id>
   <content type="html">&lt;p&gt;Just when you thought you were safe&amp;#8230;&lt;/p&gt;

&lt;p&gt;&lt;a href='http://lists.grok.org.uk/pipermail/full-disclosure/2006-November/050812.html'&gt;http://lists.grok.org.uk/pipermail/full-disclosure/2006-November/050812.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have tested this and it works as described:&lt;/p&gt;
&lt;pre&gt;
nathan@holly /tmp $ tar --version
tar (GNU tar) 1.15.1
nathan@holly /tmp $ ~/tmp/tarxyz &gt; foo.tar
nathan@holly /tmp $ mkdir -p xyz/home/foo
nathan@holly /tmp $ echo &quot;Hello&quot; &gt; xyz/home/foo/hello.txt
nathan@holly /tmp $ tar -rf foo.tar xyz/home/foo
nathan@holly /tmp $ rootdo mkdir /home/foo
nathan@holly /tmp $ rootdo chown nathan /home/foo
nathan@holly /tmp $ rm -rf xyz
nathan@holly /tmp $ tar -xf foo.tar
nathan@holly /tmp $ ls -l xyz
lrwxrwxrwx 1 nathan users 1 Nov 22 00:03 xyz -&gt; /
nathan@holly /tmp $ cat /home/foo/hello.txt
Hello
nathan@holly /tmp $ 
&lt;/pre&gt;</content>
 </entry>
 
 <entry>
   <title>DrySQL</title>
   <link href="http://sheepy.org/2006/11/09/drysql/"/>
   <updated>2006-11-09T00:00:00+00:00</updated>
   <id>http://sheepy.org/2006/11/09/drysql</id>
   <content type="html">&lt;p&gt;Currently investigating this &lt;a href='http://www.rubyonrails.org/'&gt;Ruby on Rails&lt;/a&gt; thing that everyone is raving about and so far I&amp;#8217;m liking it.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://drysql.rubyforge.org/'&gt;DrySQL&lt;/a&gt; is one of the many examples as to why Rails rocks :)&lt;/p&gt;
&lt;blockquote&gt;
DrySQL is a Ruby plug-in that extends ActiveRecord and applies the DRY principle to Object-Relational Mapping.

The idea behind DrySQL is that you define columns, keys, constraints, and relationships on your database, and you shouldn't need to re-define any of these things in your application code.
&lt;/blockquote&gt;
&lt;p&gt;Shame about this thou&amp;#8230; &lt;blockquote&gt;has_and_belongs_to_many association generation is not implemented at this point &lt;/blockquote&gt;&lt;/p&gt;

&lt;p&gt;&amp;#8230; hopefully it&amp;#8217;ll be supported soon.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Bogofilter</title>
   <link href="http://sheepy.org/2006/11/04/bogofilter/"/>
   <updated>2006-11-04T00:00:00+00:00</updated>
   <id>http://sheepy.org/2006/11/04/bogofilter</id>
   <content type="html">&lt;p&gt;I, and other people on my server, are having SPAM issues again. Spamassassin is great but it eats RAM for breakfast about the same rate it eats SPAM.&lt;/p&gt;

&lt;p&gt;After some hunting I think I have found a solution: &lt;blockquote&gt;Bogofilter              is a mail filter that classifies mail as spam or ham (non-spam)              by a statistical analysis of the message's header and content (body).              The program is able to learn from the user's classifications and              corrections.
[Bogofilter Home Page](http://bogofilter.sourceforge.net/)&lt;/blockquote&gt;&lt;/p&gt;

&lt;p&gt;Happy SPAM munching.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Hard disk monitoring</title>
   <link href="http://sheepy.org/2006/05/18/hard-disk-monitoring/"/>
   <updated>2006-05-18T00:00:00+01:00</updated>
   <id>http://sheepy.org/2006/05/18/hard-disk-monitoring</id>
   <content type="html">&lt;p&gt;IDE drives are basically crap. However they are cheap so most people use them.&lt;/p&gt;

&lt;p&gt;I’ve recently discovered smartmontools which monitors most hard disks using S.M.A.R.T which allows the disk to do self testing.&lt;/p&gt;

&lt;p&gt;Setting up on gentoo is fairly easy and should hopefully give me some advanced warning of disk failure. Together with mdadm , which monitors raid arrays, then you can minimise the risk of loosing data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Big fat hairy warning&lt;/strong&gt; This is NOT any reason not to back up your data.&lt;/p&gt;

&lt;p&gt;On with the install and config. &lt;pre&gt;
emerge -v smartmontools
&lt;/pre&gt; Now create /etc/smartd.conf and have it contain something like the following: &lt;pre&gt;
/dev/hda -a -m nathan@domain -s (S/../.././02|L/../../4/05)
/dev/hdb -a -m nathan@domain -s (S/../.././03|L/../../5/05)
/dev/hdc -a -m nathan@domain -s (S/../.././04|L/../../6/05)
&lt;/pre&gt; The usual start on bootup. &lt;pre&gt;
rc-update add smartd default
/etc/init.d/smartd start
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;This config checks all supported attributes of the disks performs a short self test once a day at 2am, 3am and 4am for hda,b and c respectivly. It also does a long self test once a week at 5am on Thurs, Fri and Sat, again respectivly. If a test produces an error then it emails nathan@domain telling me so.&lt;/p&gt;

&lt;p&gt;Also check the man page for smartctl for more options and details.&lt;/p&gt;

&lt;p&gt;Next up - mdadm This is fairly trivial to set up and get working. Again it emails you when there is a problem.&lt;/p&gt;

&lt;p&gt;Install emerge -v mdadm&lt;/p&gt;

&lt;p&gt;Create the mdadm.conf with details of our RAID array &lt;pre&gt;
mdadm --detail --scan &gt; /etc/mdadm.conf
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;Set your email address &lt;pre&gt;
echo &quot;MAILADDR nathan@domain&quot; &gt;&gt; /etc/mdadm.conf
&lt;/pre&gt; Make the monitor start on boot, and start it now. &lt;pre&gt;
echo &quot;mdadm --monitor --scan --daemonise --config=/etc/mdadm.conf&quot; &gt;&gt; /etc/conf.d/local.start
/etc/init.d/local restart
&lt;/pre&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Dell 2005fpw</title>
   <link href="http://sheepy.org/2006/04/06/dell-2005fpw/"/>
   <updated>2006-04-06T00:00:00+01:00</updated>
   <id>http://sheepy.org/2006/04/06/dell-2005fpw</id>
   <content type="html">&lt;p&gt;My Dell 2005fpw 20&amp;#8221; widescreen TFT arrived today.&lt;/p&gt;

&lt;p&gt;Hunting arround there appears to be a few different modelines that people use for it.&lt;/p&gt;

&lt;p&gt;After some more digging the most popular seemed to be the following:&lt;/p&gt;
&lt;pre&gt;
ModeLine &quot;1680x1050&quot; 146.2 1680 1960 2136 2240 
         1050 1080 1086 1089 -hsync +vsync
&lt;/pre&gt;
&lt;p&gt;So the relevent part of /etc/X11/xorg.conf looks like:&lt;/p&gt;
&lt;pre&gt;
Section &quot;Modes&quot;
        Identifier &quot;16:10&quot;
        ModeLine &quot;1680x1050&quot; 146.2 1680 1960 2136 2240 
                 1050 1080 1086 1089 -hsync +vsync
&amp;nbsp;
EndSection
Section &quot;Monitor&quot;
        Identifier &quot;dell&quot;
        UseModes &quot;16:10&quot;
        HorizSync 30-83
        VertRefresh 56-75
EndSection
&amp;nbsp;
Section &quot;Screen&quot;
        Identifier &quot;Screen0&quot;
        Device     &quot;Card0&quot;
        Monitor    &quot;dell&quot;
        DefaultDepth 24
        SubSection &quot;Display&quot;
                Depth     24
                Modes &quot;1680x1050&quot; &quot;1280x1024&quot; 
                      &quot;1024x768&quot; &quot;800x600&quot;
                Viewport   0 0
        EndSubSection
EndSection
&lt;/pre&gt;</content>
 </entry>
 
 <entry>
   <title>...and so it begins</title>
   <link href="http://sheepy.org/2006/03/13/and-so-it-begins/"/>
   <updated>2006-03-13T00:00:00+00:00</updated>
   <id>http://sheepy.org/2006/03/13/and-so-it-begins</id>
   <content type="html">&lt;p&gt;Powered by &lt;a href='http://www.drupal.org/'&gt;Drupal&lt;/a&gt; this time.&lt;/p&gt;</content>
 </entry>
 
 
</feed>

