<?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>Simone Tellini &#187; SysAdmin</title>
	<atom:link href="http://tellini.info/category/11-SysAdmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://tellini.info</link>
	<description>To strive, to seek, to find, and not to yield</description>
	<lastBuildDate>Mon, 06 Feb 2012 10:42:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Keeping script kiddies at bay with mod_evasive and iptables</title>
		<link>http://tellini.info/2011/11/keeping-script-kiddies-at-bay-with-mod_evasive-and-iptables/</link>
		<comments>http://tellini.info/2011/11/keeping-script-kiddies-at-bay-with-mod_evasive-and-iptables/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 17:52:55 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Tips'n'Tricks]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mod_evasive]]></category>
		<guid isPermaLink="false">http://tellini.info/?p=147</guid>
		<description><![CDATA[mod_evasive is a nice Apache module that helps to protect your server against DoS attacks. However, when a client is blocked, it will keep on using resources on your server. Even if the request will result in a 403 error, &#8230; <a href="http://tellini.info/2011/11/keeping-script-kiddies-at-bay-with-mod_evasive-and-iptables/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zdziarski.com/blog/?page_id=442">mod_evasive</a> is a nice Apache module that helps to protect your server against DoS attacks.</p>
<p>However, when a client is blocked, it will keep on using resources on your server. Even if the request will result in a 403 error, it&#8217;s still a connection that needs to be handled. In some cases, it might require spawning a new process for no good reason.</p>
<p>It&#8217;s quite easy to configure mod_evasive so that the evil IPs are blocked via the machine firewall, though:</p>
<div class="codecolorer-container apache default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">IfModule</span> mod_evasive20.c&gt;<br />
<span style="color: #adadad; font-style: italic;"># ...your other settings...</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; DOSSystemCommand <span style="color: #7f007f;">&quot;sudo /root/scripts/ban_ip.sh %s&quot;</span><br />
&lt;/<span style="color: #000000; font-weight:bold;">IfModule</span>&gt;</div></div>
<p>You could put an iptables command there, but I prefer to use a small script because it&#8217;s easier to maintain. Also I don&#8217;t want to block the IP until the end of time <img src='http://tellini.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  So, I use this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<br />
<span style="color: #007800;">IP</span>=<span style="color: #007800;">$1</span><br />
<span style="color: #007800;">IPTABLES</span>=<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables<br />
<br />
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> banned <span style="color: #660033;">-s</span> <span style="color: #007800;">$IP</span> <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-j</span> DROP<br />
<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$IPTABLES</span> -D banned -s <span style="color: #007800;">$IP</span> -p TCP --dport 80 -j DROP&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> at now + <span style="color: #000000;">2</span> hours</div></div>
<p>Don&#8217;t forget to grant the permission to run the script to the account used by apache. My sudoers config contains:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">www-data ALL=(ALL) NOPASSWD: /root/scripts/ban_ip.sh</div></div>
<p>And here&#8217;s the result, on a busy server victim of some abuse:</p>
<p><a href="http://tellini.info/wp-content/uploads/2011/11/mod_evasive.png"><img src="http://tellini.info/wp-content/uploads/2011/11/mod_evasive.png" alt="" title="CPU usage before and after iptables integration" width="380" height="116" class="aligncenter size-full wp-image-148" /></a></p>
<p>Red means &#8220;system time&#8221;, blue is &#8220;user time&#8221;. The green arrow marks the time when I configured it to use iptables.</p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2011/11/keeping-script-kiddies-at-bay-with-mod_evasive-and-iptables/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Serendipity to WordPress</title>
		<link>http://tellini.info/2010/10/serendipity-to-wordpress/</link>
		<comments>http://tellini.info/2010/10/serendipity-to-wordpress/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 18:59:09 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[s9y wordpress migration]]></category>
		<guid isPermaLink="false">http://tellini.info/?p=117</guid>
		<description><![CDATA[I&#8217;ve moved a couple of my blogs from Serendipity to WordPress (mostly because I&#8217;ve discovered that Serendipity has some issues with newer PHP setups, but also because I&#8217;m getting lazy and WordPress&#8217; admin panel is nicer than s9y&#8217;s ). Luckily &#8230; <a href="http://tellini.info/2010/10/serendipity-to-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve moved a couple of my blogs from <a href="http://www.s9y.org/">Serendipity</a> to <a href="http://wordpress.org/">WordPress</a> (mostly because I&#8217;ve discovered that Serendipity has some issues with newer PHP setups, but also because I&#8217;m getting lazy and WordPress&#8217; admin panel is nicer than s9y&#8217;s <img src='http://tellini.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ).</p>
<p>Luckily someone else did already write a <a href="http://snowulf.com/2010/06/11/serendipity-to-wordpress-post-import/">s9y-&gt;WP importer plugin</a>. Sadly it didn&#8217;t support nested categories, so I changed a couple of things and here&#8217;s my <a href="http://files.tellini.info/s9y2wp.zip">Serendipity (S9Y) importer for WordPress 1.5</a> (hoping that noone else has already used that version number&#8230; the history of the plugin contains several authors <img src='http://tellini.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p>One snag: after the import, you&#8217;ll need to edit one of the categories (just open and save it) to fix the hierarchy. I don&#8217;t know why and honestly I don&#8217;t care <img src='http://tellini.info/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  Worked for me, your mileage might vary.</p>
<p>Refer to <a href="http://snowulf.com/2010/06/11/serendipity-to-wordpress-post-import/">this article</a> for other useful migration tips.</p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2010/10/serendipity-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>LogMiner 1.23</title>
		<link>http://tellini.info/2009/06/logminer-1-23/</link>
		<comments>http://tellini.info/2009/06/logminer-1-23/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 08:42:32 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[logminer]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[sysadmin]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=92</guid>
		<description><![CDATA[Version 1.23 of LogMiner, my Apache/IIS log analysis package, is now available. This release mainly fixes some build problem on modern distributions. Also it finally includes the cleanup function I was talking about some days ago&#8230;]]></description>
			<content:encoded><![CDATA[<p>Version 1.23 of <a href="http://logminer.sourceforge.net/"  title="LogMiner at SourceForge">LogMiner</a>, my Apache/IIS log analysis package, is now available.</p>
<p>This release mainly fixes some build problem on modern distributions.</p>
<p>Also it finally includes the <a href="http://tellini.info/blog/archives/48-LogMiner-purging-old-accesses.html">cleanup function</a> I was talking about <em>some</em> days ago&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2009/06/logminer-1-23/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perplexed about Ubuntu&#8217;s sudoers configuration</title>
		<link>http://tellini.info/2009/04/perplexed-about-ubuntus-sudoers-configuration/</link>
		<comments>http://tellini.info/2009/04/perplexed-about-ubuntus-sudoers-configuration/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 11:47:47 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[su]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=85</guid>
		<description><![CDATA[Recently I&#8217;ve been administering my first Ubuntu machine and I already feel a bit perplexed about its security setup. The issue is that by default, the root account password is locked in Ubuntu and you are encouraged never to use &#8230; <a href="http://tellini.info/2009/04/perplexed-about-ubuntus-sudoers-configuration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been administering my first Ubuntu machine and I already feel a bit perplexed about its security setup.</p>
<p>The issue is that by default, the root account password is locked in Ubuntu and you are encouraged never to use root, but rely on sudoers for system administration.</p>
<p>I&#8217;ve read the rationale on <a href="https://help.ubuntu.com/community/RootSudo">Ubuntu&#8217;s wiki</a> and I agree on some points, but their mindset is totally biased towards a desktop setup.</p>
<p>Let&#8217;s consider these points from their site:</p>
<ul>
<li>
<blockquote><em>Benefits of using sudo: Users don&#8217;t have to remember an extra password.</em></p></blockquote>
<p>  This is cool for Average Joe, but don&#8217;t tell me that it&#8217;s an advantage on a serious server: it&#8217;s actually a downside, see the next point.
   </li>
<li>
<blockquote><em>Every cracker trying to brute-force their way into your box will know it has an account named root and will try that first. What they don&#8217;t know is what the usernames of your other users are. Since the root account password is locked, this attack becomes essentially meaningless, since there is no password to crack or guess in the first place.</em></p></blockquote>
<p>       Sure, the attack on root becomes useless, too bad that <a href="http://arstechnica.com/security/news/2008/05/strong-passwords-no-panacea-as-ssh-brute-force-attacks-rise.ars">SSH brute-force attacks</a> usually try <strong>lots</strong> of different usernames. If the manage to break a single account of a sudoer, they automatically have control of your machine. If you had to remember a different password to <a href="http://en.wikipedia.org/wiki/Su_(Unix)">su</a> your way, it would make their life a bit harder.
   </li>
<li>
<blockquote><em>Allows easy transfer for admin rights, in a short term or long term period, by adding and removing users from groups, while not compromising the root account.</em></p></blockquote>
<p>       err&#8230; what does &#8220;not compromising the root account&#8221; actually mean? If I get admin rights, I can do whatever I want, including compromising any account. Unless I get authorisation just to run a limited set of commands through sudo, but that&#8217;s not the point of this post.
   </li>
<li>
<blockquote><em>The root account password does not need to be shared with everybody who needs to perform some type of administrative task(s) on the system.</em></p></blockquote>
<p>      ok, but what problem does it solve? (apart from avoiding people shouting the root password when they shouldn&#8217;t <img src='http://tellini.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
<p>If I want to remove a person from the admin group, I need to trust her not to have planted any malicious program (rootkits, backdoors&#8230;) or rebuild the system if I&#8217;m paranoid, if I really want to be on the safe and paranoid side.</p>
<p>IMHO, it&#8217;s just the same as changing the root password when one is gone, or even better, periodically.
   </li>
</ul>
<p>I&#8217;m not convinced. I still prefer the common su approach typical of almost all the other distributions&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2009/04/perplexed-about-ubuntus-sudoers-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mod_tunnel for Apache 2.2.x</title>
		<link>http://tellini.info/2009/04/mod_tunnel-for-apache-2-2-x/</link>
		<comments>http://tellini.info/2009/04/mod_tunnel-for-apache-2-2-x/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 15:52:07 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tunnel]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=84</guid>
		<description><![CDATA[mod_tunnel is a simple Apache module that can be used to create TCP tunnels using your Web server. It is useful to expose services which can be reached through a proxy, bypassing firewalls. After only 4 years since the previous &#8230; <a href="http://tellini.info/2009/04/mod_tunnel-for-apache-2-2-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>mod_tunnel is a simple Apache module that can be used to create TCP tunnels using your Web server. It is useful to expose services which can be reached through a proxy, bypassing firewalls.</p>
<p>After <em>only</em> 4 years since the previous version, you can now download version 2.0 which works with Apache 2.2.x (and maybe 2.0.x, but I haven&#8217;t tested it).</p>
<p>You&#8217;ll find it on <a href="https://sourceforge.net/projects/mod-tunnel/" title="mod_tunnel on sourceforge.net">sourceforge</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2009/04/mod_tunnel-for-apache-2-2-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t shout at your hard drives!</title>
		<link>http://tellini.info/2009/01/dont-shout-at-your-hard-drives/</link>
		<comments>http://tellini.info/2009/01/dont-shout-at-your-hard-drives/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 12:47:43 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[drives]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[shouting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=82</guid>
		<description><![CDATA[It appears that hard drives don&#8217;t like it&#8230; It also proves that some sysadmins have far too much time to spare.]]></description>
			<content:encoded><![CDATA[<p>It appears that hard drives don&#8217;t like it&#8230;</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="src" value="http://www.youtube.com/v/tDacjrSCeq4&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=es&amp;feature=player_embedded&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/tDacjrSCeq4&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=es&amp;feature=player_embedded&amp;fs=1" allowfullscreen="true"></embed></object></p>
<p>It also proves that some sysadmins have far too much time to spare. <img src='http://tellini.info/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2009/01/dont-shout-at-your-hard-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who&#8217;s linking to your site?</title>
		<link>http://tellini.info/2008/06/whos-linking-to-your-site/</link>
		<comments>http://tellini.info/2008/06/whos-linking-to-your-site/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 12:57:28 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[logminer]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[referrers]]></category>
		<category><![CDATA[sysadmin]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=70</guid>
		<description><![CDATA[If you&#8217;re using LogMiner to analyse your Apache/IIS logs, here&#8217;s an easy recipe to be notified of sites that send visitors your way. First, let&#8217;s define a Pg/PLSQL function to extract the new referrers: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748CREATE TYPE new_referrer AS &#40; &#160; &#8230; <a href="http://tellini.info/2008/06/whos-linking-to-your-site/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using <a href="http://logminer.tellini.info/">LogMiner</a> to analyse your Apache/IIS logs, here&#8217;s an easy recipe to be notified of sites that send visitors your way.</p>
<p>First, let&#8217;s define a Pg/PLSQL function to extract the new referrers:</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TYPE</span> new_referrer <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #66cc66;">&#40;</span><br />
&nbsp; &nbsp; site_id &nbsp; &nbsp; &nbsp; &nbsp; int8<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; site_name &nbsp; &nbsp; &nbsp; text<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; referrer &nbsp; &nbsp; &nbsp; &nbsp;text<span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; hits &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">INT</span><br />
<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> get_new_referrers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">RETURNS</span> SETOF new_referrer <span style="color: #993333; font-weight: bold;">AS</span> $body$<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DECLARE</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; rec &nbsp; &nbsp; &nbsp; &nbsp; new_referrer;<br />
&nbsp; &nbsp; &nbsp; &nbsp; lastRef &nbsp; &nbsp; int8;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">BEGIN</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">INTO</span> lastRef <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">VALUE</span> <span style="color: #993333; font-weight: bold;">AS</span> int8 <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FROM</span> catalog<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'LastReferrer'</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">IF</span> lastRef <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">THEN</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> catalog <span style="color: #66cc66;">&#40;</span> name<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">VALUE</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'LastReferrer'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastRef :<span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">END</span> <span style="color: #993333; font-weight: bold;">IF</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FOR</span> rec <span style="color: #993333; font-weight: bold;">IN</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">EXECUTE</span> <span style="color: #ff0000;">'SELECT s.id AS site_id, s.name AS site_name, r.referrer, tmp.hits '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'FROM ( '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' &nbsp; SELECT site, referrer, COUNT(*) AS hits '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' &nbsp; FROM accesses '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' &nbsp; WHERE referrer &gt; '</span> <span style="color: #66cc66;">||</span> lastRef <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">' &nbsp; GROUP BY site, referrer '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">') tmp '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'JOIN sites s ON s.id = tmp.site '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'JOIN referrers r ON tmp.referrer = r.id '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'WHERE r.extern = true '</span> <span style="color: #66cc66;">||</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">'ORDER BY s.name, tmp.hits DESC, r.referrer'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; LOOP<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">RETURN</span> <span style="color: #993333; font-weight: bold;">NEXT</span> rec;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">END</span> LOOP;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">UPDATE</span> catalog<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #993333; font-weight: bold;">VALUE</span> <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">MAX</span><span style="color: #66cc66;">&#40;</span> id <span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">FROM</span> referrers <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'LastReferrer'</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">RETURN</span>;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">END</span>;<br />
$body$ <span style="color: #993333; font-weight: bold;">LANGUAGE</span> plpgsql;</div></td></tr></tbody></table></div>
<p>Then, a little PHP script to run the query and format the results:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/usr/local/bin/php<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$lines</span> &nbsp; &nbsp;<span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$lastSite</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// quickest and dirtiest way to execute a query in PHP ;-)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exec"><span style="color: #990000;">exec</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;echo 'SELECT r.* &quot;</span> <span style="color: #339933;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">&quot;FROM get_new_referrers() r &quot;</span> <span style="color: #339933;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">&quot;LEFT JOIN search_engines se ON ( r.referrer ~* se.pattern AND r.referrer ~* se.query_pattern )&quot;</span> <span style="color: #339933;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">&quot;WHERE se.id IS NULL' | /usr/local/pgsql/bin/psql -U logminer -At logminer&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$lines</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$lines</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$line</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$parts</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$lastSite</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/printf"><span style="color: #990000;">printf</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;<br />
<br />
<br />
<br />
&quot;</span> <span style="color: #339933;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;-------------------------------------------------------<br />
&quot;</span> <span style="color: #339933;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;Referrers for <span style="color: #009933; font-weight: bold;">%25s</span><br />
&quot;</span> <span style="color: #339933;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;-------------------------------------------------------<br />
<br />
&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$lastSite</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/printf"><span style="color: #990000;">printf</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;[<span style="color: #009933; font-weight: bold;">%25d</span>] <span style="color: #009933; font-weight: bold;">%25s</span><br />
<br />
&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">3</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parts</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>The query above grabs the referrers for every site available in the DB, filtering requests coming from known search engines to reduce the level of &#8220;noise&#8221;.</p>
<p>This script is finally invoked by the cron job that processes the logs:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">referrers_report.php <span style="color: #000000; font-weight: bold;">|</span> mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">'New referrers report'</span> email<span style="color: #000000; font-weight: bold;">@</span>example.com</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2008/06/whos-linking-to-your-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lm_sensors config for Asus T3-P5945GCX (P5L13L motherboard)</title>
		<link>http://tellini.info/2008/03/lm_sensors-config-for-asus-t3-p5945gcx-p5l13l-motherboard/</link>
		<comments>http://tellini.info/2008/03/lm_sensors-config-for-asus-t3-p5945gcx-p5l13l-motherboard/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 10:24:00 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[asus]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lm_sensors]]></category>
		<category><![CDATA[mandriva]]></category>
		<category><![CDATA[sysadmin]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=59</guid>
		<description><![CDATA[I&#8217;ve just installed the latest Mandriva 2008.1 RC on this fine Asus barebone. Everything went fine, except that the output of sensors showed too many ALARM messages for my taste&#8230; so, here&#8217;s how I&#8217;ve modified the pre-installed sensors.conf to set &#8230; <a href="http://tellini.info/2008/03/lm_sensors-config-for-asus-t3-p5945gcx-p5l13l-motherboard/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just installed the latest Mandriva 2008.1 RC on this fine Asus barebone.</p>
<p>Everything went fine, except that the output of sensors showed too many ALARM messages for my taste&#8230; so, here&#8217;s how I&#8217;ve modified the pre-installed <strong>sensors.conf</strong> to set some min/max values closer to reality and to hide useless lines:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Winbond W83627EHF configuration originally contributed by Leon Moonen</span><br />
<span style="color: #666666; font-style: italic;"># This is for an Asus P5P800, voltages for A8V-E SE.</span><br />
chip <span style="color: #ff0000;">&quot;w83627ehf-*&quot;</span> <span style="color: #ff0000;">&quot;w83627dhg-*&quot;</span><br />
<br />
&nbsp; &nbsp; label in0 <span style="color: #ff0000;">&quot;VCore&quot;</span><br />
&nbsp; &nbsp; label in2 <span style="color: #ff0000;">&quot;AVCC&quot;</span><br />
&nbsp; &nbsp; label in3 <span style="color: #ff0000;">&quot;3VCC&quot;</span><br />
&nbsp; &nbsp; label in7 <span style="color: #ff0000;">&quot;VSB&quot;</span><br />
&nbsp; &nbsp; label in8 <span style="color: #ff0000;">&quot;VBAT&quot;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># +12V is in1 and +5V is in6 as recommended by datasheet</span><br />
&nbsp; &nbsp; compute in1 <span style="color: #000000; font-weight: bold;">@*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>+<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">56</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, &nbsp;<span style="color: #000000; font-weight: bold;">@/</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>+<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">56</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; compute in6 <span style="color: #000000; font-weight: bold;">@*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>+<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">22</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, &nbsp;<span style="color: #000000; font-weight: bold;">@/</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>+<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">22</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in1_min &nbsp; <span style="color: #000000;">12.0</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.9</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in1_max &nbsp; <span style="color: #000000;">12.0</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.1</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in6_min &nbsp; <span style="color: #000000;">5.0</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.95</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in6_max &nbsp; <span style="color: #000000;">5.0</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.05</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in4_min &nbsp; <span style="color: #000000;">1.6</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.9</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in4_max &nbsp; <span style="color: #000000;">1.6</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.05</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in9_min &nbsp; <span style="color: #000000;">1.6</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.9</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in9_max &nbsp; <span style="color: #000000;">1.6</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.05</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Set the 3.3V</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in2_min &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.95</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in2_max &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.05</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in3_min &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.95</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in3_max &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.05</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in7_min &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.95</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in7_max &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.05</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in8_min &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">0.95</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> in8_max &nbsp; <span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1.05</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Fans</span><br />
&nbsp; &nbsp;label fan2 &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">&quot;CPU Fan&quot;</span><br />
<br />
&nbsp; ignore fan1<br />
&nbsp; ignore fan3<br />
&nbsp; ignore fan4<br />
&nbsp; ignore fan5<br />
<br />
<span style="color: #666666; font-style: italic;"># Temperatures</span><br />
&nbsp; &nbsp;label temp1 &nbsp; &nbsp; <span style="color: #ff0000;">&quot;Sys Temp&quot;</span><br />
&nbsp; &nbsp;label temp2 &nbsp; &nbsp; <span style="color: #ff0000;">&quot;CPU Temp&quot;</span><br />
&nbsp; &nbsp;label temp3 &nbsp; &nbsp; <span style="color: #ff0000;">&quot;AUX Temp&quot;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">set</span> temp1_over &nbsp;<span style="color: #000000;">45</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">set</span> temp1_hyst &nbsp;<span style="color: #000000;">40</span></div></td></tr></tbody></table></div>
<p>Corrections are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2008/03/lm_sensors-config-for-asus-t3-p5945gcx-p5l13l-motherboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LogMiner: purging old accesses</title>
		<link>http://tellini.info/2008/01/logminer-purging-old-accesses/</link>
		<comments>http://tellini.info/2008/01/logminer-purging-old-accesses/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 17:53:22 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[logminer]]></category>
		<category><![CDATA[sysadmin]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=55</guid>
		<description><![CDATA[I&#8217;ve just committed a function to easily purge old data from LogMiner&#8217;s database, useful to prevent it from growing too much. It&#8217;ll appear in the next version, but since its release might still be far from now, here&#8217;s the code &#8230; <a href="http://tellini.info/2008/01/logminer-purging-old-accesses/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just committed a function to easily purge old data from LogMiner&#8217;s database, useful to prevent it from growing too much.</p>
<p>It&#8217;ll appear in the next version, but since its release might still be far from now, here&#8217;s the code for those who need it:</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> cleanup<span style="color: #66cc66;">&#40;</span> _site int8<span style="color: #66cc66;">,</span> _upToDate <span style="color: #993333; font-weight: bold;">DATE</span> <span style="color: #66cc66;">&#41;</span> <br />
<span style="color: #993333; font-weight: bold;">RETURNS</span> <span style="color: #993333; font-weight: bold;">INT</span> <span style="color: #993333; font-weight: bold;">AS</span> $body$<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">BEGIN</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> accesses<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> req_time <span style="color: #66cc66;">&lt;</span> _upToDate<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">AND</span> site <span style="color: #66cc66;">=</span> _site;<br />
<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> accesses <span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">CONSTRAINT</span> accesses_request_fkey;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> accesses <span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">CONSTRAINT</span> accesses_search_fkey;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> accesses <span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">CONSTRAINT</span> accesses_referrer_fkey;<br />
<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> requests<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> id <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> request <span style="color: #993333; font-weight: bold;">FROM</span> accesses <span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> search_referrals<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> id <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #993333; font-weight: bold;">SEARCH</span> <span style="color: #993333; font-weight: bold;">FROM</span> accesses <span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> referrers<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> id <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> referrer <span style="color: #993333; font-weight: bold;">FROM</span> accesses <span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> accesses<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">CONSTRAINT</span> <span style="color: #ff0000;">&quot;accesses_request_fkey&quot;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FOREIGN</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span> request <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">REFERENCES</span> requests<span style="color: #66cc66;">&#40;</span> id <span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">DELETE</span> CASCADE;<br />
<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> accesses<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">CONSTRAINT</span> <span style="color: #ff0000;">&quot;accesses_search_fkey&quot;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FOREIGN</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">SEARCH</span> <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">REFERENCES</span> search_referrals<span style="color: #66cc66;">&#40;</span> id <span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #993333; font-weight: bold;">NULL</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> accesses<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">CONSTRAINT</span> <span style="color: #ff0000;">&quot;accesses_referrer_fkey&quot;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">FOREIGN</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span> referrer <span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">REFERENCES</span> referrers<span style="color: #66cc66;">&#40;</span> id <span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #993333; font-weight: bold;">NULL</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">RETURN</span> <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">END</span>;<br />
$body$ <span style="color: #993333; font-weight: bold;">LANGUAGE</span> plpgsql;</div></td></tr></tbody></table></div>
<p>For instance, if you want to keep only the last six month of data, you can set up a cron job which runs at the first day of every month executing the command:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># supposing 1 is the id of your site</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;SELECT * FROM cleanup( 1, CAST( date_trunc( 'month', now() ) - interval '5 months' AS date ));&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> psql <span style="color: #660033;">-U</span> logminer logminer</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2008/01/logminer-purging-old-accesses/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mac OS X version statistics through CFNetwork analysis</title>
		<link>http://tellini.info/2007/12/mac-os-x-version-statistics-through-cfnetwork-analysis/</link>
		<comments>http://tellini.info/2007/12/mac-os-x-version-statistics-through-cfnetwork-analysis/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 11:05:00 +0000</pubDate>
		<dc:creator>Simone</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[logminer]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[sysadmin]]></category>
		<guid isPermaLink="false">http://wp.cr.tellini.org/?p=46</guid>
		<description><![CDATA[Recently I needed to gather some statistics about the distribution of the different Mac OS X versions installed by users of a certain application. Since the application has an update-check feature, I thought I&#8217;d use the web server logs to &#8230; <a href="http://tellini.info/2007/12/mac-os-x-version-statistics-through-cfnetwork-analysis/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to gather some statistics about the distribution of the different Mac OS X versions installed by users of a certain application.</p>
<p>Since the application has an update-check feature, I thought I&#8217;d use the web server logs to infer the data I was interested in. The only thing I could use was the <strong>User-Agent</strong> string sent by the application when requesting the file containing the update information.</p>
<p>After some digging in Darwin&#8217;s build plists and a bit of googling, I came up with this list of patterns:</p>
<pre>
            OS            |                user agent pattern
--------------------------+---------------------------------------------------
 Mac OS X 10.2            | ^CFNetwork/1.1$
 Mac OS X 10.3.2-10.3.8   | ^CFNetwork/1.2.1$
 Mac OS X 10.3.9          | ^CFNetwork/1.2.[2-6]$
 Mac OS X 10.4            | ^CFNetwork/128$
 Mac OS X 10.4.10         | ^CFNetwork/129.21$
 Mac OS X 10.4.11         | ^CFNetwork/129.22$
 Mac OS X 10.4.2          | ^CFNetwork/128.2$
 Mac OS X 10.4.3          | ^CFNetwork/(129.5|10.4.3)$
 Mac OS X 10.4.4          | ^CFNetwork/(129.(9|10)|10.4.4)$
 Mac OS X 10.4.5          | ^CFNetwork/129.11$
 Mac OS X 10.4.6          | ^CFNetwork/129.13$
 Mac OS X 10.4.7          | ^CFNetwork/(129.16|4.0)$
 Mac OS X 10.4.8          | ^CFNetwork/129.1(8|9)$
 Mac OS X 10.4.9          | ^CFNetwork/129.20$
 Mac OS X 10.5            | ^CFNetwork/21[7-9]$
 Mac OS X 10.5.1          | ^CFNetwork/220$
 Mac OS X 10.5-prerelease | ^CFNetwork/1[4-9][0-9](.[0-9])?|20[0-9]|21[0-9]$
</pre>
<p>They might not be 100%25 correct, but they&#8217;re good enough.</p>
]]></content:encoded>
			<wfw:commentRss>http://tellini.info/2007/12/mac-os-x-version-statistics-through-cfnetwork-analysis/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

