<?xml version="1.0" encoding="UTF-8"?>
<posts type="array">
  <post>
    <id type="integer">56</id>
    <title>Setting up Munin on Ubuntu 11.10</title>
    <slug>setting-up-munin-on-ubuntu-11-10</slug>
    <image>munin.png</image>
    <preview>&lt;p&gt;
	This post is how to setup munin 1.4.5, one munin-server and one munin-node machine. I&amp;#39;m going to use two Ubuntu 11.10 (Oneiric Ocelot) EC2 instances to show you how to set this up.&lt;/p&gt;
</preview>
    <content>&lt;p&gt;
	Just skip to the next step if you already have your machines available. If you want to setup some new machines on EC2, follow from here...&lt;/p&gt;
&lt;table border="1" cellpadding="1" cellspacing="1" style="width: 500px;"&gt;
	&lt;tbody&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;strong&gt;Name&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;
				&lt;strong&gt;Instance Type&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;
				&lt;strong&gt;AMI ID&lt;/strong&gt;&lt;/td&gt;
			&lt;td&gt;
				&lt;strong&gt;Internal IP&lt;/strong&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				munin-server&lt;/td&gt;
			&lt;td&gt;
				Micro&lt;/td&gt;
			&lt;td&gt;
				ami-61b28015&lt;/td&gt;
			&lt;td&gt;
				10.224.78.60&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;
				munin-node&lt;/td&gt;
			&lt;td&gt;
				Micro&lt;/td&gt;
			&lt;td&gt;
				ami-61b28015&lt;/td&gt;
			&lt;td&gt;
				10.234.185.182&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
	&lt;br /&gt;
	Once those are built, you&amp;#39;ll need to SSH into them and then change the hostnames to something more friendly. So connect to the machine you want to install munin-server on...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@ip-10-56-65-94:~# hostname munin-server
root@ip-10-56-65-94:~# nano /etc/hostname&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Delete what exists in here and replace it with &amp;#39;munin-server&amp;#39;&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@ip-10-56-65-94:~# nano /etc/hosts&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Add &amp;#39;munin-server&amp;#39; to the end of the first line so it looks like...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;127.0.0.1 localhost munin-server&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Once your done, reconnect your SSH session and your terminal should change to be...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-server:~#&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Go ahead and then do the same thing for your node machine, and call it &amp;#39;munin-node&amp;#39;&lt;/p&gt;
&lt;p&gt;
	We&amp;#39;ll first update the apt database to make sure its got the latest information, then we&amp;#39;ll install the munin server package. Not only does this give the server the ability to draw graphs for all nodes connected, but also so it can draw graphs for itself.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-server:~# apt-get update
root@munin-server:~# apt-get install munin&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	It&amp;#39;ll install a lot of packages so it may take a while. Once it&amp;#39;s done installing you&amp;#39;ll be back on the console again and we&amp;#39;ll now start munin-node running...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-server:~# start munin-node
munin-node start/running, process 24963&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	munin-server doesn&amp;#39;t have a process that runs on the machine, instead every 5minutes through cron it will draw the graphs it needs to. Once it&amp;#39;s drawn those graphs they can be found (by default), in /var/cache/munin/www. So we&amp;#39;ll need a way to display that to users. For the examples sake i&amp;#39;m going to use nginx on the default IP and port. You&amp;#39;ll probably want to use a hostname instead.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-server:~# apt-get install nginx
root@munin-server:~# nano /etc/nginx/sites-available/default&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Edit the following line in the file...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root /usr/share/nginx/www;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	So it reads...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root /var/cache/munin/www;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Then save the file and...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-server:~# /etc/init.d/nginx start
Starting nginx: nginx.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	If you then visit your machines public IP you should see...&lt;/p&gt;
&lt;p&gt;
	&lt;img alt="" src="http://files.limi.co.uk/blog/munin-http.png" /&gt;&lt;/p&gt;
&lt;p&gt;
	You can click through and see that munin has already started to graph itself, however the names aren&amp;#39;t very useful. So let&amp;#39;s change those...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-server:~# nano /etc/munin/munin.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Scroll down in this file and you&amp;#39;ll eventually see...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;[localhost.localdomain]
    address 127.0.0.1
    use_node_name yes&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	So let&amp;#39;s change this so something more obvious, say we have a project called &amp;#39;Lightning&amp;#39;, we&amp;#39;d probably do something like this...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;[lightning;munin-server]
    address 127.0.0.1
    use_node_name yes&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Make those changes, then save the file. On the next round 5 minutes it&amp;#39;ll regenerate all the HTML and the graphs. And you&amp;#39;ll see...&lt;/p&gt;
&lt;p&gt;
	&lt;img alt="" src="http://files.limi.co.uk/blog/munin-lightning.png" style="width: 506px; height: 161px;" /&gt;&lt;/p&gt;
&lt;p&gt;
	We now have a munin-server which is producing graphs and monitoring itself. Next step is graphing another machine.&lt;/p&gt;
&lt;p&gt;
	SSH into the munin-node machine, or whichever machine you wish to start graphing...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-node:~# apt-get update
root@munin-node:~# apt-get install munin-node&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Once its finished installing we need to allow our munin-server access to this machines data. By default munin-node won&amp;#39;t allow any IP other than its own to connect and retrieve data. So we&amp;#39;ll need to allow through our munin-server.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-node:~# nano /etc/munin/munin-node.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Scroll down to where you see this...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;allow ^127\.0\.0\.1$&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	And add a line beneath it for your munin-servers public IP address, for me it was...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;allow ^10\.224\.78\.60$&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Save and close that config file and restart munin-node as it started when we installed it...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-node:~# restart munin-node
munin-node start/running, process 26046&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	We now need to go back to our munin-server and tell it to graph this new machine.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;root@munin-server:~# nano /etc/munin/munin.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Scroll down to where we had our lightning block, put this afterwards substituting your machines IP with mine...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;[lightning;munin-node]
    address 10.234.185.182
    use_node_name yes&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Save the file, give it 5minutes to do another drawing cycle and you&amp;#39;ll see this...&lt;/p&gt;
&lt;p&gt;
	&lt;img alt="" src="http://files.limi.co.uk/blog/munin-both-nodes.png" style="width: 506px; height: 177px;" /&gt;&lt;/p&gt;
&lt;p&gt;
	Hooray! All done! :D&lt;/p&gt;
</content>
    <published-at type="datetime">2011-11-10T19:10:00Z</published-at>
    <created-at type="datetime">2011-11-10T22:14:50Z</created-at>
    <updated-at type="datetime">2011-11-10T23:07:56Z</updated-at>
  </post>
  <post>
    <id type="integer">55</id>
    <title>League of Legends (LoLBase) Automatic Log Uploader</title>
    <slug>league-of-legends-lolbase-automatic-log-uploader</slug>
    <image>jax2.png</image>
    <preview>&lt;p&gt;
	I have an unhealthy obsession with statistics, graphs and the like. One of the games I like to play, League of Legends, has a community run statistics site called LoLBase, but they are highly dependant on people sending in their game logs to generate the data.&lt;/p&gt;
</preview>
    <content>&lt;p&gt;
	They currently have a Windows based client to upload the files whenever the user asks it to, however I felt that this step was not really necessary. I hunted around to see if someone else had automated the process but&amp;nbsp;unfortunately&amp;nbsp;not, so I set about doing it myself. A couple of days later and Jax Uploader was finished!&lt;/p&gt;
&lt;p&gt;
	Built in C#, it will watch for you to close LoL before attempting to upload the log files (since they are written to the disk in exclusive mode until then). It&amp;#39;s very simple and does exactly what it says on the tin. It&amp;#39;s overall quite a nice small project as its needs a few key features such as process scanning and holding, registry reading/writing and storing user settings correctly. Very good for getting me back into C# at least.&lt;/p&gt;
&lt;p&gt;
	It&amp;#39;s missing auto updating (or even knowing that it could be updated) right now, but that&amp;#39;s something i&amp;#39;m going to be working on soon. Until then you can download it here...&lt;/p&gt;
&lt;p&gt;
	&lt;a _mce_href="http://riotstats.com/client" href="http://riotstats.com/client"&gt;Jax Uploader&lt;/a&gt; (v1.0.0.6)&lt;/p&gt;
&lt;p&gt;
	It requires the .NET framework version 4, so make sure you&amp;#39;ve got that before trying to run it (otherwise it&amp;#39;ll probably explode in your face and you&amp;#39;ll feel very stupid indeed!)&lt;/p&gt;
</content>
    <published-at type="datetime">2011-01-07T19:10:00Z</published-at>
    <created-at type="datetime">2011-11-06T02:11:41Z</created-at>
    <updated-at type="datetime">2011-11-08T22:34:44Z</updated-at>
  </post>
  <post>
    <id type="integer">1</id>
    <title>Using RRDTool data files from a different architecture</title>
    <slug>using-rrdtool-data-files-from-a-different-architecture</slug>
    <image>rrdtool.png</image>
    <preview>&lt;p&gt;
	RRD data files aren&amp;#39;t compatible across different architectures, this post will explain how you can convert them so you can utilise them on a different system.&lt;/p&gt;
</preview>
    <content>&lt;p&gt;
	Recently I got the RRDTool addiction again and decided to start graphing pretty much anything I could think of. I have been generating some data sets on my server for this and needed to try out some new generation options but had no data on the local machine... &amp;quot;i&amp;#39;ll just download the rrd files from the server then!&amp;quot;, if only it was as easy as that! If your server is one architecture and your local machine another you&amp;#39;ll need to convert the files before RRDTool will go near them, and the following is how you do it. I had quite a few rrd files I wanted to use, so this is a batch method to get them all done in one go.&lt;/p&gt;
&lt;p&gt;
	First on the server run this command in the folder containing your rrd files...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;for i in `find -name &amp;quot;*.rrd&amp;quot;`; do rrdtool dump $i &amp;gt; $i.xml; done &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Then download all the XML files locally, then run this command to rebuild them...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;for i in `find -name &amp;quot;*.xml&amp;quot;`; do rrdtool restore $i `echo $i |sed s/.xml//g`; done&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	With that, all done!&lt;/p&gt;
</content>
    <published-at type="datetime">2010-11-23T09:00:00Z</published-at>
    <created-at type="datetime">2011-10-25T22:54:47Z</created-at>
    <updated-at type="datetime">2011-11-08T22:38:38Z</updated-at>
  </post>
  <post>
    <id type="integer">2</id>
    <title>Installing MongoDB on Ubuntu 8.04 LTS (Hardy Heron)</title>
    <slug>installing-mongodb-on-ubuntu-8-04-lts-hardy-heron</slug>
    <image>mongo-db-huge-logo.png</image>
    <preview>&lt;p&gt;
	The MongoDB package maintainers don&amp;#39;t provide dedicated aptitute packages for older Ubuntu releases, i&amp;#39;ll show you how you can install MongoDB through packages on these unsupported versions.&lt;/p&gt;
</preview>
    <content>&lt;p&gt;
	Today I needed to install MongoDB on one of my servers, however it still runs on 8.04 LTS, and MongoDB don&amp;#39;t provide a dedicated apt package for that release. However you can safely use the 9.04 Jaunty source lines. It will at least save you compiling from source and maintaining it yourself.&lt;/p&gt;
&lt;p&gt;
	Edit your sources.list...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;sudo nano&amp;nbsp;/etc/apt/sources.list&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Add this to the bottom...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;deb http://downloads.mongodb.org/distros/ubuntu 9.4 10gen&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Then run these commands...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo apt-get update&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Finally install MongoDB...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;sudo apt-get install mongodb-stable&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Job done!&lt;/p&gt;
</content>
    <published-at type="datetime">2010-10-19T09:00:00Z</published-at>
    <created-at type="datetime">2011-10-25T22:57:51Z</created-at>
    <updated-at type="datetime">2011-11-08T22:40:03Z</updated-at>
  </post>
  <post>
    <id type="integer">3</id>
    <title>mySQL gem on clean Ubuntu installation</title>
    <slug>mysql-gem-on-clean-ubuntu-installation</slug>
    <image>20091016_textmate_twilight.jpg</image>
    <preview>&lt;p&gt;
	Another very quick post showing you how to fix the most common error you get when installing the mySQL gem on a clean Ubuntu installation.&lt;/p&gt;
</preview>
    <content>&lt;p&gt;
	As I always seem to forget the package name required to install the mySQL gem and get this error...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;ERROR: While executing gem ... (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	The fix is as simple as...&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;sudo apt-get install libmysqlclient-dev&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
	Problem solved.&lt;/p&gt;
</content>
    <published-at type="datetime">2010-09-06T09:00:00Z</published-at>
    <created-at type="datetime">2011-10-26T22:58:27Z</created-at>
    <updated-at type="datetime">2011-11-08T22:40:39Z</updated-at>
  </post>
</posts>

