<?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>Patrick Mylund &#187; Linux</title>
	<atom:link href="http://patrickmylund.com/blog/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://patrickmylund.com</link>
	<description></description>
	<lastBuildDate>Sun, 28 Feb 2010 18:35:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Keep Alive SSH Sessions</title>
		<link>http://patrickmylund.com/blog/how-to-keep-alive-ssh-sessions/</link>
		<comments>http://patrickmylund.com/blog/how-to-keep-alive-ssh-sessions/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 14:38:52 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[PuTTY]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1375</guid>
		<description><![CDATA[Many NAT firewalls time out idle sessions after a certain period of time to keep their trunks clean. Sometimes the interval between session drops is 24 hours, but on many commodity firewalls, connections are killed after as little as 300 seconds. To avoid having your SSH sessions become unresponsive after e.g. 5 minutes, do the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Many NAT firewalls time out idle sessions after a certain period of time to keep their trunks clean. Sometimes the interval between session drops is 24 hours, but on many commodity firewalls, connections are killed after as little as 300 seconds. To avoid having your SSH sessions become unresponsive after e.g. 5 minutes, do the following:</p>
<h2>On Windows (PuTTY)</h2>
<p><img src="http://patrickmylund.com/blog/content/2010/02/putty.png" alt="" title="PuTTY icon" width="64" height="64" class="alignright size-full wp-image-1376" />In your session properties, go to <strong>Connection</strong> and under <strong>Sending of null packets to keep session active</strong>, set <strong>Seconds between keepalives (0 to turn off)</strong> to e.g. <strong>300</strong> (5 minutes).</p>
<h2>On Linux (ssh)</h2>
<p><img src="http://patrickmylund.com/blog/content/2010/02/konsole.png" alt="" title="Konsole icon" width="64" height="64" class="alignright size-full wp-image-1377" />To enable the keep alive system-wide (root access required), edit <code>/etc/ssh/ssh_config</code>; to set the settings for just your user, edit <code>~/.ssh/config</code> (create the file if it doesn&#8217;t exist). Insert the following:</p>
<pre>
Host *
    ServerAliveInterval 300
    ServerAliveCountMax 2
</pre>
<p>You can also make your OpenSSH server keep alive all connections with clients by adding the following to <code>/etc/ssh/sshd_config</code>:</p>
<pre>
ServerAliveInterval 300
ServerAliveCountMax 2
</pre>
<p>These settings will make the SSH client or server send a null packet to the other side every <strong>300 seconds</strong> (5 minutes), and give up if it doesn&#8217;t receive any response after <strong>2 tries</strong>, at which point the connection is likely to have been discarded anyway.</p>
<p>From the <code>ssh_config</code> man page:</p>
<blockquote><p>
<strong>ServerAliveCountMax</strong><br />
Sets the number of server alive messages (see below) which may be sent without ssh(1) receiving any messages back from the server. If this threshold is reached while server alive messages are being sent, ssh will disconnect from the server, terminating the session. It is important to note that the use of server alive messages is very different from TCPKeepAlive (below). The server alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The server alive mechanism is valuable when the client or server depend on knowing when a connection has become inactive.</p>
<p>The default value is 3. If, for example, ServerAliveInterval (see below) is set to 15 and ServerAliveCountMax is left at the default, if the server becomes unresponsive, ssh will disconnect after approximately 45 seconds. This option applies to protocol version 2 only; in protocol version 1 there is no mechanism to request a response from the server to the server alive messages, so disconnection is the responsibility of the TCP stack.</p>
<p><strong>ServerAliveInterval</strong><br />
Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server, or 300 if the BatchMode option is set. This option applies to protocol version 2 only. ProtocolKeepAlives and SetupTimeOut are Debian-specific compatibility aliases for this option.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/how-to-keep-alive-ssh-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lowering Gaming Mouse Sensitivity in Ubuntu 9.10</title>
		<link>http://patrickmylund.com/blog/lowering-gaming-mouse-sensitivity-in-ubuntu-9-10/</link>
		<comments>http://patrickmylund.com/blog/lowering-gaming-mouse-sensitivity-in-ubuntu-9-10/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 22:54:18 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[HAL]]></category>
		<category><![CDATA[Razer]]></category>
		<category><![CDATA[Razer Deathadder]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[X.Org]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1372</guid>
		<description><![CDATA[I have a Razer Deathadder. It&#8217;s a nice mouse. In Ubuntu, though, its polling rates are through the roof and the mouse is pretty much unusable, even with GNOME&#8217;s mouse sensitivity and acceleration settings at their lowest. Previously, this could be fixed by tweaking the mouse section of your X.Org configuration file, /etc/X11/xorg.conf, but in [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img src="http://patrickmylund.com/blog/content/2010/02/razer_deathadder-200x191.jpg" alt="" title="Razer Deathadder" width="200" height="191" class="alignright size-medium wp-image-1373" />I have a Razer Deathadder. It&#8217;s a nice mouse. In Ubuntu, though, its polling rates are through the roof and the mouse is pretty much unusable, even with GNOME&#8217;s mouse sensitivity and acceleration settings at their lowest. Previously, this could be fixed by tweaking the mouse section of your X.Org configuration file, <code>/etc/X11/xorg.conf</code>, but in recent versions, a different measure is needed, as most devices are managed via <abbr title="Hardware Abstraction Layer">HAL</abbr>. Here&#8217;s how I regained my sanity and mouse slowness. The fix should work for any high-end mouse.</p>
<ol>
<li>Open a terminal</li>
<li>Run the command: <code>hal-device</code></li>
<li>In the output, locate the mouse&#8217;s hex format vendor and product ID&#8217;s as highlighted below:
<pre>82: udi = '/org/freedesktop/Hal/devices/usb_device_1532_7_noserial_if0'
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'usb'  (string)
  info.linux.driver = 'usbhid'  (string)
  info.subsystem = 'usb'  (string)
  info.product = 'USB HID Interface'  (string)
  info.udi = '/org/freedesktop/Hal/devices/usb_device_1532_7_noserial_if0'  (string)
  usb.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.0'  (string)
  usb.configuration_value = 1  (0x1)  (int)
  usb.num_configurations = 1  (0x1)  (int)
  usb.num_interfaces = 1  (0x1)  (int)
  usb.device_class = 0  (0x0)  (int)
  usb.device_subclass = 0  (0x0)  (int)
  usb.device_protocol = 0  (0x0)  (int)
  usb.product_id = 7  (<strong>0x7</strong>)  (int)
  usb.vendor_id = 5426  (<strong>0x1532</strong>)  (int)
  usb.product = 'USB HID Interface'  (string)
  usb.vendor = 'Razer USA, Ltd'  (string)
  usb.num_ports = 0  (0x0)  (int)
  usb.max_power = 100  (0x64)  (int)
  usb.device_revision_bcd = 256  (0x100)  (int)
  usb.is_self_powered = false  (bool)
  usb.can_wake_up = true  (bool)
  usb.bus_number = 8  (0x8)  (int)
  usb.speed = 12  (double)
  usb.version = 2  (double)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.0'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_1532_7_noserial'  (string)
  usb.interface.number = 0  (0x0)  (int)
  usb.linux.device_number = 3  (0x3)  (int)
  usb.interface.subclass = 1  (0x1)  (int)
  usb.interface.class = 3  (0x3)  (int)
  usb.interface.protocol = 2  (0x2)  (int)</pre>
<p>In this case, my Product ID is <strong>0&#215;7</strong> and my Vendor ID is <strong>0&#215;1532</strong>. Note that there can be more than one section containing the name of your mouse or its manufacturer &#8212; if you can&#8217;t find the product and vendor ID, look further down.</li>
<li>Edit the HAL policy file for input devices: <code>sudo nano -w /etc/hal/fdi/policy/10-x11-input.fdi</code></li>
<li>Insert the following text:</li>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deviceinfo</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;0.2&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;device<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;match</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;@input.originating_device:usb.vendor_id&quot;</span> <span style="color: #000066;">int</span>=<span style="color: #ff0000;">&quot;0x1532&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;match</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;@input.originating_device:usb.product_id&quot;</span> <span style="color: #000066;">int</span>=<span style="color: #ff0000;">&quot;0x7&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;merge</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;input.x11_options.ConstantDeceleration&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;string&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/merge<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/match<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/device<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deviceinfo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Adjust your vendor_id and product_id to match what you noted down before. If the file is empty or doesn&#8217;t exist, don&#8217;t worry. If it already exists, omit the first line about xml.</li>
<li>Hit <strong>Ctrl + X</strong>, then <strong>Y</strong> to save the file and exit <code>nano</code></li>
<li>Restart hald: <code>sudo service hald restart</code></li>
<li>Restart X.Org (log out or reboot your computer)</li>
</ol>
<p>That&#8217;s it! The &#8220;ConstantDeceleration&#8221; setting in <code>/etc/hal/fdi/policy/10-x11-input.fdi</code> is what does the trick. When set to a value of <strong>5</strong>, the sensitivity will essentially be divided by 5. Oh, sweet sanity.</p>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/lowering-gaming-mouse-sensitivity-in-ubuntu-9-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Set Up Simple SSH Tunneling</title>
		<link>http://patrickmylund.com/blog/how-to-set-up-simple-ssh-tunneling/</link>
		<comments>http://patrickmylund.com/blog/how-to-set-up-simple-ssh-tunneling/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 22:50:54 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[PuTTY]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[SSH tunneling]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1362</guid>
		<description><![CDATA[By far the easiest way to set up a simple connection proxy is to use the SSH tunneling feature of either PuTTY on Windows or SSH on Linux. This lets you establish connections to servers and ports that you might not be able to access (e.g. from work), as long as you can connect to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img src="http://patrickmylund.com/blog/content/2010/01/openssh_logo.png" alt="" title="OpenSSH logo" width="194" height="191" class="alignright size-full wp-image-1363" />By far the easiest way to set up a simple connection proxy is to use the SSH tunneling feature of either PuTTY on Windows or SSH on Linux. This lets you establish connections to servers and ports that you might not be able to access (e.g. from work), as long as you can connect to your server&#8217;s SSH service (e.g. myserver.com port 22). This might be for privacy reasons, to connect to MSN from work, to browse a blocked website, et cetera.</p>
<h2>On Windows Machines</h2>
<ol>
<li>Download and open <a href="http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe" title="PuTTY" rel="nofollow">PuTTY</a></li>
<li>In the fields &#8216;Address&#8217; and &#8216;Port&#8217;, enter the address and port for your SSH server</li>
<li>Go to &#8216;Connection&#8217; -> &#8216;SSH&#8217; -> &#8216;Tunnels&#8217; on the left-hand side</li>
<li>In &#8216;Source port&#8217;, enter 31337, then click the button &#8216;Dynamic&#8217; and then &#8216;Add&#8217;</li>
<li>Go back to the main &#8216;Session&#8217; screen</li>
<li>In the &#8216;Saved Sessions&#8217; text box, enter e.g. &#8220;My Shell&#8221; and click &#8216;Save&#8217;</li>
<li>Double-click &#8220;My Shell&#8221; to establish a connection, then log in to your shell</li>
<li>In any application that supports connecting through a proxy, set the following settings:
<ul>
<li>Proxy Type: <strong>SOCKS 5</strong></li>
<li>Proxy Server: <strong>127.0.0.1</strong></li>
<li>Proxy Port: <strong>31337</strong></li>
</ul>
</li>
</ol>
<p>You can also set these as your global proxy settings in Windows (via &#8216;Control Panel&#8217; -> &#8216;Internet Properties&#8217; -> &#8216;Connections&#8217; -> &#8216;LAN settings&#8217; -> &#8220;Use a proxy server for your LAN&#8221; -> &#8216;Advanced&#8217; -> &#8216;Socks&#8217;: 127.0.0.1:31337. This will cause most applications to connect through the SSH tunnel to your server.</p>
<p>In the future, just open PuTTY and double-click &#8220;My Shell&#8221; to open your shell and activate the SSH tunneling.</p>
<h2>On Linux Machines</h2>
<ol>
<li>Open a terminal</li>
<li>Enter e.g.: <code>ssh -D31337 myuser@myserver.com -N</code></li>
<li>Log in to your shell</li>
<li>In any application that supports connecting through a proxy, set the following settings:
<ul>
<li>Proxy Type: <strong>SOCKS 5</strong></li>
<li>Proxy Server: <strong>127.0.0.1</strong></li>
<li>Proxy Port: <strong>31337</strong></li>
</ul>
</li>
</ol>
<p>Alternatively, enter e.g.: <code>ssh -L 31337:patrickmylund.com:80 myuser@myserver.com -N</code>. Here, you specify the target host and port before-hand; the result is that all connections to <strong>127.0.0.1</strong> port <strong>31337</strong> will be tunneled through your server, <strong>myserver.com</strong>, using your username, <strong>myuser</strong>, to the target machine, <strong>patrickmylund.com</strong>, port <strong>80</strong>.</p>
<p>The SSH tunnel will stay active until you close the terminal window or hit CTRL+C (Linux), or close PuTTY (Windows).</p>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/how-to-set-up-simple-ssh-tunneling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chromium OS is Out, and it is Based on Ubuntu Linux</title>
		<link>http://patrickmylund.com/blog/chrome-os-is-based-on-ubuntu-linux/</link>
		<comments>http://patrickmylund.com/blog/chrome-os-is-based-on-ubuntu-linux/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 18:31:38 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1315</guid>
		<description><![CDATA[A branch called chromiumos was just added to the official Chromium git repository, and the contents of the index files there indicate that Chromium OS, and in effect Google Chrome OS, is based on Ubuntu Linux. From chromiumos.git/src/package_repo/repo_list_image.txt:

  71 fontconfig 2.6.0-1ubuntu12 optional utils pool/main/f/fontconfig/fontconfig_2.6.0-1ubuntu12_i386.deb
  72 fontconfig-config 2.6.0-1ubuntu12 optional libs pool/main/f/fontconfig/fontconfig-config_2.6.0-1ubuntu12_all.deb
  73 gcc-4.4-base [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>A branch called <a href="http://src.chromium.org/cgi-bin/gitweb.cgi?p=chromiumos.git;a=summary" title="chromiumos.git" rel="nofollow">chromiumos</a> was just added to the official Chromium git repository, and the contents of the index files there indicate that Chromium OS, and in effect Google Chrome OS, is based on Ubuntu Linux. From <a href="http://src.chromium.org/cgi-bin/gitweb.cgi?p=chromiumos.git;a=blob;f=src/package_repo/repo_list_image.txt;h=a390aa1f81d8e6ce411fa1489d490618a01752ce;hb=HEAD" rel="nofollow" title="chromiumos.git/src/package_repo/repo_list_image.txt">chromiumos.git/src/package_repo/repo_list_image.txt</a>:</p>
<pre>
  71 fontconfig 2.6.0-1<strong>ubuntu</strong>12 optional utils pool/main/f/fontconfig/fontconfig_2.6.0-1<strong>ubuntu</strong>12_i386.deb
  72 fontconfig-config 2.6.0-1<strong>ubuntu</strong>12 optional libs pool/main/f/fontconfig/fontconfig-config_2.6.0-1<strong>ubuntu</strong>12_all.deb
  73 gcc-4.4-base 4.4.1-1<strong>ubuntu</strong>3 required libs pool/main/g/gcc-4.4/gcc-4.4-base_4.4.1-1<strong>ubuntu</strong>3_i386.deb
</pre>
<p>Here are some videos from the <a href="http://www.chromium.org/chromium-os" title="Chromium OS website" rel="nofollow">Chromium OS website</a> that just went live:</p>
<h2>What is Google Chrome OS?</h2>
<p><object width="700" height="419"><param name="movie" value="http://www.youtube.com/v/0QRO3gKj3qw&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/0QRO3gKj3qw&#038;fs=1" type="application/x-shockwave-flash" width="700" height="419" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>Chromium OS Security</h2>
<p><object width="700" height="419"><param name="movie" value="http://www.youtube.com/v/A9WVmNfgjtQ&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/A9WVmNfgjtQ&#038;fs=1" type="application/x-shockwave-flash" width="700" height="419" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>Chromium OS &#038; Open Source</h2>
<p><object width="700" height="419"><param name="movie" value="http://www.youtube.com/v/KA5RQv9mBoY&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/KA5RQv9mBoY&#038;fs=1" type="application/x-shockwave-flash" width="700" height="419" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h2>Chromium Fast Boot</h2>
<p><object width="700" height="419"><param name="movie" value="http://www.youtube.com/v/mTFfl7AjNfI&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mTFfl7AjNfI&#038;fs=1" type="application/x-shockwave-flash" width="700" height="419" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>There&#8217;s a live transcript of the Google Chrome OS event speech by Google VP of Product Management, Sundar Pichai, <a href="http://www.techcrunch.com/2009/11/19/chrome-os-event/" title="Live From Google’s Chrome OS Event" rel="nofollow">over at TechCrunch</a>. They have also just posted <a href="http://www.techcrunch.com/2009/11/19/video-google-chrome-oss-interface-7-second-boot-time-and-more/" title="Video: Google Chrome OS’s Interface, 7 Second Boot Time, And More" rel="nofollow">a video demo of Google Chrome OS</a> recorded at the announcement event in Mountain View, showing off the interface, bootup times, and more.</p>
<p><strong>Update</strong>: Ars Technica has just published <a href="http://arstechnica.com/open-source/news/2009/11/chromeos-announcement.ars" title="Chrome OS: Internet Failing At PC &gt; PC Failing At Internet" rel="nofollow">an excellent analysis of Chrome OS</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/chrome-os-is-based-on-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google to Release Chrome OS Within a Week</title>
		<link>http://patrickmylund.com/blog/google-to-release-chrome-os-within-a-week/</link>
		<comments>http://patrickmylund.com/blog/google-to-release-chrome-os-within-a-week/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 12:01:07 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1298</guid>
		<description><![CDATA[Google is apparently releasing their highly anticipated, lightweight, Linux-based operating system targeted at netbooks, Google Chrome OS, within a week, according to TechCrunch. TechCrunch also thinks we should expect shoddy driver support, which seems like a strange conclusion considering the maturity of the Linux kernel.
There&#8217;s really not that much information about the operating system, though [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img src="http://patrickmylund.com/blog/content/2009/11/chrome_logo.png" alt="Google Chrome Logo" title="Google Chrome Logo" width="196" height="187" class="alignright size-full wp-image-1299" />Google is apparently releasing their highly anticipated, lightweight, Linux-based operating system targeted at netbooks, Google Chrome OS, within a week, according to <a href="http://www.techcrunch.com/2009/11/13/google-chrome-os-to-launch-within-a-week/" title="TechCrunch: Google Chrome OS To Launch Within A Week" rel="nofollow">TechCrunch</a>. TechCrunch also thinks we should expect shoddy driver support, which seems like a strange conclusion considering the maturity of the Linux kernel.</p>
<p>There&#8217;s really not that much information about the operating system, though it is safe to assume that there will be a strong emphasis on the Chrome browser and all of Google&#8217;s web-based services and applications.</p>
<p>Let&#8217;s wait and see.</p>
<p><strong>Update</strong>: It <a href="http://www.techcrunch.com/2009/11/17/google-chrome-os-launch/" title="Google Holding Chrome OS Event Thursday. Complete Overview And Launch Plans To Be Revealed." rel="nofollow">seems</a> that Google is planning a special Chrome OS event for Thursday, the 19th of November, which will include a demonstration and &#8220;complete overview&#8221; of Google Chrome OS. The product apparently won&#8217;t be released until (early) next year, but the wording &#8220;complete overview&#8221; gives me the impression that they are just polishing and testing now.</p>
<p><strong>Update 2</strong>: <a href="http://patrickmylund.com/blog/chrome-os-is-based-on-ubuntu-linux/" title="Chromium OS is Out, and It is Based on Ubuntu Linux">Chromium OS is Out, and It is Based on Ubuntu Linux</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/google-to-release-chrome-os-within-a-week/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Start Guide to Infrastructure Monitoring with Nagios</title>
		<link>http://patrickmylund.com/blog/quick-it-infrastructure-monitoring-with-nagios/</link>
		<comments>http://patrickmylund.com/blog/quick-it-infrastructure-monitoring-with-nagios/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 15:16:29 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[infrastructure monitoring]]></category>
		<category><![CDATA[Nagios]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1202</guid>
		<description><![CDATA[Staying ahead of IT service issues can be frustrating when you manage several servers, or even a single server with many services. Enterprise IT Infrastructure Monitoring Solutions (a fancy term for something that is really pretty simple) attempt to remedy the problem by repeatedly checking the status of machines and services on the network and [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Staying ahead of IT service issues can be frustrating when you manage several servers, or even a single server with many services. Enterprise IT Infrastructure Monitoring Solutions (a fancy term for something that is really pretty simple) attempt to remedy the problem by repeatedly checking the status of machines and services on the network and alerting the responsible administrators as soon as something goes wrong, or even before there&#8217;s a problem.</p>
<p>It&#8217;s hard to argue against implementing a monitoring solution within the network, as it is much a setup-and-forget matter that adds negligible load. The monitoring solution itself is &#8212; or at least, should be &#8212; very low maintenance, yet provides very valuable insight into the health of the network.</p>
<h2>Introducing Nagios</h2>
<p><a href="http://nagios.org/" title="Nagios website"><img src="http://patrickmylund.com/blog/content/2009/08/nagios_logo.jpg" alt="Nagios Logo" title="Nagios Logo" width="150" height="37" class="alignright size-full wp-image-1206" /></a><a href="http://nagios.org/" title="Nagios website">Nagios</a> is an infrastructure monitoring solution that is both popular and open source. Apart from its obvious monitoring capabilities, it includes the ability to associate an event handler to an event, allowing you to fix a problem automatically. If &#8212; for example &#8212; one of your Python applications crashes, you can have Nagios do <code>python /opt/myapp/myapp.py</code> automatically, before any human administrators have the time to do so. Other features include the ability to create many kinds of reports, and to send notifications and alerts via email and SMS.</p>
<div id="attachment_1203" class="wp-caption aligncenter" style="width: 685px">
	<img src="http://patrickmylund.com/blog/content/2009/08/nagios_screenshot.png" alt="Nagios' web interface screenshot" title="Nagios' web interface" width="685" height="330" class="size-full wp-image-1203" />
	<p class="wp-caption-text">Nagios' web interface</p>
</div>
<p>Nagios is based primarily on C and shell scripts, which makes it light on performance but adds a slightly &#8216;hackish&#8217; feel. It comes with a CGI-based web interface (which we&#8217;ll spice up a bit) that lets you view and manage Nagios, through what are known as External Commands.</p>
<p>I&#8217;d like to demonstrate how to set up rudimentary Nagios monitoring on a small farm of Linux servers, with an Ubuntu/Debian server running the primary Nagios process. In the end, we&#8217;ll be monitoring the states of various services on the servers, including the ones seen in the screenshot above (Apache processes, APT, Current Load, Current Users, Disk Space, Dovecot, FTP, HTTP, MySQL, SMTP, SSH, Swap, Total Processes, and Zombie Processes).  We will also receive notifications by email whenever something goes wrong:</p>
<p><img src="http://patrickmylund.com/blog/content/2009/08/nagios_email_notification.png" alt="Nagios Email Notification" title="Nagios Email Notification" width="609" height="448" class="aligncenter size-full wp-image-1204" /></p>
<p>Please note that this guide is meant to get you up and running quickly, and that it&#8217;s <em>not</em> a substitute for the official <a href="http://www.nagios.org/documentation" title="Nagios documentation">Nagios documentation</a>. If you want to know what all of the different configuration options do (or <em>can</em> do), please consult the (excellent) documentation.</p>
<h2>Setting Up The Nagios Server</h2>
<p>The steps in this section should just be done on the main Nagios server, <em>not</em> the clients it will be monitoring. We&#8217;ll get to those later!</p>
<p>This procedure should be quite similar on other distributions if you use their package managers (<code>yum</code>, <code>yast</code>, <code>urpmi</code>, etc.) or <a href="http://nagios.sourceforge.net/docs/2_0/installing.html" title="Installing Nagios"> install Nagios from source</a>, but <em>no guarantees</em>.</p>
<ol>
<li>Let&#8217;s become root so we don&#8217;t have to prepend <code>sudo</code> to everything:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-s</span></pre></div></div>

</li>
<li>If you want to make use of Nagios&#8217; web interface and Apache isn&#8217;t already installed:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> apache2</pre></div></div>

<p><small>It&#8217;s entirely possible to use something like <a href="http://nginx.net/" title="Nginx">nginx</a> or <a href="http://www.lighttpd.net/" title="Lighty">lighttpd</a> to serve the interface, but that is not covered in this guide.</small></li>
<li>Install Nagios from the package repositories:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> nagios3 nagios-nrpe-plugin</pre></div></div>

</li>
<p>Nagios should be accessible at http://nameofnagiosserver/nagios3 already! We still have some configuration to do, though.</p>
<li>Stop Nagios:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nagios3 stop</pre></div></div>

</li>
<li>Add a new user for the web interface, e.g. <em>patrick</em>. The default configuration grants all security permissions to the user <em>nagiosadmin</em>, but we&#8217;ll change that to the name of the new user, too:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';">htpasswd <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>htpasswd.users patrick
<span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/nagiosadmin/patrick/g&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>cgi.cfg</pre></div></div>

</li>
<p><small>The <code>perl</code> command above replaces all occurrences of <em>nagiosadmin</em> with <em>patrick</em> in the file <code>/etc/nagios3/cgi.cfg</code>.</p>
<p>The users listed in <code>/etc/nagios3/cgi.cfg</code> are effectively <em>global administrators</em>. For regular users, you can still add them as users with <code>htpasswd</code>, but assign privileges by making them <em>Contacts</em> for certain hosts or hostgroups, instead. We&#8217;ll get to this later!</small></p>
<li>If you want to add more user accounts for the web interface:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';">htpasswd <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>htpasswd.users john</pre></div></div>

</li>
<li>And if you want to give them superuser privileges:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/patrick/patrick, john/g&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>cgi.cfg</pre></div></div>

<p><small>Go through <code>/etc/nagios3/cgi.cfg</code> manually to see what the different security options do, and to grant more fine-grained privileges to other administrators.</small></li>
<li>Edit <code>/etc/nagios3/nagios.cfg</code> and change <code>check_external_commands=0</code> to <code>1</code> to allow monitoring commands to be issued through the web interface</li>
<li>On Debian/Ubuntu, run the following commands after setting <code>check_external_commands=1</code>:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';">dpkg-statoverride <span style="color: #660033;">--update</span> <span style="color: #660033;">--add</span> nagios www-data <span style="color: #000000;">2710</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>rw
dpkg-statoverride <span style="color: #660033;">--update</span> <span style="color: #660033;">--add</span> nagios nagios <span style="color: #000000;">751</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios3</pre></div></div>

</li>
<li>Edit <code>/etc/nagios3/conf.d/contacts_nagios2.cfg</code> to match your preferences. Example:

<div class="wp_syntax"><div class="code"><pre class="nagios" style="font-family:Consolas, Monospace, 'Courier New';">define contact{
        contact_name                    patrick
        alias                           Patrick Mylund
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           my@emailaddress.com
        }</pre></div></div>

<p>And further down:</p>

<div class="wp_syntax"><div class="code"><pre class="nagios" style="font-family:Consolas, Monospace, 'Courier New';">define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 patrick
        }</pre></div></div>

</li>
<li>Make a host definition for a server you want to monitor by creating a matching config file, e.g for the server &#8216;tranquillity&#8217;, <code>nano -w /etc/nagios3/conf.d/tranquillity_nagios2.cfg</code>, then insert a declaration. Example:

<div class="wp_syntax"><div class="code"><pre class="nagios" style="font-family:Consolas, Monospace, 'Courier New';">define host{
        use                     generic-host            ; Name of host template to use
        host_name               tranquillity
        alias                   PatrickMylund.com Web Server
        address                 209.20.82.6
        }</pre></div></div>

<p><small>You can put all of your host definitions in one file if you want, e.g. <code>datacenter1_nagios2.cfg</code> &#8212; just remember the <code>_nagios2.cfg</code> at the end of the file name, which is what tells Nagios to load that file (and in the proper format).</small></li>
<li>Repeat the step above to add a host definition for each server you want to monitor</li>
<li>Move some standard configs to make room for our configured ones:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>localhost_nagios2.cfg <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>localhost_nagios2.cfg.old
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>services_nagios2.cfg <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>services_nagios2.cfg.old
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>patrickmylund.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>misc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1202</span>-nagios_quickstart<span style="color: #000000; font-weight: bold;">/</span>services_nagios2.cfg <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>services_nagios2.cfg</pre></div></div>

</li>
<li>Edit <code>/etc/nagios3/conf.d/hostgroups_nagios2.cfg</code>. List which hosts (comma-separated) should belong to which groups (<code>debian-servers</code>, <code>http-servers</code>, <code>ssh-servers</code>, and <code>ping-servers</code>), and add some extra hostgroups: <code>db-server</code>, <code>ftp-servers</code>, and <code>mail-servers</code>:

<div class="wp_syntax"><div class="code"><pre class="nagios" style="font-family:Consolas, Monospace, 'Courier New';">define hostgroup {
        hostgroup_name  db-servers
                alias           Database servers
                members         tranquillity, singularity
        }
&nbsp;
define hostgroup {
        hostgroup_name  ftp-servers
                alias           FTP servers
                members         tranquillity, singularity
        }
&nbsp;
define hostgroup {
        hostgroup_name  mail-servers
                alias           IMAPS/SMTP servers
                members         tranquillity
        }</pre></div></div>

<p><small>You can see which services are associated with which hostgroups by looking in <code>/etc/nagios3/conf.d/services_nagios2.cfg</code>.</small>
</li>
</ol>
<p>We&#8217;re done with the Nagios server for now. Let&#8217;s look at the settings for the Linux servers we want to monitor.</p>
<h2>Configuring Monitored Clients</h2>
<p>The steps in this section should be done on <em>each</em> Linux host that you want to monitor.</p>
<ol>
<li>Again, let&#8217;s become root:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-s</span></pre></div></div>

</li>
<li>Install Nagios&#8217; NRPE module:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> nagios-nrpe-server</pre></div></div>

<p><small>Installing the NRPE module is optional, but you won&#8217;t be able to run any of Nagios&#8217; scripts directly on the target client if you do not. This is necessary for monitoring system stats, and generally anything that cannot be probed from the outside over the network (by the main Nagios server).</p>
<p>See the <a href="http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf" title="NRPE Documentation">NRPE documentation</a> (PDF) for manual installation instructions, as well as how to get information via SSH (<code>get_by_ssh</code>) instead of NRPE.</small></li>
<li>Stop NRPE:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nagios-nrpe-server stop</pre></div></div>

</li>
<li>Install a custom <a href="http://patrickmylund.com/files/misc/1202-nagios_quickstart/nrpe_local.cfg" title="nrpe_local.cfg">nrpe_local.cfg</a> (this will save us some time later):

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>nrpe_local.cfg <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>nrpe_local.cfg.old
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>patrickmylund.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>misc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1202</span>-nagios_quickstart<span style="color: #000000; font-weight: bold;">/</span>nrpe_local.cfg <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>nrpe_local.cfg</pre></div></div>

<p><small>Go through <code>/etc/nagios/nrpe_local.cfg</code> to see the list of commands that Nagios will be able to execute on hosts running NRPE. By default, NRPE will only run the commands defined in this configuration file, and without any arbitrary arguments. I strongly recommend you stick to this for security purposes.</p>
<p>On the main Nagios server, all service commands prefixed with <code>check_nrpe_1arg</code> in <code>/etc/nagios3/services_nagios2.cfg</code> are commands defined in <code>/etc/nagios/nrpe_local.cfg</code> on the monitored clients.</small></li>
<li>Define what hosts are going to be allowed to probe the NRPE module for information (comma-separated). For instance, if the main Nagios server has IP 192.168.1.105:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">perl</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;s/127.0.0.1/192.168.1.105/g&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>nrpe_local.cfg</pre></div></div>

</li>
<li>If you have a firewall (<code>iptables</code>, <code>ufw</code>, etc.), you need to open for connections on port 5666 on the clients (for NRPE). If the main Nagios server has IP 192.168.1.105, you could do <code>ufw allow proto tcp from 192.168.1.105 to any port 5666</code>, or <code>ufw allow 5666/tcp</code> with Ubuntu&#8217;s Uncomplicated Firewall.</li>
<li>Start the NRPE module:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nagios-nrpe-server start</pre></div></div>

</li>
</ol>
<p>We just about have a basic Nagios setup now!</p>
<h2>Testing Nagios</h2>
<p>Let&#8217;s see if what we&#8217;ve set up is working. On the main Nagios server, start the Nagios service:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nagios3 start</pre></div></div>

<p>If all goes well, navigate to e.g. http://192.168.1.105, login with the user credentials you set up earlier, then click on <em>Service Detail</em> in the menu on the left. All of our services will be PENDING, meaning they&#8217;ll be checked shortly. You can speed this up by clicking on a service and clicking <em>Re-schedule the next check of this service</em> (this is what is called an External Command).</p>
<p>If any of the service states turn out to be CRITICAL or UNKNOWN, don&#8217;t panic &#8212; take a look at the different configuration files in <code>/etc/nagios3/conf.d</code>. The settings and commands are pretty straight-forward. </p>
<p>You can find examples of the resulting configuration files in <a href="http://patrickmylund.com/files/misc/1202-nagios_quickstart/nagios-conf-example.tar.gz" title="Nagios Configuration Example">nagios-conf-example.tar.gz</a>. The configs are for a single server (singularity) with the IP address 192.168.2.3.</p>
<h2>An Extra Touch</h2>
<p>Nagios&#8217; web interface doesn&#8217;t look very pretty. We can spice it up a little by changing the CSS. I&#8217;ve prepared a modified <code>status.css</code> for your convenience:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>stylesheets<span style="color: #000000; font-weight: bold;">/</span>status.css <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>stylesheets<span style="color: #000000; font-weight: bold;">/</span>status.css.old
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>patrickmylund.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>misc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1202</span>-nagios_quickstart<span style="color: #000000; font-weight: bold;">/</span>status.css <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nagios3<span style="color: #000000; font-weight: bold;">/</span>stylesheets<span style="color: #000000; font-weight: bold;">/</span>status.css</pre></div></div>

<p>Now hit F5 in the web interface!</p>
<h2>Bear In Mind</h2>
<ul>
<li>The easiest way to monitor the Nagios server itself is to pretend it&#8217;s yet another server. Install NRPE, set the connection settings, and add it in the host declarations with the other servers.</li>
<li>The exclamation mark (!) is meant to separate command arguments in Nagios configuration files. For instance, <code>check_nrpe_1arg!check_swap</code> would mean you&#8217;re running <code>check_nrpe_1arg</code> with the argument <code>check_swap</code>.</li>
<li>All of the scripts and commands you can issue through Nagios are stand-alone scripts. When configuring Nagios, you can run each command, for instance <code>check_smtp</code>, manually instead of doing tons of trial-and-error with the configuration files:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>check_smtp <span style="color: #660033;">-H</span> 192.168.1.105
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>nagios<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>check_smtp <span style="color: #660033;">-h</span></pre></div></div>

</li>
<li>All lists in Nagios configuration files are <em>comma-separated</em>.
<li>You can set the <code>contact_groups</code> value on any service, host, or hostgroup declaration. Contact groups are defined in <code>/etc/nagios3/conf.d/contacts_nagios2.cfg</code>. Any person in a contact group that has a user account for the web interface (<code>htpasswd.users</code>) can automatically view any hosts and services associated with it.
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="nagios" style="font-family:Consolas, Monospace, 'Courier New';">define hostgroup {
        hostgroup_name  mail-servers
                alias           IMAPS/SMTP servers
                members         singularity
                contact_groups  mailadmins
        }</pre></div></div>

</li>
</ul>
<p>Again, the best part about what we&#8217;ve set up now is that you can go right ahead and forget about it. You&#8217;ll receive an e-mail at the contact address specified whenever something is amiss, as well as when it gets better. If I&#8217;m right, though, you&#8217;ll want to tune your configuration a lot further. We&#8217;ve barely touched the surface; Nagios can do much more, and everything is thoroughly documented in the <a href="http://nagios.sourceforge.net/docs/3_0/toc.html" title="Nagios Core 3.0 documentation">official documentation</a>.</p>
<p>Other useful links:</p>
<ul>
<li><a href="http://support.nagios.com/knowledge-base/faq" title="Nagios FAQ">Official Nagios FAQ</a>
<li><a href="http://wiki.nagios.org/" title="Nagios Wiki">Official Nagios Wiki</a></li>
<li><a href="http://www.monitoringexchange.org/" title="MonitoringExchange">MonitoringExchange Nagios Plugins, Guides, Artwork, and more</a></li>
<li><a href="https://www.nagiosforge.org/gf/" title="NagiosForge">NagiosForge</a></li>
<li><a href="http://www.nagioswiki.org/" title="Nagios Wiki">Another Nagios Wiki</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/quick-it-infrastructure-monitoring-with-nagios/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Linux Script: FilesByWeek</title>
		<link>http://patrickmylund.com/blog/new-linux-script-filesbyweek/</link>
		<comments>http://patrickmylund.com/blog/new-linux-script-filesbyweek/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 21:35:13 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[FilesByWeek]]></category>
		<category><![CDATA[find]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1168</guid>
		<description><![CDATA[FilesByWeek is a small script that counts the number of files in a folder that were created (or last modified) in X week of the year. It&#8217;s designed for use with Linux/Postfix Maildirs (and thus excludes the standard .Sent folder and any Dovecot/Courier IMAP files from the find query), but should work just fine on [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>FilesByWeek is a small script that counts the number of files in a folder that were created (or last modified) in X week of the year. It&#8217;s designed for use with Linux/Postfix Maildirs (and thus excludes the standard .Sent folder and any Dovecot/Courier IMAP files from the <code>find</code> query), but should work just fine on any kind of directory.</p>
<p>Get the latest version <a href="http://patrickmylund.com/projects/filesbyweek/" title="FilesByWeek">here</a>. Or, if you just want to see what the fuzz is about:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:Consolas, Monospace, 'Courier New';"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-i</span> YEAR WEEK COUNT
&nbsp;
<span style="color: #007800;">WEEK</span>=$<span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;"># Comment out the following line if the year starts on a Monday</span>
<span style="color: #007800;">WEEK</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>WEEK-<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #666666; font-style: italic;"># Use current system year by default. This can be changed to e.g.: YEAR=2008</span>
<span style="color: #007800;">YEAR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">TGTDIR</span>=$<span style="color: #000000;">2</span>
<span style="color: #007800;">COUNT</span>=<span style="color: #000000;">0</span>
&nbsp;
\<span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #800000;">${TGTDIR}</span> \
<span style="color: #660033;">-type</span> d \<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.sent&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.Sent&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;courierimapkeywords&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;courierimaphieracl&quot;</span> \<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #660033;">-prune</span> <span style="color: #660033;">-o</span> \
<span style="color: #660033;">-type</span> f \<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;subscriptions&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;courierimapsubscribed&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;dovecot.index.log*&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;dovecot.index&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;maildirfolder&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;dovecot-keywords&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;dovecot.index.cache&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;courierimapacl&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;courierimapuiddb&quot;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;dovecot-uidlist&quot;</span> \<span style="color: #7a0874; font-weight: bold;">&#41;</span> \
<span style="color: #660033;">-print</span> <span style="color: #000000; font-weight: bold;">|</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> FILENAME; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">`</span>\<span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>W <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${FILENAME}</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span> == <span style="color: #800000;">${YEAR}</span>-<span style="color: #800000;">${WEEK}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #666666; font-style: italic;"># Uncomment to show the names of matching files</span>
            <span style="color: #666666; font-style: italic;"># echo ${FILENAME}</span>
            <span style="color: #7a0874; font-weight: bold;">let</span> COUNT++
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">echo</span> Week $<span style="color: #000000;">1</span> <span style="color: #660033;">--</span> <span style="color: #800000;">${TGTDIR}</span>: <span style="color: #800000;">${COUNT}</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/new-linux-script-filesbyweek/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yes, it’s white font on a black screen</title>
		<link>http://patrickmylund.com/blog/yes-its-white-font-on-a-black-screen/</link>
		<comments>http://patrickmylund.com/blog/yes-its-white-font-on-a-black-screen/#comments</comments>
		<pubDate>Sun, 24 May 2009 13:58:37 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Boston College]]></category>
		<category><![CDATA[Electronic Frontier Foundation]]></category>
		<category><![CDATA[Riccardo Calixte]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1158</guid>
		<description><![CDATA[Surprise, the warrant that was issued for a college student&#8217;s stuff on the basis that he was using an operating system with &#8220;white font on a black screen&#8221; has been thrown out, as no probable cause existed.
On May 21, 2009, Justice Botsford of the Supreme Judicial Court of Massachusetts granted our client Riccardo Calixte&#8217;s motion [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Surprise, the warrant that <a href="http://patrickmylund.com/blog/help-its-white-font-on-a-black-screen/" title="Help! It's white font on a black screen">was issued</a> for a college student&#8217;s stuff on the basis that he was using an operating system with &#8220;white font on a black screen&#8221; has been <a href="http://www.eff.org/deeplinks/2009/05/mass-sjc-tosses-calixte-warrant" title="Massachusetts Supreme Judicial Court Tosses Out Warrant in Boston College Case, Says No Probable Cause Existed">thrown out</a>, as no probable cause existed.</p>
<blockquote><p>On May 21, 2009, Justice Botsford of the Supreme Judicial Court of Massachusetts granted our client Riccardo Calixte&#8217;s motion to quash the illegal search warrant with which it seized Calixte&#8217;s computers, phones, ipods, camera and other personal property. Not only is this an enormous victory for Calixte himself, but the ruling is also the highest state court opinion to repudiate the nascent law enforcement &#8220;trend&#8221; of charging internet users who violate websites&#8217; terms of service as criminals. (Case page with background documents here.)</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/yes-its-white-font-on-a-black-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autotest &#8211; Fully automated testing</title>
		<link>http://patrickmylund.com/blog/autotest-fully-automated-testing/</link>
		<comments>http://patrickmylund.com/blog/autotest-fully-automated-testing/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 10:19:08 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1153</guid>
		<description><![CDATA[Interesting automated software test system concept. The goal is to design this for the Linux kernel, but it should be very useful in other regards as well.
]]></description>
			<content:encoded><![CDATA[<p></p><p>Interesting <a href="http://autotest.kernel.org/wiki/WhitePaper" title="Autotest whitepaper">automated software test system concept</a>. The goal is to design this for the Linux kernel, but it should be very useful in other regards as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/autotest-fully-automated-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Help, it&#8217;s white font on a black screen</title>
		<link>http://patrickmylund.com/blog/help-its-white-font-on-a-black-screen/</link>
		<comments>http://patrickmylund.com/blog/help-its-white-font-on-a-black-screen/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 20:36:31 +0000</pubDate>
		<dc:creator>Patrick Mylund</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Boston College]]></category>
		<category><![CDATA[Electronic Frontier Foundation]]></category>
		<category><![CDATA[Riccardo Calixte]]></category>

		<guid isPermaLink="false">http://patrickmylund.com/?p=1151</guid>
		<description><![CDATA[On Friday, EFF and the law firm of Fish and Richardson filed an emergency motion to quash and for the return of seized property on behalf of a Boston College computer science student whose computers, cell phone, and other property were seized as part of an investigation into who sent an e-mail to a school [...]]]></description>
			<content:encoded><![CDATA[<p></p><blockquote><p>On Friday, EFF and the law firm of Fish and Richardson <a href="http://www.eff.org/deeplinks/2009/04/boston-college-prompt-commands-are-suspicious" title="Boston College Prompt Commands Are Suspicious">filed an emergency motion</a> to quash and for the return of seized property on behalf of a Boston College computer science student whose computers, cell phone, and other property were seized as part of an investigation into who sent an e-mail to a school mailing list identifying another student as gay. The problem? Not only is there no indication that any crime was committed, the investigating officer argued that the computer expertise of the student itself supported a finding of probable cause to seize the student&#8217;s property.</p></blockquote>
<blockquote><p>&#8220;[The Person] reported that Mr. Calixte uses two different operating systems to hide his illegal activities. One is the regular B.C. operating system and the other is a black screen with white font which he uses prompt commands on&#8221;. What a nice college.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://patrickmylund.com/blog/help-its-white-font-on-a-black-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
