<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cd ~</title>
	<atom:link href="http://www.rottenbytes.info/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.rottenbytes.info</link>
	<description>/home/nico</description>
	<lastBuildDate>Wed, 08 Sep 2010 17:33:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SVN agent for Mcollective</title>
		<link>http://www.rottenbytes.info/?p=378</link>
		<comments>http://www.rottenbytes.info/?p=378#comments</comments>
		<pubDate>Wed, 08 Sep 2010 17:33:41 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Puppet]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[mcollective]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=378</guid>
		<description><![CDATA[ Most people that work with puppet use a VCS : subversion, git, CVS, mercurial&#8230; Pick yours. My company uses subversion and each cmmit to the repository needs to be pulled by the master. Since I have two masters, I also want them to be synchronized. Once again it&#8217;s mcollective that comes to the rescue. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-62" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" /> Most people that work with puppet use a VCS : subversion, git, CVS, mercurial&#8230; Pick yours. My company uses subversion and each cmmit to the repository needs to be pulled by the master. Since I have two masters, I also want them to be synchronized. Once again it&#8217;s mcollective that comes to the rescue. I wrote a very simple agent (a 5 minutes work, to be improved) that can update a specified path. Grab it <a href="http://github.com/rottenbytes/mcollective/tree/master/plugins/agents/">here</a>. Once it is deployed you can use a post commit hook that calls it.</p>
<p>Example of mine :</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/local/bin/ruby</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'mcollective'</span>
<span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">MCollective::RPC</span>
&nbsp;
mc = rpcclient<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;svnagent&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
mc.<span style="color:#9900CC;">progress</span> = <span style="color:#0000FF; font-weight:bold;">false</span>
mc.<span style="color:#9900CC;">class_filter</span> <span style="color:#996600;">&quot;puppet::master&quot;</span>
mc.<span style="color:#9900CC;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:path</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/etc/puppet&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>The agent will only be called on machines being puppet masters by using the class filter.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=378</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nagios check for MongoDB</title>
		<link>http://www.rottenbytes.info/?p=370</link>
		<comments>http://www.rottenbytes.info/?p=370#comments</comments>
		<pubDate>Wed, 18 Aug 2010 09:21:42 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=370</guid>
		<description><![CDATA[Quick post : installing a mongo server is good, monitoring it is better. I wrote a very basic check that ensure your mongo DB is healthy. Grab it on my github.
]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-95" title="Ruby" src="http://www.rottenbytes.info/wp-content/uploads/2009/03/ruby.png" alt="Ruby" width="80" height="80" />Quick post : installing a mongo server is good, monitoring it is better. I wrote a very basic check that ensure your mongo DB is healthy. <a href="http://github.com/rottenbytes/Scripts/blob/master/monitoring/check_mongo.rb">Grab it</a> on my github.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=370</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>M{ongo,collective,oar !}</title>
		<link>http://www.rottenbytes.info/?p=335</link>
		<comments>http://www.rottenbytes.info/?p=335#comments</comments>
		<pubDate>Wed, 18 Aug 2010 09:17:56 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[BOFH Life]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[mcollective]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=335</guid>
		<description><![CDATA[ In my last post I&#8217;ve been talking about mcollective (check the new website) and mongo and how awesome it is.
I&#8217;ve mentioned the docs available in the wiki but I&#8217;ve been too fast on this point; it&#8217;s not yet in the wiki (only some parts) so here is a little &#8220;guide&#8221; about setting the pieces [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-62" style="margin-left: 3px; margin-right: 3px;" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" /> In my last post I&#8217;ve been talking about mcollective (check the <a href="http://marionette-collective.org/">new website</a>) and mongo and how awesome it is.</p>
<p>I&#8217;ve mentioned the docs available in the wiki but I&#8217;ve been too fast on this point; it&#8217;s not yet in the wiki (only some parts) so here is a little &#8220;guide&#8221; about setting the pieces work together. All comments are welcome.</p>
<ul>
<li>Deploy <a href="http://github.com/ripienaar/mcollective-plugins/blob/master/registration/meta.rb">meta.rb</a> on all your  nodes. It will make the metadata available to other nodes.</li>
<li>Add the following lines to your server.cfg file :</li>
</ul>
<blockquote>
<pre>registration = Meta
registerinterval = 300</pre>
</blockquote>
<ul>
<li>Install a mongoDB server (debian ships it in squeeze)</li>
<li>Deploy the <a href="http://github.com/ripienaar/mcollective-plugins/blob/master/agent/registration-mongodb/registration.rb">mongo registration agent</a> on one node (don&#8217;t be like me, do not start deploying it on all nodes !). It will &#8220;suck&#8221; metadata from nodes, and insert it to the mongo database.</li>
<li>Add the following lines to your server.cfg on the host with the registration agent :</li>
</ul>
<blockquote>
<pre>plugin.registration.mongohost = mongo.mycorp.net
plugin.registration.mongodb = puppet
plugin.registration.collection = nodes</pre>
</blockquote>
<ul>
<li>Connect to your mongoDB and enjoy :</li>
</ul>
<blockquote>
<pre>$ mongo mongo.mycorp.net/puppet
MongoDB shell version: 1.6.0
connecting to: mongo.mycorp.net/puppet
&gt; db.nodes.find().count()
59</pre>
</blockquote>
<ul>
<li>You&#8217;re done !</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=335</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mcollective &amp; OpenBSD</title>
		<link>http://www.rottenbytes.info/?p=329</link>
		<comments>http://www.rottenbytes.info/?p=329#comments</comments>
		<pubDate>Thu, 12 Aug 2010 07:16:46 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[BOFH Life]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[mcollective]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[openbsd]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=329</guid>
		<description><![CDATA[I run a bunch of box under OpenBSD at $WORK and I wanted to be able to run mcollective on these too. Unfortunately, there were no package available for this OS. So I took time and with some help from landry@ I was able to build a port. It has been integrated into the github [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg"><img class="alignleft size-full wp-image-62" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" /></a>I run a bunch of box under OpenBSD at $WORK and I wanted to be able to run mcollective on these too. Unfortunately, there were no package available for this OS. So I took time and with some help from landry@ I was able to build a port. <a href="http://github.com/mcollective/marionette-collective/tree/development/ext/openbsd/">It has been integrated</a> into the github repo quickly. But to be able to use mcollective you also need to have the ruby stomp connector. As I don&#8217;t like using gems and prefer them packages, I also built a port for it. You can grab it in my github repository <a href="http://github.com/rottenbytes/OpenBSD/tree/master/ruby-stomp/">here</a>.</p>
<p>R.I. Pienaar also added some cool mongo stuff to mcollective (see the project wiki for more details) and I built 2 more ports for the <a href="http://github.com/rottenbytes/OpenBSD/tree/master/ruby-bson/">bson</a> &amp; <a href="http://github.com/rottenbytes/OpenBSD/tree/master/ruby-mongo/">mongo</a> gems.</p>
<p>These packages have been tested under OpenBSD 4.7 (i386, but they are no_arch ones, ruby related), let me know if they work for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=329</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A new brick in my infrastructure</title>
		<link>http://www.rottenbytes.info/?p=323</link>
		<comments>http://www.rottenbytes.info/?p=323#comments</comments>
		<pubDate>Wed, 23 Jun 2010 10:19:34 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[BOFH Life]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[fast]]></category>
		<category><![CDATA[mcollective]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=323</guid>
		<description><![CDATA[If you read this blog you may know I daily use puppet at $WORK. Puppet is made to maintain configuration on machines, but not for one shot actions. For a couple of month I used to work with fabric for this but It had a few drawbacks, mainly because you need to maintain the list [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg"><img class="size-full wp-image-62 alignleft" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" /></a>If you read this blog you may know I daily use puppet at $WORK. Puppet is made to maintain configuration on machines, but not for one shot actions. For a couple of month I used to work with fabric for this but It had a few drawbacks, mainly because you need to maintain the list of hosts you want to act on and that it hates dead hosts, even if <a href="http://ghantoos.org/">ghantoos</a> dropped a link showing how to <a href="http://stackoverflow.com/questions/1956777/how-to-make-fabric-ignore-offline-hosts-in-the-env-hosts-list">get rid of this</a>. So I replaced it with <a href="http://code.google.com/p/mcollective/">mcollective</a> : not exactly the same (it uses an agent instead of SSH) but it dynamicaly knows which hosts are up, allows to filter on facts (from facter, the puppet companion).</p>
<p>You could think that needing an agent is a drawback but it allows much complex actions, fine grained logic. Moreover it does not require much work to be installed if you already have puppet running. If you have a high number of machines you gain scalability with real parallel actions : it does not take longer to run on 5 machines than on 100.</p>
<p>One more point is the active development : R.I. Pienaar released 2 versions recently, improving access control, adding DDL to create interfaces easily. You can give your unprivileged staff some power through a web interface in less than 100 lines of code.</p>
<p>A tool for sysadmins that appreciate the devops spirit and want to do more in less time !</p>
<p>I&#8217;ll be publishing my agent and related tools on <a href="http://github.com/rottenbytes/mcollective">my github account</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=323</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switching from munin to collectd</title>
		<link>http://www.rottenbytes.info/?p=309</link>
		<comments>http://www.rottenbytes.info/?p=309#comments</comments>
		<pubDate>Thu, 20 May 2010 07:28:37 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[BOFH Life]]></category>
		<category><![CDATA[NetAdmin]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[collectd]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[munin]]></category>
		<category><![CDATA[visage]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=309</guid>
		<description><![CDATA[Readers of this little blog may know I&#8217;ve spent some time to have a munin setup that was tweaked to be optimized. But I&#8217;ve reached a point where my knowledge did not suffice to balance the design problems of munin. This is not a rant, I just say that when your infrastructure reaches a certain [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg"><img class="size-full wp-image-62 alignleft" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" /></a>Readers of this little blog may know I&#8217;ve spent some time to have a munin setup that was tweaked to be optimized. But I&#8217;ve reached a point where my knowledge did not suffice to balance the design problems of munin. This is not a rant, I just say that when your infrastructure reaches a certain size munin reaches its limits. The pull based model, the graph generation (don&#8217;t tell me about the CGI graph, this thing never worked as expected) overloaded my management box. Talking with other peoples brought collectd to my attention so I gave it a try.</p>
<p>Collectd has many nice features : 10 seconds precision (versus 5 minutes), written in C for performance, multicast support (even if I don&#8217;t use it), and you can even create collectd relays. There are some packages for many different targets, even for my OpenWRT based access points ! Configuration can easily be automated (flat files, superior), a mandatory point to me.</p>
<p>Of course collectd comes without an UI but that&#8217;s no big deal : there are many around. As I said in the previous post, I use <a href="http://auxesis.github.com/visage/">visage</a>.</p>
<p>For the load generated a picture says a thousand words (click to enlarge) :</p>
<p style="text-align: center;"><a href="http://www.rottenbytes.info/wp-content/uploads/2010/05/goodbyemunin.png"><img class="aligncenter size-medium wp-image-310" title="goodbyemunin" src="http://www.rottenbytes.info/wp-content/uploads/2010/05/goodbyemunin-300x85.png" alt="goodbyemunin" width="300" height="85" /></a></p>
<p style="text-align: center;">
<p style="text-align: left;">Next step is working on the IO congestion caused by so many RRD updates, collectd wiki has many tips about this, this will probably be fixed in a couple of hours.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=309</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Monitoring, another way</title>
		<link>http://www.rottenbytes.info/?p=302</link>
		<comments>http://www.rottenbytes.info/?p=302#comments</comments>
		<pubDate>Tue, 18 May 2010 08:54:11 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[BOFH Life]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[NetAdmin]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[collectd]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[visage]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=302</guid>
		<description><![CDATA[Some friends told me for a while about collectd, why I should look at it, why munin is so painful and so on. If you&#8217;ve been reading my posts you know I have tweaked a little my $WORK munin install to make it faster and lighter. But I finally took time to explore collectd, and [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-62" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" />Some friends told me for a while about collectd, why I should look at it, why munin is so painful and so on. If you&#8217;ve been reading my posts you know I have tweaked a little my $WORK munin install to make it faster and lighter. But I finally took time to explore collectd, and I regret to not have done this before. It has so many pros that I decided to implement it in parallel with munin (because I can&#8217;t afford being blind on metrics). But collectd comes without an UI : it &#8220;only&#8221; collectds data, but that&#8217;s not a problem. There are various web interfaces and after giving a look to a bunch of them I fell in love with <a href="http://holmwood.id.au/~lindsay/">Lindsay Holmwood</a>&#8217;s <a href="http://auxesis.github.com/visage/">Visage</a>.</p>
<p>This piece of software is definitely cool : all graphs are rendered live in your browser in SVG. Yes ! Realtime graphs, no need for crappy flash s***, zoom. It is based on sinatra, haml and some JS libraries (I won&#8217;t talk about this, my JS foo is deeper than the Mariana Trench). But it lacked some features : it&#8217;s OK when you have a few hosts but when the hosts list starts being loooong then the interface needs some improvements. So <a href="http://github.com/rottenbytes/visage">I forked it on github</a> and implemented (some parts of) what I needed. My github fork has host grouping &amp; per host profiles. Check this out and enjoy Visage !</p>
<p>Now working on sets of graphs <img src='http://www.rottenbytes.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>PS : &lt;3 Guigui2</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=302</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mcollective &amp; Xen : naughty things</title>
		<link>http://www.rottenbytes.info/?p=291</link>
		<comments>http://www.rottenbytes.info/?p=291#comments</comments>
		<pubDate>Wed, 14 Apr 2010 09:16:50 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[BOFH Life]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[mcollective]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=291</guid>
		<description><![CDATA[I already blogged about my experiments with mcollective &#38; xen but I had something a little bigger in my mind. A friend had sent me a video showing some vmware neat features (DRS mainly) with VMs migrating through hypervisors automatically.
So I wrote a &#8220;proof of concept&#8221; of what you can do with an awesome tool [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-62" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" />I already blogged about my experiments with <a href="http://code.google.com/p/mcollective/">mcollective</a> &amp; xen but I had something a little bigger in my mind. A friend had sent me a <a href="http://www.youtube.com/watch?v=7CbRS0GGuNc">video</a> showing some vmware neat features (DRS mainly) with VMs migrating through hypervisors automatically.</p>
<p>So I wrote a &#8220;proof of concept&#8221; of what you can do with an awesome tool like mcollective. The setup of this funny game is the following :</p>
<ul>
<li>1 box used a iSCSI target that serves volumes to the world</li>
<li>2 xen hypervisors (lenny packages) using open-iscsi iSCSI initiator to connect to the target. VMs are stored in LVM, nothing fancy</li>
</ul>
<p>The 3 boxens are connected on a 100Mb network and the hypervisors have an additionnal gigabit network card with a crossover cable to link them (yes, this is a lab setup). You can find a live migration howto <a href="http://www.performancemagic.com/iscsi-xen-howto/">here</a>.</p>
<p>For the mcollective part I used my Xen agent (slightly modified from the previous post to support migration), which is based on <a href="http://github.com/rottenbytes/ruby-xen">my xen gem</a>. The client is the largest part of the work but it&#8217;s still less than 200 lines of code. It can (and will) be improved because all the config is hardcoded. It would also deserve a little DSL to be able to handle more &#8220;logic&#8221; than &#8220;if load is superior to foo&#8221; but as I said before, it&#8217;s a proof of concept.</p>
<p>Let&#8217;s see it in action :</p>
<pre>hypervisor2:~# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   233     2     r-----    873.5</pre>
<pre>hypervisor3:~# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   232     2     r-----  78838.0
test1                                        6   256     1     -b----     18.4
test2                                        4   256     1     -b----     19.3
test3                                       20   256     1     r-----     11.9</pre>
<p>test3 is a VM that is &#8220;artificially&#8221; loaded, as is the machine &#8220;hypervisor3&#8243; (to trigger migration)</p>
<pre>[mordor:~] ./mc-xen-balancer
[+] hypervisor2 : 0.0 load and 0 slice(s) running
[+] init/reset load counter for hypervisor2
[+] hypervisor2 has no slices consuming CPU time
[+] hypervisor3 : 1.11 load and 3 slice(s) running
[+] added test1 on hypervisor3 with 0 CPU time (registered 18.4 as a reference)
[+] added test2 on hypervisor3 with 0 CPU time (registered 19.4 as a reference)
[+] added test3 on hypervisor3 with 0 CPU time (registered 18.3 as a reference)
[+] sleeping for 30 seconds

[+] hypervisor2 : 0.0 load and 0 slice(s) running
[+] init/reset load counter for hypervisor2
[+] hypervisor2 has no slices consuming CPU time
[+] hypervisor3 : 1.33 load and 3 slice(s) running
[+] updated test1 on hypervisor3 with 0.0 CPU time eaten (registered 18.4 as a reference)
[+] updated test2 on hypervisor3 with 0.0 CPU time eaten (registered 19.4 as a reference)
[+] updated test3 on hypervisor3 with 1.5 CPU time eaten (registered 19.8 as a reference)
[+] sleeping for 30 seconds

[+] hypervisor2 : 0.16 load and 0 slice(s) running
[+] init/reset load counter for hypervisor2
[+] hypervisor2 has no slices consuming CPU time
[+] hypervisor3 : 1.33 load and 3 slice(s) running
[+] updated test1 on hypervisor3 with 0.0 CPU time eaten (registered 18.4 as a reference)
[+] updated test2 on hypervisor3 with 0.0 CPU time eaten (registered 19.4 as a reference)
[+] updated test3 on hypervisor3 with 1.7 CPU time eaten (registered 21.5 as a reference)
[+] hypervisor3 has 3 threshold overload
[+] Time to see if we can migrate a VM from hypervisor3
[+] VM key : hypervisor3-test3
[+] Time consumed in a run (interval is 30s) : 1.7
[+] hypervisor2 is a candidate for being a host (step 1 : max VMs)
[+] hypervisor2 is a candidate for being a host (step 2 : max load)
trying to migrate test3 from hypervisor3 to hypervisor2 (10.0.0.2)
Successfully migrated test3 !</pre>
<p>Let&#8217;s see our hypervisors :</p>
<pre>hypervisor2:~# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   233     2     r-----    878.9
test3                                       25   256     1     -b----      1.1</pre>
<pre>hypervisor3:~# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   232     2     r-----  79079.3
test1                                        6   256     1     -b----     18.4
test2                                        4   256     1     -b----     19.4</pre>
<p>A little word about configuration options :</p>
<ul>
<li>interval : the poll time in seconds.  this should not be too low, let the machine some time and avoid load peeks to distort the logic.</li>
<li>load_threshold : where you consider the machine load is too high and that it is time to move some stuff away (tampered with max_over, see below)</li>
<li>daemonize : not used yet</li>
<li>max_over : maximum time (in minutes) where load should be superior to the limit. When reached, it&#8217;s time, really. Don&#8217;t set it too low and at least 2*interval or sampling will not be efficient</li>
<li>debug : well&#8230;.</li>
<li>max_vm_per_host : the maximum VMs a host can handle. If a host already hit this limit it will not be candidate for receiving a VM</li>
<li>max_load_candidate : same thing as above, but for the load</li>
<li>host_mapping : a simple CSV file to handle non-DNS destinations (typically my crossover cable address have no DNS entries)</li>
</ul>
<p>What is left to do :</p>
<ul>
<li>Add some barriers to avoid migration madness to let load go down after a migration or to avoid migrating a VM permanently</li>
<li>Add a DSL to insert some more logic</li>
<li>Write a real client, not a big fat loop</li>
</ul>
<p>Enjoy the tool !</p>
<p>Files :</p>
<ul>
<li>the <a href="http://www.rottenbytes.info/wp-content/uploads/2010/04/xenagent.rb">xen agent</a> (updated)</li>
<li>the <a title="Xen load balancing tool" href="http://www.rottenbytes.info/wp-content/uploads/2010/04/mc-xen-balancer">mc-xen-balancer client</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=291</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Meet the marionette</title>
		<link>http://www.rottenbytes.info/?p=281</link>
		<comments>http://www.rottenbytes.info/?p=281#comments</comments>
		<pubDate>Tue, 06 Apr 2010 09:33:24 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Général]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[mcollective]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=281</guid>
		<description><![CDATA[Another cool project I keep an eye on for some weeks is &#8220;the marionette collective&#8220;, aka mcollective. This project is leaded &#38; develloped by R.I. Pienaar, one of the most active people in the puppet world too.
Mcollective is an framework for distributed sysadmin. It relies on a messaging framework and has many features included : [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-62" title="eth0" src="http://www.rottenbytes.info/wp-content/uploads/2009/02/eth0.jpg" alt="eth0" width="80" height="103" />Another cool project I keep an eye on for some weeks is &#8220;<a href="http://code.google.com/p/mcollective/">the marionette collective</a>&#8220;, aka mcollective. This project is leaded &amp; develloped by R.I. Pienaar, one of the most active people in the puppet world too.</p>
<p>Mcollective is an framework for distributed sysadmin. It relies on a messaging framework and has many features included : flexibility, speed, easy to understand.</p>
<p>Some time ago, I had wrote a tool called &#8220;whosyourdaddy&#8221; to help me (and my memory as big as a goldfish one) to find on which Xen dom0 a Xen domU was living. It worked fine, expect the fact that is was not dynamic : if a VM was migrated  from a dom0 to another, I had to update the CMDB. Not really reliable (if an update fails the CMDB is no more accurate) and I didn&#8217;t want to have to embed this constraint in the Xen logic. So I decided to try out to write my own mcollective agent and here it is ! It is built on top of a (very) small <a href="http://github.com/rottenbytes/ruby-xen">ruby module for xen</a> and has it own client.</p>
<p>You can find on which dom0 a domU resides :</p>
<pre>master1:~# ./mc-xen -a find --domu test
hypervisor2              : Absent
hypervisor1              : Absent
master1:~# ./mc-xen -a find --domu domu2
hypervisor2              : Present
hypervisor1              : Absent</pre>
<p>Or list your domUs :</p>
<pre>master1:~# ./mc-xen -a list
hypervisor2              
 domu2

hypervisor1              
 no domU running</pre>
<p>Download <a href="http://www.rottenbytes.info/wp-content/uploads/2010/04/xenagent.rb">the agent</a> &amp; <a title="Mcollective Xen client" href="http://www.rottenbytes.info/wp-content/uploads/2010/04/mc-xen">the client</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=281</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In the network space no one can hear your puppet scream</title>
		<link>http://www.rottenbytes.info/?p=271</link>
		<comments>http://www.rottenbytes.info/?p=271#comments</comments>
		<pubDate>Tue, 02 Mar 2010 15:15:59 +0000</pubDate>
		<dc:creator>Nico</dc:creator>
				<category><![CDATA[BOFH Life]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Puppet]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.rottenbytes.info/?p=271</guid>
		<description><![CDATA[I&#8217;ve been lazy at maintaining my servers recently and decided to start playing with puppet reports. First I started with something simple that helps me to find on which machines my manifests have some failure.
So here&#8217;s a quick and dirty code that goes through Puppet&#8217;s reportdir and points out neglected machines.

#!/usr/bin/env ruby
&#160;
require 'puppet'
require 'find'
require 'yaml'
require [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-54" title="kermit" src="http://www.rottenbytes.info/wp-content/uploads/2009/01/kermit.jpg" alt="kermit" width="108" height="127" />I&#8217;ve been lazy at maintaining my servers recently and decided to start playing with puppet reports. First I started with something simple that helps me to find on which machines my manifests have some failure.</p>
<p>So here&#8217;s a quick and dirty code that goes through Puppet&#8217;s reportdir and points out neglected machines.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'puppet'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'find'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'yaml'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'optparse'</span>
&nbsp;
Puppet<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:config</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;/etc/puppet/puppet.conf&quot;</span>
Puppet.<span style="color:#9900CC;">parse_config</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> most_recent_file<span style="color:#006600; font-weight:bold;">&#40;</span>path<span style="color:#006600; font-weight:bold;">&#41;</span>
	reports = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
	<span style="color:#CC00FF; font-weight:bold;">Find</span>.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>path<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |file|
		<span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">file</span>? file
			reports <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">basename</span><span style="color:#006600; font-weight:bold;">&#40;</span>file,<span style="color:#996600;">&quot;.yaml&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
		<span style="color:#9966CC; font-weight:bold;">end</span>
	<span style="color:#006600; font-weight:bold;">&#125;</span>
	reports.<span style="color:#9900CC;">sort</span>!.<span style="color:#9900CC;">reverse</span>!
	<span style="color:#0000FF; font-weight:bold;">return</span> path<span style="color:#006600; font-weight:bold;">+</span><span style="color:#996600;">&quot;/&quot;</span><span style="color:#006600; font-weight:bold;">+</span>reports<span style="color:#006600; font-weight:bold;">&#91;</span>0<span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_s</span><span style="color:#006600; font-weight:bold;">+</span><span style="color:#996600;">&quot;.yaml&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> scan_dir<span style="color:#006600; font-weight:bold;">&#40;</span>path, debug=<span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>
	<span style="color:#CC00FF; font-weight:bold;">Find</span>.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span>path<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |entry|
		<span style="color:#9966CC; font-weight:bold;">if</span> entry != path <span style="color:#008000; font-style:italic;"># don't scan the basedir</span>
			<span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">directory</span>? entry
				report = most_recent_file<span style="color:#006600; font-weight:bold;">&#40;</span>entry<span style="color:#006600; font-weight:bold;">&#41;</span>
				scan_file<span style="color:#006600; font-weight:bold;">&#40;</span>report, debug<span style="color:#006600; font-weight:bold;">&#41;</span>
			<span style="color:#9966CC; font-weight:bold;">end</span>
		<span style="color:#9966CC; font-weight:bold;">end</span>
	<span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> scan_file<span style="color:#006600; font-weight:bold;">&#40;</span>filename, debug=<span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>
	notify_on_field = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:failed</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
	<span style="color:#008000; font-style:italic;"># debug</span>
	<span style="color:#9966CC; font-weight:bold;">if</span> debug <span style="color:#9966CC; font-weight:bold;">then</span>  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;scanning &quot;</span> <span style="color:#006600; font-weight:bold;">+</span> filename <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
	fp=<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>filename,<span style="color:#996600;">&quot;r&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
	<span style="color:#CC00FF; font-weight:bold;">YAML</span>::load_documents<span style="color:#006600; font-weight:bold;">&#40;</span>fp<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |report|
		report.<span style="color:#9900CC;">metrics</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;resources&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">values</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |value|
			<span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>notify_on_field.<span style="color:#9966CC; font-weight:bold;">include</span>? value<span style="color:#006600; font-weight:bold;">&#91;</span>0<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">and</span> <span style="color:#006600; font-weight:bold;">&#40;</span>value<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&gt;</span> 0<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">then</span>
				<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;#{report.host} has #{value[2]} #{value[0]} resource(s)&quot;</span>
				<span style="color:#9966CC; font-weight:bold;">if</span> debug <span style="color:#9966CC; font-weight:bold;">then</span>
					<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;log message(s) :&quot;</span>
					report.<span style="color:#9900CC;">logs</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |log|
						<span style="color:#CC0066; font-weight:bold;">puts</span> log.<span style="color:#9900CC;">message</span>
					<span style="color:#006600; font-weight:bold;">&#125;</span>
				<span style="color:#9966CC; font-weight:bold;">end</span>
			<span style="color:#9966CC; font-weight:bold;">end</span>
		<span style="color:#006600; font-weight:bold;">&#125;</span>
	<span style="color:#006600; font-weight:bold;">&#125;</span>	
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
options = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
myargs = <span style="color:#CC0066; font-weight:bold;">Array</span>
&nbsp;
optparse = OptionParser.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |opts|
	opts.<span style="color:#9900CC;">banner</span> = <span style="color:#996600;">&quot;Usage : report_check.rb&quot;</span>
&nbsp;
	options<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:show</span><span style="color:#006600; font-weight:bold;">&#93;</span>=<span style="color:#0000FF; font-weight:bold;">false</span>
	opts.<span style="color:#9900CC;">on</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;-d&quot;</span>, <span style="color:#996600;">&quot;--debug&quot;</span>, <span style="color:#996600;">&quot;runs in debug mode&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> |debug|
		options<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:debug</span><span style="color:#006600; font-weight:bold;">&#93;</span>=<span style="color:#0000FF; font-weight:bold;">true</span>
	<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
	opts.<span style="color:#9900CC;">on</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;-h&quot;</span>, <span style="color:#996600;">&quot;--help&quot;</span>, <span style="color:#996600;">&quot;Displays this help&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
		<span style="color:#CC0066; font-weight:bold;">puts</span> opts
		<span style="color:#CC0066; font-weight:bold;">exit</span>
	<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
optparse.<span style="color:#9900CC;">parse</span>!
&nbsp;
scan_dir<span style="color:#006600; font-weight:bold;">&#40;</span>Puppet<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:reportdir</span><span style="color:#006600; font-weight:bold;">&#93;</span>, options<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:debug</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rottenbytes.info/?feed=rss2&amp;p=271</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
