<?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>Thomas Gericke &#187; linux</title>
	<atom:link href="http://www.thomasgericke.de/v4/interactive/blog/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thomasgericke.de/v4/interactive/blog</link>
	<description>Facts. Thoughts. Stories. A Blog.</description>
	<lastBuildDate>Wed, 08 Feb 2012 11:43:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>unfake.it ist Platz 1 von über 19 Millionen! Sponsoren interessiert?</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2010/08/unfake-it-ist-platz-1-von-uber-19-millionen-sponsoren-interessiert/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2010/08/unfake-it-ist-platz-1-von-uber-19-millionen-sponsoren-interessiert/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 22:37:55 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[daily life]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sponsoring]]></category>
		<category><![CDATA[unfake]]></category>
		<category><![CDATA[unfake plugin]]></category>
		<category><![CDATA[url shortening]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=7262</guid>
		<description><![CDATA[Ich wundere mich seit Tagen über extrem angestiegenen  [...]]]></description>
			<content:encoded><![CDATA[<p>Ich wundere mich seit Tagen über extrem angestiegenen Traffic für meinen URL Shortener <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/" target="_blank" title="(709 hits)">unfake.it</a>. Des Rätsels Lösung ist wohl sehr einfach: eine <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.google.de/search?q=url+faker" target="_blank" title="(109 hits)">Google-Suche nach &#8220;url faker&#8221;</a> liefert 19.400.000 Ergebnisse. Und unfake.it ist auf Platz 1 inkl. Mini-Sitelinks, Platz 2 ist mein <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/2009/01/url-shortener-unfaker/" target="_blank" title="(140 hits)">Blog-Artikel über unfake.it</a> vom 25. Januar 2009. Das ist ziemlich neu, da bin ich mir relativ sicher.</p>
<p>Da wundert mich nichts mehr. Leider, leider gerät das System aber so langsam aber Sicher an die Lastgrenzen und ich muss mir überlegen, ob ich nicht doch eine meiner Regeln breche, denn ich hatte ursprünglich beschlossen und kommuniziert, dass unfake.it <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/help.php#commercials" target="_blank" title="(296 hits)">niemals Werbung vor oder nach dem Klicken einer Kurz-URL anzeigen wird</a>.</p>
<p><strong>Was meint ihr?</strong> Sollte ich Werbung schalten und so ggf. neue, schnellere Hardware finanzieren? Oder findet sich ggf. irgendwo ein freundlicher <strong>Sponsor</strong>? Bin gerne bereit, darüber zu verhandeln <img src='http://www.thomasgericke.de/v4/interactive/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2010/08/unfake-it-ist-platz-1-von-uber-19-millionen-sponsoren-interessiert/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Korrekte Nutzung von MySQL wirkt Wunder &#8211; INSERT DELAYED/UPDATE LOW_PRIORITY/Indizes</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2010/08/korrekte-nutzung-von-mysql-wirkt-wunder-insert-delayed-update-low_priority-indizes/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2010/08/korrekte-nutzung-von-mysql-wirkt-wunder-insert-delayed-update-low_priority-indizes/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 21:27:39 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[datenbank]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=7222</guid>
		<description><![CDATA[Es gibt Datenbanken, die stehen unter grosser Last, wei [...]]]></description>
			<content:encoded><![CDATA[<p>Es gibt Datenbanken, die stehen unter grosser Last, weil die Queries sehr komplex sind. Andere Datenbanken sind immens gross. Eine meiner Datenbanken hat sehr viele Zugriffe, sowohl lesend als auch schreibend. Heute wurde der Server an die Lastgrenze getrieben, was mich dazu zwang, Optimierungen vorzunehmen.</p>
<p><strong>1. <code>INSERT DELAYED</code> und <code>UPDATE LOW_PRIORITY</code></strong></p>
<p>Bisher habe ich mich immer davon fern gehalten, diese Funktionen zu nutzen, einfach weil ich keine Veranlassung dazu sah. Warum schreibende Zugriffe verzögern, wenn sie doch auch unmittelbar vollzogen werden können? Die Tatsache, dass mehrere hunderte gleichzeitiger Zugriffe sich gegenseitig behinderten, brachte mich dazu, meine Denkweise zu überdenken.</p>
<p><span id="more-7222"></span>Ich habe zwei schreibende SQL-Statements kurzerhand von &#8220;<code>INSERT INTO <em>TABLE</em>...</code>&#8221; in &#8220;<code>INSERT DELAYED INTO <em>TABLE</em>...</code>&#8221; bzw. &#8220;<code>UPDATE <em>TABLE</em>...</code>&#8221; in &#8220;<code>UPDATE LOW_PRIORITY <em>TABLE</em>...</code>&#8221; umgeschrieben.</p>
<p>Natürlich gibt es Nachteile. Erstens sind die geschriebenen Daten nicht unmittelbar abrufbar, zweitens gehen diese unweigerlich verloren, sofern der MySQL-Server unsauber beendet wird, bevor die Queries auf Platte geschrieben werden konnten.</p>
<p>Die Vorteile überwiegen jedoch, denn ich konnte damit die Serverlast unglaublich reduzieren. Es sollte allerdings wohl überlegt werden, welche Statements man verzögert schreiben lässt.</p>
<p><strong>2. Die sinnvolle Verwendung von Indizes</strong></p>
<p>Eine weitere Optimierung, zu der ich mich gezwungen sah, war der Einsatz von Indizes in MySQL-Tabellen. Dauert die Verarbeitung eines SQL-Queries sehr lang, weil unheimlich viele Daten analysiert werden müssen, so bietet sich der Einsatz eines Index&#8217; durchaus an. Beispiel:</p>
<pre class="brush: php">SELECT COUNT(wa_sessions.ID) AS Sessions
FROM wa_sessions, wa_sites
WHERE wa_sites.site_name = &#039;foo&#039;
AND wa_sites.ID = wa_sessions.site_id
AND wa_sessions.begin
BETWEEN NOW() - INTERVAL 5 MINUTE
AND NOW() - INTERVAL 0 MINUTE;
+----------+
| Sessions |
+----------+
|       20 |
+----------+

1 row in set (5.00 sec)</pre>
<p>Im obigen Beispiel dauert die Abfrage exakt 5 Sekunden, was für eine Webanwendung unbrauchbar lang ist. Mit MySQL-Boardmitteln kann man sich anschauen, warum die Abfrage so lange dauert:</p>
<pre class="brush: php">EXPLAIN SELECT COUNT(wa_sessions.ID) AS Sessions
FROM wa_sessions, wa_sites
WHERE wa_sites.site_name = &#039;foo&#039;
AND wa_sites.ID = wa_sessions.site_id
AND wa_sessions.begin
BETWEEN NOW() - INTERVAL 5 MINUTE
AND NOW() - INTERVAL 0 MINUTE\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: wa_sites
type: ref
possible_keys: PRIMARY,site_sites
key: site_sites
key_len: 35
ref: const
rows: 1
Extra: Using where
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: wa_sessions
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 831752
Extra: Using where
2 rows in set (0.00 sec)</pre>
<p>Man erkennt, dass zwei Tabellen durchsucht werden. Für die erste Tabelle wird ein Key verwendet, für die zweite Tabelle jedoch nicht. Aus diesem Grund liefert die Abfrage der ersten Tabelle auch nur genau ein Ergebnis zurück, während in der zweiten Tabelle noch 831752 Ergebnisse auf den <code>WHERE</code>-Teil hin überprüft werden müssen. Das dauert natürlich eine Weile.</p>
<p>Besser geht es mit dem Einsatz eines Indizes im entsprechenden Tabellen-Feld, welches vom <code>WHERE</code>-Teil abgefragt wird:</p>
<pre class="brush: php">CREATE INDEX session_begin ON wa_sessions (begin(18));
Query OK, 831761 rows affected (34.52 sec)</pre>
<p>Das gleiche <code>EXPLAIN SELECT</code> Statement von gerade eben zeigt, dass nun auch in der zweiten Tabelle ein Key verwendet wird:</p>
<pre class="brush: php">EXPLAIN SELECT COUNT(wa_sessions.ID) AS Sessions
FROM wa_sessions, wa_sites
WHERE wa_sites.site_name = &#039;foo&#039;
AND wa_sites.ID = wa_sessions.site_id
AND wa_sessions.begin
BETWEEN NOW() - INTERVAL 5 MINUTE
AND NOW() - INTERVAL 0 MINUTE \G

*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: wa_sites
type: ref
possible_keys: PRIMARY,site_sites
key: site_sites
key_len: 35
ref: const
rows: 1
Extra: Using where
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: wa_sessions
type: range
possible_keys: session_begin
key: session_begin
key_len: 21
ref: NULL
rows: 55
Extra: Using where
2 rows in set (0.00 sec)</pre>
<p>Sofort ist erkennbar, dass in der zweiten Tabelle nur noch 55 Ergebnisse mittels der <code>WHERE</code>-Abfrage analysiert werden müssen. Die meisten der weit über 800.000 Ergebnisse in der zweiten Tabelle wurden durch das reine Vorhandensein des Indizes bereits ausgeschlossen. Und das SQL-Statement ist damit volle 5 Sekunden schneller:</p>
<pre class="brush: php">SELECT COUNT(wa_sessions.ID) AS Sessions
FROM wa_sessions, wa_sites
WHERE wa_sites.site_name = &#039;foo&#039;
AND wa_sites.ID = wa_sessions.site_id
AND wa_sessions.begin
BETWEEN NOW() - INTERVAL 5 MINUTE
AND NOW() - INTERVAL 0 MINUTE;

+----------+
| Sessions |
+----------+
|       12 |
+----------+
1 row in set (0.00 sec)</pre>
<p>Auch bei Indizes ist Vorsicht geboten. Zu grosse oder falsche Indizes können die Datenbank unter Umständen nicht nur unnötig gross, sondern auch langsamer machen.</p>
<p>Erläuterungen finden sich in der MySQL-Dokumentation auf <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://dev.mysql.com/doc/" target="_blank" title="(57 hits)">http://dev.mysql.com/doc/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2010/08/korrekte-nutzung-von-mysql-wirkt-wunder-insert-delayed-update-low_priority-indizes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Woopra Webanalyse im Test</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2010/08/woopra-webanalyse-im-test/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2010/08/woopra-webanalyse-im-test/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 19:03:50 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[erfahrungsbericht]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[webstats]]></category>
		<category><![CDATA[woopra]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=7182</guid>
		<description><![CDATA[Habe heute Abend Woopra getestet. Geboten wird ein Dien [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-7192" title="Screen shot 2010-08-11 at 8.48.58 PM" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2010/08/Screen-shot-2010-08-11-at-8.48.58-PM.png" alt="" width="252" height="45" />Habe heute Abend <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.woopra.com/" target="_blank" title="(140 hits)">Woopra</a> getestet. Geboten wird ein Dienst, welcher Echtzeit-Statistiken von Webseiten generiert. Hierzu wird ein Javascript-Code-Schnipsel auf der gewünschten Website eingebunden, welche einen Connect auf die Woopra-Server macht und dabei Server- und Client-Daten übermittelt. Nette Idee, funktioniert auch. Für mich <strong>dennoch untauglich</strong>. Mehr dazu weiter unten.</p>
<p>Die Bedienung der Woopra-Website ist einfach und intuitiv. Zunächst muss ein Profil angelegt und per E-Mail-Verifizierung bestätigt werden. Dann können die Websites (anhand von Domains) angelegt werden, die getracked werden sollen.</p>
<p>Im Quellcode der fraglichen Webseiten muss nun der kleine Javascript-Schnipsel eingebunden werden. Sofort darauf werden die Live-Statistiken entweder über das Dashboard der Woopra-Website oder aber über ein entsprechendes Desktop-Programm ausgegeben. Ich hatte den Mac OS X Client getestet. Dieser schaut sehr ansprechend aus und stellt die Informationen nett dar.</p>
<p>Für mich kommt Woopra in dieser Form nicht in Frage, denn es deckt nicht mal die Hälfte meiner Anwendungsfälle ab. Konkretes Problem ist, dass ich zahlreiche Seiten betreibe, die keinerlei oder besondere Header-Informationen senden und mit der Javascript-Ausgabe im BODY nicht klar kommen. Spätestens bei einem 301-Header ist hier Schluss, das funktioniert nicht mit Javascript.</p>
<p>Das erinnert mich daran, dass ich mit (m)einem unlängst eingeschlafenen eigenen Webanalyse-Tool weitermachen sollte. Bereits vor einem Jahr hatte ich eine lauffähige Version, die in ähnlicher Weise wie Woopra arbeitet und auch viele brauchbare Daten bereitstellt. Aus Zeitgründen war dieses Projekt eingeschlafen. Vielleicht mache ich bei Gelegenheit damit mal weiter und erfinde Google Analytics neu <img src='http://www.thomasgericke.de/v4/interactive/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2010/08/woopra-webanalyse-im-test/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HOWTO: View PDF files inline in Firefox</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2010/07/howto-view-pdf-files-inline-in-firefox/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2010/07/howto-view-pdf-files-inline-in-firefox/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 12:45:44 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[iceweasel]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=6612</guid>
		<description><![CDATA[Auf dieser Seite wird einwandfrei beschrieben, wie man  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://sprayfly.com/2010/01/15/view-pdf-files-inline-in-firefox-on-ubuntu-karmic-9-10/" target="_blank" title="(154 hits)">Auf dieser Seite wird einwandfrei beschrieben</a>, wie man (s)einen Firefox (oder Iceweasel) dazu bewegen kann, PDF-Dokumente inline (direkt im aktiven Tab) im Browser zu öffnen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2010/07/howto-view-pdf-files-inline-in-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO: SpamAssassins sa-learn von IMAP Mailboxen lernen lassen</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2010/07/howto-spamassassins-sa-learn-von-imap-mailboxen-lernen-lassen/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2010/07/howto-spamassassins-sa-learn-von-imap-mailboxen-lernen-lassen/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 07:15:59 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sa-learn]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spamassassin]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=5732</guid>
		<description><![CDATA[Seit wohl mehr als zwei Jahren wundere ich mich hin und [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://spamassassin.apache.org/" title="(52 hits)"><img class="alignleft size-full wp-image-5752" title="arrowlogo" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2010/07/arrowlogo.png" alt="" width="334" height="148" /></a>Seit wohl mehr als zwei Jahren wundere ich mich hin und wieder, weshalb mein <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://spamassassin.apache.org/" target="_blank" title="(52 hits)">SpamAssassin</a> bei der Beurteilung, ob es sich bei einer eintreffenden E-Mail um Spam oder nicht handelt, nicht langsam mal ein wenig cleverer wird. Nutze ich doch schliesslich <code>sa-learn</code> und verfüttere ihm gesammelte Spam-E-Mails, damit deren Signaturen erkannt und zukünftig nicht mehr durchgelassen werden. Irgendwie wurde es aber nie besser. Gefühlt kam immer mehr Spam durch. Aber das Thema war auch nicht so wichtig, dass ich es mit Nachdruck verfolgt hätte. Bis vor ein paar Tagen.</p>
<p>Ich habe auf meinem Server eine Konfiguration mit Exim4, SpamAssassin (<code>sa-exim</code>) und Cyrus als IMAP-Server. Der Server ist MX für einige Domains und überprüft eingehende E-Mails bereits während und nach den SMTP-Headern nach verschiedenen Methoden auf Spam. Sicher als Spam eingestufte E-Mails werden nicht angenommen, E-Mails, bei denen es nicht so klar ist (mittlerer Spam-Score), landen in einem Quarantäne-Ordner und werden hin und wieder begutachtet.</p>
<p>Kürzlich bin ich hinter das Rätsel gekommen, weshalb das Erlernen neuer Spam-Signaturen nicht funktioniert hat: <span id="more-5732"></span>Spam-E-Mails in diesem Quarantäne-Ordner werden von mir von Zeit zu Zeit in einen Spam-Ordner verschoben oder gelöscht. Nun bringt SpamAssassin ja die nette Funktion mit sich, dass man ihn <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://de.wikipedia.org/wiki/Spam" target="_blank" title="(40 hits)">Spam</a> oder <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://en.wikipedia.org/wiki/Anti-spam_techniques#Checking_words:_false_positives" target="_blank" title="(51 hits)">Ham</a> <em>&#8220;lernen&#8221;</em> lassen kann. Da ich auf meinem Server allerdings IMAP verwende, die mitgelieferte Version von <code>sa-learn</code> nur Folder im mbox-Format lesen kann, wurde also zwei Jahre lang ein Ordner indiziert, welcher zwar (warum auch immer, vermutlich Altlast aus der Zeit vor IMAP) vorhanden war, allerdings keineswegs mit den Spam-Mails gefüttert wurde. Gna, so simpel&#8230;</p>
<p>Also habe ich neulich nach einer (einfachen) Methode gesucht, um dem SpamAssassin direkt meinen IMAP-Spam-Folder lesen und auswerten zu lassen. Und siehe da, <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.sonologic.nl/pub/Projects/ImapSaLearn/imap-sa-learn.pl.txt" target="_blank" title="(179 hits)">auf dieser Seite</a> wurde ich mit folgendem Script fündig:</p>
<p>
<pre class="brush: php">#!/usr/bin/perl&lt;br /&gt;
#&lt;br /&gt;
# imap-sa-learn.pl, wrapper around sa-learn for imap mail boxes&lt;br /&gt;
# Copyright (C) 2004  David M. Zendzian&lt;br /&gt;
# Copyright (C) 2006  Koen Martens&lt;br /&gt;
#&lt;br /&gt;
# This library is free software; you can redistribute it and/or&lt;br /&gt;
# modify it under the terms of the GNU Lesser General Public&lt;br /&gt;
# License as published by the Free Software Foundation; either&lt;br /&gt;
# version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
#&lt;br /&gt;
# This library is distributed in the hope that it will be useful,&lt;br /&gt;
# but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU&lt;br /&gt;
# Lesser General Public License for more details.&lt;br /&gt;
#&lt;br /&gt;
# You should have received a copy of the GNU Lesser General Public&lt;br /&gt;
# License along with this library; if not, write to the Free Software&lt;br /&gt;
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA&lt;br /&gt;
#&lt;br /&gt;
# Feed mail from an imap mail folder to sa-learn. Options:&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
# Derived from: http://www.dmzs.com/tools/files/spam.phtml&lt;br /&gt;
# Derived by  : Koen Martens,&lt;br /&gt;
# Derived on  : October, 13th (Friday), 2006&lt;br /&gt;
# License     : LGPL&lt;br /&gt;
#&lt;br /&gt;
# Things to try if it doesn&#039;t work&lt;br /&gt;
# 1) Use -v for verbose output&lt;br /&gt;
# 2) Check your local.cf for spamassassin bayes_path settings.&lt;br /&gt;
#&lt;br /&gt;
# Also be sure to check that your spamassassin is truely using the&lt;br /&gt;
# bayes files (-D manual startup of spamd to debug there)&lt;br /&gt;
#&lt;br /&gt;
# Modified by ZMI 20090519 ( michael.monnerie@is.it-management.at )&lt;br /&gt;
#&lt;/p&gt;
&lt;p&gt;use Mail::IMAPClient;&lt;br /&gt;
use Getopt::Long;&lt;/p&gt;
&lt;p&gt;sub usage {&lt;br /&gt;
$rv = &amp;quot;--host name         Host name\n&amp;quot;;&lt;br /&gt;
$rv = &amp;quot;-p 1234             Port number\n&amp;quot;;&lt;br /&gt;
$rv = &amp;quot;--port=1234         Port number\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--spam              Classify messages as spam\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--ham               Classify messages as ham\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;-m name             Set mailbox name\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;-mbox name          Set mailbox name\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;-u username         Username to login with\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--user username     Username to login with\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;-p password         Password to login with\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--pass password     Password to login with\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--password password Password to login with\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--debug 1           more verbose output, good for scripts\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--debug 2           fully verbose output\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;-d                  Delete messages after processing\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--delete            Delete messages after processing\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;-h                  Show this help text\n&amp;quot;;&lt;br /&gt;
$rv.= &amp;quot;--help              Show this help text\n&amp;quot;;&lt;br /&gt;
return $rv;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;my $host=&#039;localhost&#039;;&lt;br /&gt;
my $port=143;&lt;br /&gt;
my $spam=0;&lt;br /&gt;
my $ham=0;&lt;br /&gt;
my $mbox=&#039;learnspam&#039;;&lt;br /&gt;
my $user=&#039;foo&#039;;&lt;br /&gt;
my $pass=&#039;bar&#039;;&lt;br /&gt;
# ZMI 20090519: variables for easy reconfiguration:&lt;br /&gt;
my $salearnbin=&amp;quot;/usr/bin/sa-learn&amp;quot;;&lt;br /&gt;
my $tmpfile=&amp;quot;/tmp/imapsalearn$$&amp;quot;;&lt;/p&gt;
&lt;p&gt;my $delete=0;&lt;br /&gt;
# debug 1: terse reporting&lt;br /&gt;
# debug 2: full reporting&lt;br /&gt;
my $debug=0;&lt;br /&gt;
my $help=0;&lt;/p&gt;
&lt;p&gt;if(not GetOptions( &#039;host=s&#039; =&amp;amp;amp;gt; \$host,&lt;br /&gt;
&#039;p|port=i&#039; =&amp;amp;amp;gt; \$port,&lt;br /&gt;
&#039;spam&#039; =&amp;amp;amp;gt; \$spam,&lt;br /&gt;
&#039;ham&#039; =&amp;amp;amp;gt; \$ham,&lt;br /&gt;
&#039;m|mbox=s&#039; =&amp;amp;amp;gt; \$mbox,&lt;br /&gt;
&#039;u|user=s&#039; =&amp;amp;amp;gt; \$user,&lt;br /&gt;
&#039;p|pass|password=s&#039; =&amp;amp;amp;gt; \$pass,&lt;br /&gt;
&#039;debug=i&#039; =&amp;amp;amp;gt; \$debug,&lt;br /&gt;
&#039;d|delete&#039; =&amp;amp;amp;gt; \$delete,&lt;br /&gt;
&#039;h|help&#039; =&amp;amp;amp;gt; \$help)) {&lt;br /&gt;
die(usage());&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;if( ($spam &amp;amp;amp;amp;&amp;amp;amp;amp; $ham) || not($spam || $ham) || $help) {&lt;br /&gt;
die(usage());&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;my $spamhamopt=$spam?&amp;quot;--spam&amp;quot;:&amp;quot;--ham&amp;quot;;&lt;/p&gt;
&lt;p&gt;my $salearn;&lt;/p&gt;
&lt;p&gt;print &amp;quot;connecting...\n&amp;quot;;&lt;br /&gt;
my $imapdebug=0;&lt;br /&gt;
if ($debug &amp;amp;amp;gt;= 2) { $imapdebug=1; }&lt;br /&gt;
my $imap = Mail::IMAPClient-&amp;amp;amp;gt;new( Server=&amp;amp;amp;gt; &amp;quot;$host:$port&amp;quot;,&lt;br /&gt;
User =&amp;amp;amp;gt; $user,&lt;br /&gt;
Password =&amp;amp;amp;gt; $pass,&lt;br /&gt;
Debug =&amp;amp;amp;gt; $imapdebug);&lt;/p&gt;
&lt;p&gt;if (!defined($imap)) { die &amp;quot;IMAP Login Failed&amp;quot;; }&lt;br /&gt;
print &amp;quot;connected...\n&amp;quot;;&lt;/p&gt;
&lt;p&gt;# print out the total counts for each mailbox&lt;br /&gt;
print &amp;quot;getting spam count...\n&amp;quot;;&lt;br /&gt;
my $spamcount = $imap-&amp;amp;amp;gt;message_count($mbox);&lt;br /&gt;
print $spamcount, ($spam?&amp;quot; spam&amp;quot;:&amp;quot; ham&amp;quot;),&amp;quot; to process\n&amp;quot;;&lt;/p&gt;
&lt;p&gt;# Process the spam mailbox&lt;br /&gt;
print &amp;quot;get all messages...\n&amp;quot;;&lt;br /&gt;
$imap-&amp;amp;amp;gt;select($mbox);&lt;br /&gt;
my @msgs = $imap-&amp;amp;amp;gt;search(&amp;quot;ALL&amp;quot;);&lt;br /&gt;
$|=1;&lt;br /&gt;
print &amp;quot;processing...\n&amp;quot;;&lt;br /&gt;
for (my $i=0;$i &amp;amp;amp;lt;= $#msgs; $i++) {   print &amp;quot;$i&amp;quot;;   # I put it into a file for processing, doing it into a perl var &amp;amp;amp;amp; piping through sa-learn just didn&#039;t seem to work   $imap-&amp;amp;amp;gt;message_to_file(&amp;quot;$tmpfile&amp;quot;,$msgs[$i]);&lt;/p&gt;
&lt;p&gt;# execute sa-learn w/data&lt;br /&gt;
if ($debug &amp;amp;amp;gt;= 2) {&lt;br /&gt;
$salearn = `$salearnbin -D --no-sync $spamhamopt $tmpfile`;&lt;br /&gt;
print &amp;quot;-------\nlearn: &amp;quot;,$salearn,&amp;quot;-------\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
$salearn = `$salearnbin --no-sync $spamhamopt $tmpfile`;&lt;br /&gt;
if ($debug == 1) { print &amp;quot;: &amp;quot;,$salearn; }&lt;br /&gt;
else { print &amp;quot;\r&amp;quot;; }&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;# delete processed message&lt;br /&gt;
if($delete) {&lt;br /&gt;
$imap-&amp;amp;amp;gt;delete_message($msgs[$i]);&lt;br /&gt;
}&lt;br /&gt;
unlink(&amp;quot;$tmpfile&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
print &amp;quot;\nDone processing..\n&amp;quot;;&lt;br /&gt;
if($delete) {&lt;br /&gt;
$imap-&amp;amp;amp;gt;expunge();&lt;br /&gt;
}&lt;br /&gt;
$imap-&amp;amp;amp;gt;close();&lt;/p&gt;
&lt;p&gt;$imap-&amp;amp;amp;gt;logout();&lt;/p&gt;
&lt;p&gt;# integrate learned stuff&lt;br /&gt;
my $sarebuild = `$salearnbin --sync`;&lt;br /&gt;
if ($debug &amp;amp;amp;gt;= 2) { print &amp;quot;\n-------\nRebuild: &amp;quot;,$sarebuild,&amp;quot;-------\n&amp;quot;; }&lt;br /&gt;
else { if ($debug == 1) { print &amp;quot;\nRebuild: &amp;quot;,$sarebuild; } }</pre>
</p>
<p>Habe es als Script hinterlegt, die Perl-Module nachgezogen, die Config angepasst und es funktioniert sofort. Prima, so soll&#8217;s sein. Ich empfehle, das Script ohne Parameter aufzurufen, sondern die gewünschten Werte im Code zu hinterlegen. Da ggf. ein Passwort eingetragen werden muss, muss natürlich auf die Berechtigungen geachtet werden. Ich habe es ausschliesslich für root les- und ausführbar gemacht.</p>
<p>Aufwand:</p>
<ul>
<li>5 Minuten nach der Ursache suchen</li>
<li>5 Minuten wundern und Kopfschütteln</li>
<li>2 Minuten nach einer <code>sa-learn</code> Lösung für IMAP suchen</li>
<li>1 Minute Script einbauen</li>
<li>1 Minute Config anpassen</li>
<li>ein Leben lang freuen</li>
</ul>
<p>So einfach kann&#8217;s manchmal sein, wenn man endlich mal die Muße hat, nach der Ursache zu suchen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2010/07/howto-spamassassins-sa-learn-von-imap-mailboxen-lernen-lassen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Websites going into maintenance mode soon &#8211; major database migration forced</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2010/06/websites-going-into-maintenance-mode-soon-major-database-migration-forced/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2010/06/websites-going-into-maintenance-mode-soon-major-database-migration-forced/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 10:03:28 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[unfake]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/2010/06/websites-going-into-maintenance-mode-soon-major-database-migration-forced/</guid>
		<description><![CDATA[Due to critical hardware failure, I'm forced to shut do [...]]]></description>
			<content:encoded><![CDATA[<p>Due to critical hardware failure, I&#8217;m forced to shut down and migrate all my websites and those hosted on my server soon. This might happen this afternoon already.</p>
<p>Right now, most of the websites are still working properly. Nevertheless, several database queries, depending on MySQL&#8217;s temporary directory, currently fail since the temp filesystem unfortunately is read-only. Most likely, this effects categories and article tagging in WordPress.</p>
<p>Even though I&#8217;ve prepared and tested the migration so far, there will be a downtime of at least several minutes. After the migration, there might be character problems due to a required change from LATIN1 to UTF8. This may result in not properly displayed German characters like &#8220;ä&#8221;, &#8220;ö&#8221;, &#8220;ü&#8221;.</p>
<p>If you encounter problems in the next few days, please contact me.</p>
<p>Thanks.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2010/06/websites-going-into-maintenance-mode-soon-major-database-migration-forced/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>unfake.it: performance increase and temporary twitter failure</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2009/12/unfakeit-performance-increase-and-temporary-twitter-failure/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2009/12/unfakeit-performance-increase-and-temporary-twitter-failure/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 15:02:25 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[unfake]]></category>
		<category><![CDATA[url shortening]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=4541</guid>
		<description><![CDATA[Hi there,

during the past few days, unfake.it's perf [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there,</p>
<p>during the past few days, <a title="unfake.it (709 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/" target="_blank">unfake.it</a>&#8216;s performance increased dramatically. Several scripts and jobs have been <strong>moved onto new servers</strong>, the database structure and various <code>SQL</code> statements have been enhanced and even <code>SQL SELECT</code> statements have been optimized to more and more use readonly slave servers. Most URLs are being faked in much less than <strong>a tenth of a second</strong>. The <a title="magical previews (296 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/help.php#preview" target="_blank">magical preview</a>s of faked URLs are generated <strong>almost instantly</strong>, since performance increased dramatically.</p>
<p>Unfortunately, faked URLs weren&#8217;t posted to <a title="Twitter (111 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://twitter.com/" target="_blank">Twitter</a> when using the <a title="WordPress Plugin (605 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wordpress.org/extend/plugins/url-shortener-for-twitter-tools/" target="_blank">WordPress Plugin</a> during the past 4 hours due to a <strong>tiny misconfiguration</strong>. This issue could be solved.</p>
<p><a title="unfake.it (709 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/" target="_blank">unfake.it</a> has become <strong>a more and more commonly used URL shortener</strong> during the past months. Almost <strong>1.000 URLs</strong> are faked in a 24 hour period, even though this magic edge has not yet been crossed. See the <a title="stats (394 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/stats.php" target="_blank">stats</a> for more information &#8217;bout that.</p>
<p>Bye, Thomas</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2009/12/unfakeit-performance-increase-and-temporary-twitter-failure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>unfake.it now with facebook integration</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2009/08/unfakeit-now-with-facebook-integration/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2009/08/unfakeit-now-with-facebook-integration/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 01:48:44 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[FBML]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[unfake]]></category>
		<category><![CDATA[unfake plugin]]></category>
		<category><![CDATA[url shortening]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=4211</guid>
		<description><![CDATA[Hi there,

after several months, unfake.it has become [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there,</p>
<p>after several months, unfake.it has become even more important in the Web2.0 community. A few weeks ago, I was talking to some guys and co-workers about programming and such things. I then told about unfake.it and a co-worker of mine said, he somehow stubled upon <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/" title="(709 hits)">http://unfake.it/</a> and uses it irregular. That was quite funny to me.</p>
<p>I&#8217;ve had very few time the past months and since I got stuck on the half way because of some WordPress problems and also some problems with facebook&#8217;s API and FBML, there was no more development. But now I&#8217;m proud to announce that today, I released a completely new version including new features:</p>
<p><strong>WordPress plugin version 1.2</strong></p>
<p>The new <a title="WordPress plugin (605 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://wordpress.org/extend/plugins/url-shortener-for-twitter-tools/" target="_blank">plugin</a> comes with its own settings page and adds two own tables to your WordPress installation. The main purpose is to let you configure, whether or not you wish to be taken to facebook and add the shortened URL for your new blog post (including a thumbnailed screenshot) to your facebook profile page and even in your friends newsfeeds.</p>
<p><strong>Facebook application</strong></p>
<p>unfake.it now has <a title="facebook application (216 hits)" href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://apps.facebook.com/unfake_it/" target="_blank">its own facebook application</a> which lets you add shortened URLs, lists them as screenshots in a profile box, displays about new URLs on your profile wall and even tells your friends about it in their newsfeeds. Want an example? See:</p>
<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_v12.png" title="(149 hits)"><img class="aligncenter size-full wp-image-4221" title="uf_v12" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_v12.png" alt="uf_v12" width="510" height="132" /></a></p>
<p>Since a few hundred URLs are shortened every single day, I also had to do some enhancements to the database structure and especially to the thumbnailing process. Just think about it: at the moment, we have more than 20,000 shortened URLs, each of them was once and initially thumbnailed, stored and is re-fetched every few days, if still hits occur. That&#8217;s a lot of traffic and a lot of CPU power. Just take a look how MySQL handlers and Apache traffic increased the last months:</p>
<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_mysql_200908.png" title="(159 hits)"><img class="aligncenter size-full wp-image-4231" title="uf_mysql_200908" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_mysql_200908.png" alt="uf_mysql_200908" width="421" height="148" /></a></p>
<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_apache_200908.png" title="(160 hits)"><img class="aligncenter size-full wp-image-4241" title="uf_apache_200908" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/08/uf_apache_200908.png" alt="uf_apache_200908" width="420" height="147" /></a></p>
<p>You may see most recent stats at <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/stats.php" title="(394 hits)">http://unfake.it/stats.php</a>.</p>
<p>Please let me know, if you have any problems with the new version of the WordPress plugin and especially what you think about the facebook application.</p>
<p>Bye, T.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2009/08/unfakeit-now-with-facebook-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Highly sophisticated wakeup call using nagios</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2009/07/highly-sophisticated-wakeup-call-using-nagios/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2009/07/highly-sophisticated-wakeup-call-using-nagios/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 08:30:49 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[daily life]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[cellphone]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=3051</guid>
		<description><![CDATA[Hi there!

Do you know this problem?! You have to get [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there!</p>
<p><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/07/wecker.png" title="(180 hits)"><img class="size-full wp-image-3071 alignleft" title="wecker" src="http://www.thomasgericke.de/v4/interactive/blog/wp-content/uploads/2009/07/wecker.png" alt="wecker" width="150" height="300" /></a>Do you know this problem?! You have to get up at some certain time in the morning, so you set up your alarm clock to give you a friendly &#8220;rrrrrrring-rrrrring&#8221;. But you simply don&#8217;t wake up! Your alarm clock rings and rings and rings for like hours but you simply don&#8217;t hear it. Sometimes, you use the snooze button, but you cannot even remember you did it.</p>
<p>Well, that&#8217;s like how I feel sometimes in the morning. Bad thing, if you have some kind of meeting or appointment. Several times in the past, I sent automated e-mails to my co-workers to give me a wakeup call on my cellphone, this surprisingly always works. But it&#8217;s annoying. For me and my co-workers.</p>
<p><strong><span style="text-decoration: underline;">Here comes the solution:</span></strong></p>
<p><strong>use nagios to give you a highly sophisticated wakeup call.</strong></p>
<p>Imagine, you have a <strong>linux box</strong> which is under surveillance of a <strong>nagios remote monitoring system</strong>. And imagine furthermore, this nagios system is <strong>configured to send out voice calls</strong> in cases of critical states. All you need is a new plugin (most commonly via NRPE) which tells nagios to initiate your wakeup call.</p>
<p><span style="text-decoration: underline;">This is how I do it:</span></p>
<p>1. Add the following line to your NRPE config file on your linux box (e. g. <code>/etc/nagios/nrpe.cfg</code>):</p>
<pre class="brush: bash">command[wakeupcall]=/usr/lib/nagios/plugins/wakeupcall</pre>
<p>2. Create the plugin and place it on your linux box at <code>/usr/lib/nagios/plugins/wakeupcall</code></p>
<pre class="brush: bash">#!/bin/bash
#
# nagios nrpe plugin to initiate a wakeup call
# 2009, Thomas Gericke, thomas (at) thomasgericke (dot) de
#

FILE=&quot;/etc/wakeupcall/wakeupcall&quot;

if [ -e $FILE ]; then
        echo &quot;Wakeupcall needed. Gonna hit ya!&quot;
        exit 2
else
        echo &quot;No wakeupcall needed. Sleep well.&quot;
        exit 0
fi</pre>
<p>3. Restart your NRPE service on your linux box (e. g. <code>/etc/init.d/nagios-nrpe-server restart</code>)</p>
<p>4. Set up the service check in your nagios configuration on your nagios server</p>
<p>I assume, you already have the host configured on your nagios system and you already are familiar with nagios&#8217; notifications. Here&#8217;s the service check you need:</p>
<pre class="brush: bash">define service {
        use                     generic-service
        max_check_attempts      1
        notification_options    c
        service_description     Wakeup Call
        host_name               YOUR.HOST.NAME
        check_command           check_nrpe!wakeupcall
        contact_groups          YOUR_CONTACT_GROUP
}</pre>
<p>I hope you&#8217;re familiar with nagios&#8217; service check templates and such stuff.</p>
<p>5. Reload your nagios on your nagios server (e. g. <code>/etc/init.d/nagios reload</code>)</p>
<p>6. Create the wakeupcall config directory on your linux box (<code>mkdir /etc/wakeupcall/</code>)</p>
<p>7. Set up a file for an at-job on your linux box (e. g. <code>~/add.wakeupcall</code>)</p>
<pre class="brush: bash">touch /etc/wakeupcall/wakeupcall</pre>
<p>8. Set up an at-job on your linux box once you need to be woken up</p>
<pre class="brush: bash">at -f ~/add.wakeupcall 06:40</pre>
<p>Your linux box will create <code>/etc/wakeupcall/wakeupcall</code> <strong>at 6.40AM</strong> (the very next time this moment occurs), nagios will realize it and will initiate the notification. If you have configured your nagios server to send out voice calls to your cellphone, you will receive a <strong>wakeup call</strong>.</p>
<p>Have fun, comments are appreciated! <img src='http://www.thomasgericke.de/v4/interactive/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2009/07/highly-sophisticated-wakeup-call-using-nagios/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Twitter Tools patch</title>
		<link>http://www.thomasgericke.de/v4/interactive/blog/2009/02/twitter-tools-patch/</link>
		<comments>http://www.thomasgericke.de/v4/interactive/blog/2009/02/twitter-tools-patch/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 22:49:33 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[unfake]]></category>
		<category><![CDATA[unfake plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thomasgericke.de/v4/interactive/blog/?p=801</guid>
		<description><![CDATA[Hi there!

Lots of you may use WordPress as blog syst [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there!</p>
<p>Lots of you may use <code>WordPress</code> as blog system. Lots of you may also use a <code>Twitter account</code>. I guess, most of those people will use the famous <code>Twitter Tools</code> plugin by Alex King (<a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://alexking.org/" title="(264 hits)">http://alexking.org/</a>) to automatically notify Twitter about your new WordPress blog posts.</p>
<p><em>What happens while WordPress notifies Twitter?</em></p>
<p>Well, the Plugin sends a notification to your Twitter account and, of course, tweets the URL of your new post. Since this URL is usually very long, Twitter uses (for some reason) tinyurl.com to shorten this URL. And this is, what I really hated. <strong>Really hated!</strong></p>
<p>That&#8217;s the reason why I wrote the new <code>unfake.it-API</code>. Just as soon, as the API worked, I wrote a <code>very tiny and very simple WordPress plugin to enhance Twitter Tools</code>. The plugin tells the Twitter Tools plugin to shorten URLs using my <code>unfake.it-API</code> before sending the URL of the new post to Twitter.</p>
<p>The faked URL is short enough and Twitter doesn&#8217;t need to shorten it with tinyurl.com.</p>
<p style="padding-left: 30px;">Also see: <a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://unfake.it/help.php#twitter-tools" title="(296 hits)">http://unfake.it/help.php#twitter-tools</a></p>
<p>So, all of you using WordPress and Twitter, you may (and should <img src='http://www.thomasgericke.de/v4/interactive/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ) use this plugin.</p>
<ol>
<li><a href="http://www.thomasgericke.de/v4/interactive/blog/go.php?http://www.thomasgericke.de/tt_unfake_it.1.0.zip" title="(106 hits)">download the plugin here</a></li>
<li>expand the archive into your <tt>wp-content/plugins/</tt> directory.</li>
<li>create a folder named <tt>tt_unfake_it</tt> (should have happend automatically by unzipping the archive) in your <tt>wp-contents/plugins/</tt> directory.</li>
<li>put the <tt>tt_unfake_it.php</tt> file into the <tt>wp-content/plugins/tt_unfake_it/</tt> directory (should have happend automatically by unzipping the archive).</li>
<li>go to the Plugins page in your WordPress Administration area and click &#8216;Activate&#8217; for &#8216;unfake.it URL shortener for Twitter Tools&#8217;.</li>
<li>use WordPress as usual</li>
</ol>
<p><span style="font-family: verdana,arial,helvetica;">Of course, <strong><code>you have to check</code></strong> <em>&#8220;Notify Twitter about this post?&#8221;</em> at the bottom of the editing page when writing a new post!</span></p>
<p>That&#8217;s it <img src='http://www.thomasgericke.de/v4/interactive/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Once again: this is a plugin which depends on Twitter Tools by Alex King.</p>
<p>Have fun and please let me know, if you&#8217;re experiencing any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomasgericke.de/v4/interactive/blog/2009/02/twitter-tools-patch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

