<?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>logIt &#187; application</title>
	<atom:link href="https://lakm.us/logit/tag/application/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Get Commuter Train Trouble Alert Delivered to Watch by IFTTT</title>
		<link>https://lakm.us/logit/2015/01/commuter-train-trouble-alert-delivered-watch-ifttt/</link>
		<comments>https://lakm.us/logit/2015/01/commuter-train-trouble-alert-delivered-watch-ifttt/#comments</comments>
		<pubDate>Sat, 17 Jan 2015 14:31:02 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[job automation]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[socialmedia]]></category>
		<category><![CDATA[wearable]]></category>
		<category><![CDATA[web-based]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=803</guid>
		<description><![CDATA[Imagine getting alerts of Commuter Line train service disruption right on your wrist! Well, the watch thing isn&#8217;t a must as any SMS-enabled phone will do. But without the watch, I won&#8217;t be introduced to &#8220;If-this-than-that&#8221; (IFTTT), a simple logic line that glues popular apps into trigger and action branded as recipes. Anyone can code [...]]]></description>
				<content:encoded><![CDATA[<p>Imagine getting alerts of Commuter Line train service disruption right on your wrist! Well, the watch thing isn&#8217;t a must as any SMS-enabled phone will do. But without the watch, I won&#8217;t be introduced to <a href="http://techcrunch.com/2014/08/28/ifttt-lands-30-million-series-b-from-norwest-venture-partners-a16z/" title="IFTTT Lands $30 Million Series B From Norwest Venture Partners, A16Z" target="_blank">&#8220;If-this-than-that&#8221;</a> (IFTTT), a simple logic line that glues popular apps into trigger and action branded as <a href="https://ifttt.com/recipes" title="IFTTT - Browse Recipes" target="_blank">recipes</a>. Anyone can code that line, a no-coding logic that cooks: <a href="https://ifttt.com/recipes/184610-natgeo-instagrams-wallpaper" title="IFTTT - NatGeo Instagrams - Wallpaper" target="_blank">sync wallpaper with Nat Geo&#8217; instagram</a>, <a href="https://ifttt.com/recipes/168783-so-mom-doesn-t-call-too-many-times" title="IFTTT - So mom doesn't call too many times" target="_blank">volume goes up when Mom calls</a>, <a href="https://ifttt.com/recipes/165588-change-the-color-of-the-lights-when-the-space-station-flies-over-a-specific-location" title="IFTTT - Change the color of the lights when the Space Station flies over a specific location" target="_blank">change bulb light color after some space station moves</a>, etc. As personal recipe, bring <a href="https://www.kickstarter.com/projects/cuckoo/cookootm-the-watch-for-the-connected-generation" title="KickStarter - cookoo™ - the watch for the connected generation" target="_blank">COOKOO connected watch</a> to the table and I&#8217;ve leveraged public service disruption–no matter how ironic–into edgy personal business.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="" src="../../../../images/ifttt-commuter-line-trouble-notifications.png" title="If this than that recipes alert for Commuter Train trouble" width="450" height="211" /><p class="wp-caption-text">If this than that recipes alert for Commuter Train trouble</p></div>
<p>The ingredient is tweet, <a href="https://twitter.com/search" title="Twitter Search" target="_blank">Twitter Search</a> use case is no longer just sentiment analysis, its function extends to alert, even close to real time–I&#8217;m pretty optimistic given the number of Commuter Line users joining the conversation. Now, the no-code part of our recipe, a <a href="https://twitter.com/search?f=realtime&#038;q=%28to%3Akrlmania%20OR%20%40krlmania%20OR%20from%3ACommuterLine%29%20AND%20%28gangguan%20OR%20pantograf%20OR%20wesel%20OR%20patah%29%20-semoga%20-smoga%20-moga&#038;src=typd" title="Twitter Search - Commuter Line Trouble" target="_blank">Twitter search query</a>, that is</p>
<p><span id="more-803"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#40;</span>to:krlmania OR <span style="color: #000000; font-weight: bold;">@</span>krlmania OR from:CommuterLine<span style="color: #7a0874; font-weight: bold;">&#41;</span>
AND <span style="color: #7a0874; font-weight: bold;">&#40;</span>gangguan OR pantograf OR wesel OR patah<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #660033;">-semoga</span> <span style="color: #660033;">-smoga</span> <span style="color: #660033;">-moga</span></pre></div></div>

<p>and a brief explanation is that it queries for some keywords for potential trouble within mentions/replies to <a href="http://twitter.com/krlmania" title="@krlmania" target="_blank">@krlmania</a> and official announcements of <a href="http://twitter.com/CommuterLine" title="@CommuterLine" target="_blank">@CommuterLine</a>. Exclusion added to the search, the sentiment part of tweets, expressing wishes to shoo trouble away–I&#8217;m sorry, but keep praying online anyway.</p>
<p>When Twitter launched Twitter Stories in 2011, I read <a href="https://stories.twitter.com/en/ravi_pina.html" title="RAVI PINA shares train information through crowd sourcing and Twitter" target="_blank">about Ravi Pina</a> running the crowd sourced <a href="http://twitter.com/Caltrain" title="@Caltrain" target="_blank">@Caltrain</a>. Later now I see that official accounts like <a href="https://twitter.com/smrt_singapore" title="@SMRT_singapore" target="_blank">@SMRT_Singapore</a> is also a model of service disruption info center. We can go deeper to better stats from the API web service that shows real time position (<a href="https://play.google.com/store/apps/details?id=com.raia.infokrl&#038;hl=en" title="Google Play - Info KRL" target="_blank">an app is out there</a> showing that the location data API is working), but until its <a href="http://en.wikipedia.org/wiki/Open_data" title="Wikipedia - Open Data" target="_blank">open data</a> status is known, crowd sourcing stays as the most reliable solution, independent to regulation, and easiest to implement. Does the recipe work? During the first week of testing, alerts were flooding–within limit of course–as trouble really happened. So, cook your own ingredients or get my recipes served <a href="https://ifttt.com/p/bandono/shared" title="IFTTT - bandono" target="_blank">here</a>. </p>
<div class="wp-caption aligncenter" style="width: 460px"><iframe class="vine-embed" src="https://vine.co/v/OpU6LTOADvi/embed/simple" width="320" height="320" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script><p class="wp-caption-text">Train trouble alert on my watch</p></div>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2015/01/commuter-train-trouble-alert-delivered-watch-ifttt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile WiFi NAS on Raspberry Pi with TrueCrypt</title>
		<link>https://lakm.us/logit/2014/06/mobile-wifi-nas-raspberry-pi-truecrypt/</link>
		<comments>https://lakm.us/logit/2014/06/mobile-wifi-nas-raspberry-pi-truecrypt/#comments</comments>
		<pubDate>Sun, 01 Jun 2014 04:23:18 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[ARMv6]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[fuse]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=778</guid>
		<description><![CDATA[Mobile NAS sounds like an idea worth waiting for to run on my mini Raspberry Pi Model A. Unfortunately, it only took me a while, before abandoning it. I&#8217;ve waited since writing about Raspberry Pi USB problem, that is to finally cut the backfeeding power line from the el cheapo powered USB hub. There comes [...]]]></description>
				<content:encoded><![CDATA[<p>Mobile <a href="http://en.wikipedia.org/wiki/Network-attached_storage" target="_blank">NAS</a> sounds like an idea worth waiting for to run on my mini <a href="http://www.raspberrypi.org/tag/model-a/" target="_blank">Raspberry Pi Model A</a>. Unfortunately, it only took me a while, before abandoning it. I&#8217;ve waited since <a href="../../../2013/03/raspberry-pi-common-usb-problems/" title="Raspberry Pi Common USB Problems" target="_blank">writing about Raspberry Pi USB problem</a>, that is to <a href="https://flic.kr/p/kqopvk" title="Cutting backfeed from el cheapo USB hub to make friend with dual rating power bank &#038; Raspberry Pi" target="_blank">finally cut the backfeeding power line from the <em>el cheapo</em> powered USB hub</a>. There comes new problem afterward, my &#8220;big storage&#8221; ―a <a href="http://www.seagate.com/external-hard-drives/portable-hard-drives/standard/backup-plus/" title="Backup Plus Slim Portable Drive" target="_blank">Seagate® Backup Plus Slim Portable Drive</a>, shipped with no bulky power supply line― can&#8217;t be mounted. Silence soon follows rotating motor sound a while after plugging-in. I&#8217;ve tried both <a href="http://en.wikipedia.org/wiki/Ext3" target="_blank">ext3</a> and <a href="http://en.wikipedia.org/wiki/NTFS-3G" target="_blank">NTFS (using ntfs-3g)</a> without luck. Later, as benchmark whether it is USB power in question, I try to connect the same set of <em>el cheapo</em> USB hub plus external power to laptop, and it works, leaving me stranded with other issue (is it USB 3.0? 256MB of the Model A? Anything?). I must say that it isn&#8217;t completely not-working as the USB hub set can mount with <a href="http://www.ebay.co.uk/itm/Ritmo-R-Driver-III-USB-2-0-to-sata-Ide-cable-/221221820375" title="R-Driver III USB 2.0 to sata / Ide cable" target="_blank">USB to IDE converter</a> and my old internal hard disk (noting that there shouldn&#8217;t be similar power issue this way). If only it weren&#8217;t for the AC power adapter and large size, this is Mobile NAS; beats me.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Mobile NAS [Raspberry Pi hack] by aqila_rifti, on Flickr" src="https://farm6.staticflickr.com/5193/14317107955_73226c6432_n.jpg" title="Mobile NAS [Raspberry Pi hack] by aqila_rifti, on Flickr" width="320" height="320" /><p class="wp-caption-text">Battery power bank, WiFi USB stick, and thumb drive</p></div>
<p>I then turn away to motor-less small storage, a <a href="http://www.sandisk.com/products/usb/drives/cruzer-switch/" title="Sandisk Cruzer CZ52 " target="_blank">32 Gigs USB thumb drive</a> so I can move on to other concern: on-the-fly encryption. Hence, I follow <a href="http://kenfallon.com/truecrypt-on-a-respberry-pi-no-gui/" target="_blank">instructions to install True Crypt on Raspberry Pi</a>. After unpacking of <code>wxWidgets-2.8.12.tar.gz</code> and <code>TrueCrypt 7.1a Source.tar.gz</code> in place, putting header files from <code>pkcs-11-cryptoki2.20</code>, and then install <code>libfuse-dev</code>, the following <code>make</code> will require long time:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PKCS11_INC</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>truecrypt<span style="color: #000000; font-weight: bold;">/</span>pkcs<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">NOGUI</span>=<span style="color: #000000;">1</span> <span style="color: #007800;">WX_ROOT</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>wxWidgets wxbuild
Configuring wxWidgets library...
Building wxWidgets library...
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>wxWidgets<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>common<span style="color: #000000; font-weight: bold;">/</span>string.cpp:<span style="color: #000000;">84</span>:<span style="color: #000000;">39</span>: warning: ‘wxEmptyString’ initialized and declared ‘extern’ <span style="color: #7a0874; font-weight: bold;">&#91;</span>enabled by default<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p><span id="more-778"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">NOGUI</span>=<span style="color: #000000;">1</span> <span style="color: #007800;">WX_ROOT</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>wxWidgets wxbuild
Compiling Buffer.cpp
Compiling Exception.cpp
Compiling Event.cpp
...
..<span style="color: #000000; font-weight: bold;">/</span>Crypto<span style="color: #000000; font-weight: bold;">/</span>Aeskey.c:<span style="color: #000000;">527</span>:<span style="color: #000000;">25</span>: warning: operation on ‘ss<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>’ may be undefined <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wsequence-point<span style="color: #7a0874; font-weight: bold;">&#93;</span>
..<span style="color: #000000; font-weight: bold;">/</span>Crypto<span style="color: #000000; font-weight: bold;">/</span>Aeskey.c:<span style="color: #000000;">527</span>:<span style="color: #000000;">25</span>: warning: operation on ‘ss<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>’ may be undefined <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wsequence-point<span style="color: #7a0874; font-weight: bold;">&#93;</span>
..<span style="color: #000000; font-weight: bold;">/</span>Crypto<span style="color: #000000; font-weight: bold;">/</span>Aeskey.c:<span style="color: #000000;">527</span>:<span style="color: #000000;">25</span>: warning: operation on ‘ss<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>’ may be undefined <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wsequence-point<span style="color: #7a0874; font-weight: bold;">&#93;</span>
...
Converting Language.xml
Compiling Resources.cpp
Linking truecrypt</pre></div></div>

<p>I created the TrueCrypt volume separately via its desktop GUI with <code>ext3</code> file system to then mount it in Pi to a configured <a href="http://en.wikipedia.org/wiki/Samba_(software)" target="_blank">Samba share</a>. As pointed out in <a href="http://raspberrywebserver.com/serveradmin/share-your-raspberry-pis-files-and-folders-across-a-network.html" target="_blank">a post</a>, the following changes are added to <code>smb.conf</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">...
wins support = <span style="color: #c20cb9; font-weight: bold;">yes</span>
...
<span style="color: #7a0874; font-weight: bold;">&#91;</span>pitruecrypt<span style="color: #7a0874; font-weight: bold;">&#93;</span>
   <span style="color: #007800;">comment</span>= Pi Truecrypt Volume
   <span style="color: #007800;">path</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>the <span style="color: #c20cb9; font-weight: bold;">mount</span> path of the USB thumb drive TrueCrypt volume<span style="color: #000000; font-weight: bold;">&gt;</span>
   <span style="color: #007800;">browseable</span>=Yes
   <span style="color: #007800;">writeable</span>=Yes
   only <span style="color: #007800;">guest</span>=no
   create <span style="color: #007800;">mask</span>=0777
   directory <span style="color: #007800;">mask</span>=0777
   <span style="color: #007800;">public</span>=no</pre></div></div>

<p>and then user-password are entered via interactive command.</p>
<p>For mobility, I already had the Pi as WiFi access point using <code><a href="hostap.epitest.fi/hostapd/" target="_blank">hostapd</a></code> (check <a href="http://sirlagz.net/2012/08/09/how-to-use-the-raspberry-pi-as-a-wireless-access-pointrouter-part-1/" target="_blank">these steps</a>) and <a href="http://www.amazon.com/HAME-10400mAh-Double-Indicators-Capacity/dp/B00B5OFC5I" target="_blank">power bank</a>, so it&#8217;s now matter of performance. In the case of <code><a href="http://www.samba.org/rsync/" target="_blank">rsync</a></code>, initial sync of some 1,500 items totaling in 1 Gig size elapses in approximately the same 12 minutes of time compared to one bulk file of the same size. Of course, over the next incremental sync, it only takes less than a minute for the thousand items to just update slight differences.</p>
<h3>Security</h3>
<p>Back to security, there surely risk by opening Samba share to mounted TrueCrypt volume. But, for me it would be practically manageable (cross my finger). There is more concern to the fate of <a href="http://truecrypt.sourceforge.net/" target="_blank">TrueCrypt</a> after it is being closed in such a weird way, given that <a href="https://opencryptoaudit.org/reports/iSec_Final_Open_Crypto_Audit_Project_TrueCrypt_Security_Assessment.pdf" target="_blank">last audit</a> finds nothing severe. Anyway, I found brute force tool, but no critical attack exists currently, unless e.g. it stays powered on and mounted, the person gain physical access. Beats me again.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2014/06/mobile-wifi-nas-raspberry-pi-truecrypt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Any m-by-n Matrix Keypad for Raspberry Pi</title>
		<link>https://lakm.us/logit/2014/02/any-m-x-n-matrix-keypad-raspberry-pi/</link>
		<comments>https://lakm.us/logit/2014/02/any-m-x-n-matrix-keypad-raspberry-pi/#comments</comments>
		<pubDate>Sat, 08 Feb 2014 18:30:57 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[GPIO]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Raspberry Pi]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=746</guid>
		<description><![CDATA[What about instantiating any m x n matrix keypad by a Python class? Raspberry Pi takes me to learn how to build a Python class for the first time while expanding my initial WiringPi-based matrix keypad into a derivative work. A matrix keypad instance is defined by: Actual GPIO pins used forming the row and [...]]]></description>
				<content:encoded><![CDATA[<p>What about instantiating any m x n matrix keypad by a <a href="http://docs.python.org/2/tutorial/classes.html" title="Python Classes" target="_blank">Python class</a>? <a href="http://www.raspberrypi.org/" target="_blank">Raspberry Pi</a> takes me to learn how to build a Python class for the first time while expanding my initial <a href="../../2013/03/raspberry-pi-membrane-matrix-keypad-gpio-input-2/" title="Raspberry Pi: Membrane (Matrix) Keypad as GPIO Input" target="_blank">WiringPi-based matrix keypad</a> into a derivative work.</p>
<p>A matrix keypad instance is defined by:</p>
<ol>
<li>Actual GPIO pins used forming the row and column of the m x n matrix</li>
<li>Individual character in-use as symbol for each button</li>
</ol>
<p>Hence, I instantiate and call method like</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">...
<span style="color: black;">QPad</span>  = matrixQPi<span style="color: black;">&#40;</span>keyPad=keyPad,row=row,col=col<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> QPad.<span style="color: black;">scanQ</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>to print the character being pressed. Some examples pushed to <a href="https://github.com/bandono/matrixQPi/tree/v2.0" title="Github: matrixQPi v2.0" target="_blank">my github</a> explains how the above <code>keyPad</code>, <code>row</code>, and <code>col</code> are defined to scan-read pressed button of 2&#215;2, 2&#215;3, and 4&#215;3 matrix keypads <time datetime="2014-02-23">(or have it 3&#215;4 matrix keypads in other words)</time>.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Illustration of any m-by-n matrix: 4x3, 2x2, and 2x3 keypad with different button symbols &#038; GPIO combinations" src="../../../../images/any-mxn-matrix-keypad-raspberry-pi.png" title="Illustration of any m-by-n matrix: 4x3, 2x2, and 2x3 keypad with different button symbols &#038; GPIO combinations" width="368" height="264" /><p class="wp-caption-text">Illustration of any m-by-n matrix: 4x3, 2x2, and 2x3 keypad with different button symbols &#038; GPIO combinations</p></div>
<p>I used deprecated <a href="https://github.com/WiringPi/WiringPi-Python" title="WiringPi-Python" target="_blank">Wiring-Pi Python</a> (they already moved to <a href="https://github.com/WiringPi/WiringPi2-Python" title="WiringPi2-Python" target="_blank">2.x version</a>) without problem. However, you&#8217;ll fail building from latest commit and must use combination of older commits as described by my updated part of <a href="../../2013/03/raspberry-pi-gpio-input-button-basics-1/" title="Raspberry Pi GPIO Input Button Basics" target="_blank">an old-post</a>. By the way, there&#8217;s I/O expander support for <a href="https://github.com/WiringPi/WiringPi2-Python" title="WiringPi2-Python" target="_blank">WiringPi2-Python</a> which is good, considering:</p>
<blockquote><p>GPIO is expensive and for the sake of a keypad, you should not spend all.</p></blockquote>
<p>(A friend told me that once)</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2014/02/any-m-x-n-matrix-keypad-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Raddle (2): snmpd &amp; Replay Custom Private Enterprise MIB</title>
		<link>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/</link>
		<comments>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 03:13:44 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=217</guid>
		<description><![CDATA[Net-SNMP wiki gives tutorial on extending snmpd using Perl. In basic run of Raddle (previous post) this involves r1.pl called by r1.conf fed to snmpd. Private enterprise MIB i.e. Microchip&#8217;s in this example can be replayed without really ever captured the real device&#8217;s SNMP data. This is necessary when the actual device is yet existed; normal [...]]]></description>
				<content:encoded><![CDATA[<p>Net-SNMP wiki gives tutorial on 	<a href="http://www.net-snmp.org/wiki/index.php/Tut:Extending_snmpd_using_perl">extending <code>snmpd</code> using Perl</a>. In basic run of Raddle (<a href="./215/running-raddle-in-rhel/">previous post</a>) this involves <code>r1.pl</code> called by <code>r1.conf</code> fed to <code>snmpd</code>. Private enterprise MIB i.e. <a href="http://read.pudn.com/downloads133/sourcecode/embed/567121/TCPIP%20Demo%20App/mchip.mib__.htm" target="_blank">Microchip&#8217;s </a>in this example can be replayed without really ever captured the real device&#8217;s SNMP data. This is necessary when the actual device is yet existed; normal situation when developing.  There are two simple ways of replaying this artificial SNMP data over which either way requires correct OID.</p>
<p>First put the <code>Microchip.TXT</code> (the MIB file) under <code>/usr/share/snmp/mibs</code> to easily exchange OID canonical form and name vice versa while making dummy. In this case I&#8217;ve modify the MIB to have some additional object i.e. <code>name</code>:<br />
<code>$ snmptranslate -m +Microchip -On Microchip::name<br />
.1.3.6.1.4.1.17095.1.1</code><br />
so we can then use this correct OID for our dummy.</p>
<p>How?</p>
<ol>
<li>use <code>SetMIBValue()</code> in <code>r1.pl</code>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">SetMIBValue</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'.1.3.6.1.4.1.17095.1.1'</span><span style="color: #339933;">,</span> ASN_OCTET_STR<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Microchip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">SetMIBValue</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'.1.3.6.1.4.1.17095.3.13'</span><span style="color: #339933;">,</span> ASN_INTEGER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">82</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Feed <code>r1.snmp </code>for playing as in

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #0000ff;">$agent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">ParseDataFile</span><span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">'/usr/local/etc/snmp-emulator/r1.snmp'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span></pre></div></div>

<p>with the content of</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.1.3.6.1.4.1.17095.1.1 = STRING: Microchip
.1.3.6.1.4.1.17095.3.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

</li>
</ol>
<p>In all above two examples we can only <code>GET</code> for Raddle to return an answer for each OID. <code>GETNEXT</code> as in bulk <code>snmpwalk</code> won&#8217;t give output because they are not sequenced.</p>
<p>A sample of sequenced data inside a real <code>snmpwalk</code> dump is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpwalk <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public <span style="color: #660033;">-On</span> localhost
&nbsp;
.1.3.6.1.2.1.1.1.0 = STRING: Linux xp-racy 2.6.38-<span style="color: #000000;">10</span>-generic <span style="color: #666666; font-style: italic;">#46~lucid1-Ubuntu SMP Wed Jul 6 18:40:11 UTC 2011 i686</span>
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">496371</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1</span>:<span style="color: #000000;">22</span>:<span style="color: #000000;">43.71</span>
.1.3.6.1.2.1.1.4.0 = STRING: Root  <span style="color: #7a0874; font-weight: bold;">&#40;</span>configure <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp<span style="color: #000000; font-weight: bold;">/</span>snmpd.local.conf<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.1.3.6.1.2.1.1.5.0 = STRING:
.1.3.6.1.2.1.1.6.0 = STRING: Unknown <span style="color: #7a0874; font-weight: bold;">&#40;</span>configure <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp<span style="color: #000000; font-weight: bold;">/</span>snmpd.local.conf<span style="color: #7a0874; font-weight: bold;">&#41;</span>
.1.3.6.1.2.1.1.8.0 = Timeticks: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">0</span>:00:<span style="color: #000000;">00.00</span>
.1.3.6.1.2.1.1.9.1.2.1 = OID: .1.3.6.1.6.3.10.3.1.1
.1.3.6.1.2.1.1.9.1.2.2 = OID: .1.3.6.1.6.3.11.3.1.1</pre></div></div>

<p>thus, we can only</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpget <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public localhost Microchip::control.13
Microchip::control.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

<p>or from other system with no Microchip MIB use</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpget <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-c</span> public 192.168.40.105 .1.3.6.1.4.1.17095.3.13
SNMPv2-SMI::enterprises.17095.3.13 = INTEGER: <span style="color: #000000;">82</span></pre></div></div>

<p>The tree below may visually explains sequenced data for <code>GETNEXT</code> where our Microchip is branched at <code>private.enterprises.microchip</code> :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmptranslate <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-Tp</span>
&nbsp;
+--iso<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #000000; font-weight: bold;">|</span>
   +--org<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
      <span style="color: #000000; font-weight: bold;">|</span>
      +--dod<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
         <span style="color: #000000; font-weight: bold;">|</span>
         +--internet<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>
            +--directory<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>
            +--mgmt<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>  +--mib-<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>     +--system<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
...
            +--private<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>  +--enterprises<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>     <span style="color: #000000; font-weight: bold;">|</span>
...
            <span style="color: #000000; font-weight: bold;">|</span>     +--microchip<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">17095</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>
            <span style="color: #000000; font-weight: bold;">|</span>        +--product<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">|</span>        <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000; font-weight: bold;">|</span></pre></div></div>

<p>How <code>GET</code> and <code>GETNEXT</code> appeared in SNMP can be viewed by running snmpd in debug mode with this options:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpd <span style="color: #660033;">-m</span> +Microchip <span style="color: #660033;">-f</span> <span style="color: #660033;">-L</span> <span style="color: #660033;">-V</span> <span style="color: #660033;">-C</span> <span style="color: #660033;">-I</span> vacm_vars <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>snmp-emulator<span style="color: #000000; font-weight: bold;">/</span>r1.conf
NET-SNMP version 5.3.1
Connection from UDP: <span style="color: #7a0874; font-weight: bold;">&#91;</span>127.0.0.1<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">32770</span>
Received SNMP packet<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> from UDP: <span style="color: #7a0874; font-weight: bold;">&#91;</span>127.0.0.1<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">32770</span>
  GET message
    <span style="color: #660033;">--</span> control.13</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/08/running-raddle-2-snmpd-replay-custom-private-enterprise-mib/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Raddle in RHEL</title>
		<link>https://lakm.us/logit/2011/08/running-raddle-in-rhel/</link>
		<comments>https://lakm.us/logit/2011/08/running-raddle-in-rhel/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 07:43:05 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[install-deinstall]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=215</guid>
		<description><![CDATA[Raddle is a great SNMP player written in Perl. I say player to this emulator application, meaning that I can append or dump snmpwalk output from a device and then replay that from Raddle. Installing it can be both simple and tedious tasks. I used Red Hat Enterprise Linux 5.2 inside a virtual machine (VirtualBox) [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://raddle.sourceforge.net/" target="_blank">Raddle</a> is a great SNMP player written in Perl. I say player to this emulator application, meaning that I can append or dump <code>snmpwalk</code> output from a device and then replay that from Raddle. Installing it can be both simple and tedious tasks. I used Red Hat Enterprise Linux 5.2 inside  a virtual machine (VirtualBox) to make it compact without interfering my own host <code>snmpd</code> setting.</p>
<p>net-SNMP packages are required for Raddle to work on top of primarily <code>snmpd</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> net-snmp net-snmp-utils</pre></div></div>

<p>Prior to installation some rpm packages must be downloaded separately as my local repo (created from original RHEL CD images) may not contain them. They are installed as follow:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-i</span> perl-Carp-Clan-<span style="color: #000000;">6.00</span>-1.el4.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Bit-Vector-<span style="color: #000000;">6.4</span>-2.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Crypt-DES-<span style="color: #000000;">2.05</span>-3.2.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Digest-SHA1-<span style="color: #000000;">2.11</span>-1.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Digest-HMAC-<span style="color: #000000;">1.01</span>-2.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Socket6-<span style="color: #000000;">0.20</span>-1.el5.rf.i386.rpm
rpm <span style="color: #660033;">-i</span> perl-Net-SNMP-5.2.0-1.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Date-Pcalc-<span style="color: #000000;">1.2</span>-1.2.el5.rf.noarch.rpm
rpm <span style="color: #660033;">-i</span> perl-Date-Calc-<span style="color: #000000;">5.4</span>-1.el5.rf.i386.rpm</pre></div></div>

<p>continued by installing <code>net-snmp-perl</code> from original repo</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> net-snmp-perl</pre></div></div>

<p>Uncompressing Raddle and successful <code>make test</code> will mean installation is good and can be finished by <code>make install</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> Net-Raddle-<span style="color: #000000;">0.08</span>
<span style="color: #c20cb9; font-weight: bold;">perl</span> Makefile.PL
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #7a0874; font-weight: bold;">test</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<h1>Replaying SNMP Packets</h1>
<p>The idea is to run <code>snmpd</code> which replays a specific prepared-SNMP-packets instead of our own real time system SNMP data (in this case the condition of RHEL 5.2 host). There are three files to do that, let&#8217;s name them <code>r1.*</code>:</p>
<ol>
<li><code>r1.snmp</code><br />
A capture from i.e.<br />
<code>snmpwalk -v 1 -c &lt;community string&gt; -OneU &lt;device&gt; &gt; r1.snmp</code></li>
<li><code>r1.conf</code><br />
<code>snmpd</code> will run this instead of the original OS default:<br />
<code>snmpd -C -I vacm_vars -c /usr/local/etc/snmp-emulator/r1.conf</code></li>
<li><code>r1.pl</code><br />
the perl script where the most basic is to just replay the above <code>r1.snmp</code></li>
</ol>
<p>An official documentation to replay SNMP can be found <a href="http://raddle.sourceforge.net/docs/SNMPAgent.html" target="_blank">here</a>. I got hold back when trying to listen from other host, it turns out that I must remove the localhost section in <code>r1.conf</code> which will make it to use standard port 161 as well</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Listen on port 9501</span>
<span style="color: #666666; font-style: italic;">#agentaddress    udp:localhost:9501,tcp:localhost:9501</span></pre></div></div>

<p>It is also wise to always cut the <code>r1.snmp</code> first to see if the perl works (test with <code>perl -w /usr/local/etc/snmp-emulator/r1.pl</code>) either with warning or clean, meaning no problem with just some of the OIDs found inside the file.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/08/running-raddle-in-rhel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>URL Shortener From Yourls (1)</title>
		<link>https://lakm.us/logit/2010/05/url-shortener-from-yourls-1/</link>
		<comments>https://lakm.us/logit/2010/05/url-shortener-from-yourls-1/#comments</comments>
		<pubDate>Tue, 04 May 2010 08:33:25 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[url-shortener]]></category>
		<category><![CDATA[web-based]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/it/?p=203</guid>
		<description><![CDATA[We can self-hosted URL Shortener service. I tried open source php-based URLShort and Yourls. I later choose Yourls. Both of course based on .htaccess manipulation (mod_rewrite of Apache must be enabled). I install Yourls in side http://my.web/somedir. To make my short URL to use something like http://my.web/xGf12 instead of http://my.web/somedir/xGf12, I run the regular install [...]]]></description>
				<content:encoded><![CDATA[<p>We can self-hosted URL Shortener service. I tried open source php-based <a href="http://mavrev.org/urlshort/">URLShort</a> and <a href="http://yourls.org">Yourls</a>. I later choose Yourls.</p>
<p>Both of course based on <code>.htaccess</code> manipulation (<code>mod_rewrite</code> of Apache must be enabled). I install Yourls in side <code>http://my.web/somedir</code>. To make my short URL to use something like <code>http://my.web/xGf12</code> instead of <code>http://my.web/<strong>somedir/xGf12</strong></code>, I run the regular install with that somedir as based URL, but then create <code>.htaccess</code> in <code>http://my.web/.htaccess</code> (instead of <code>http://my.web/<strong>somedir/.htaccess</strong></code>) However, I intend to use prefix <code>x</code> for the shorten URL. Here is how the regular expression implemented:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># BEGIN YOURLS</span>
&nbsp;
RewriteEngine On
RewriteBase <span style="color: #000000; font-weight: bold;">/</span>somedir<span style="color: #000000; font-weight: bold;">/</span>
RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>REQUEST_FILENAME<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">!</span>-f
RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>REQUEST_FILENAME<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">!</span>-d
RewriteRule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>x<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span>-9A-Za-z<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>?$ <span style="color: #000000; font-weight: bold;">/</span>somedir<span style="color: #000000; font-weight: bold;">/</span>yourls-go.php?<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">id</span></span>=$<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>L<span style="color: #7a0874; font-weight: bold;">&#93;</span>
RewriteRule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>x<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span>-9A-Za-z<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>\+<span style="color: #000000; font-weight: bold;">/</span>?$ <span style="color: #000000; font-weight: bold;">/</span>somedir<span style="color: #000000; font-weight: bold;">/</span>yourls-infos.php?<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">id</span></span>=$<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>L<span style="color: #7a0874; font-weight: bold;">&#93;</span>
RewriteRule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>x<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span>-9A-Za-z<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>\+all<span style="color: #000000; font-weight: bold;">/</span>?$ <span style="color: #000000; font-weight: bold;">/</span>somedir<span style="color: #000000; font-weight: bold;">/</span>yourls-infos.php?<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">id</span></span>=$<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #007800;">all</span>=<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>L<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># END YOURLS</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2010/05/url-shortener-from-yourls-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Nagios 3 and Plugins</title>
		<link>https://lakm.us/logit/2009/10/install-nagios-3-and-plugins/</link>
		<comments>https://lakm.us/logit/2009/10/install-nagios-3-and-plugins/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 05:48:46 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[make-install]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[web-based]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=95</guid>
		<description><![CDATA[Quickstart I decided to install in RedHat 5.2. Maybe it is easier in Ubuntu (Nagios 3 already listed in the repository, but I haven&#8217;t tried it). As pointed out by the quickstart (it is meant for Fedora by the way), requirements are: php, httpd gcc, glibc, glibc-common gd, gd-devel After getting those, the configure-make-install procedure [...]]]></description>
				<content:encoded><![CDATA[<h3>Quickstart</h3>
<p>I decided to install in RedHat 5.2. Maybe it is easier in Ubuntu (Nagios 3 already listed in the repository, but I haven&#8217;t tried it). As pointed out by the quickstart (it is meant for Fedora by the way), requirements are:</p>
<ol>
<li><span style="background-color: #ffffff;">php, httpd </span></li>
<li><span style="background-color: #ffffff;">gcc, glibc, glibc-common</span></li>
<li><span style="background-color: #ffffff;">gd, gd-devel</span></li>
</ol>
<p>After getting those, the <code>configure-make-install</code> procedure runs well, except that I don&#8217;t check the warnings. It turns out that only some of Nagios core components are installed. It can be seen from the content of <code>/usr/local/nagios/libexec</code> directory. There is no <code>check_snmp</code> etc. Error also appears in statusmap page of Nagios.</p>
<h3>Compile More Nagios Core Components</h3>
<p>I run through <code>./configure</code> once more, check out all warnings, and begin to evaluate <strong>requirements</strong> (found this text inside <code>nagios-plugins-1.4.14</code> tarball)</p>
<h4>MySQL</h4>
<p>For <code>check_mysql</code> functionality, <code>mysql</code> (MySQL client for linux) must be installed. <code>./configure</code> also test this client, by default config, to the local MySQL socket, hence <code>mysql-server</code> must also exist.</p>
<h4>Radius Client</h4>
<p>Client from freeradius package doesn&#8217;t meet Nagios requirements. It must be the ones from original radiusclient, I found RPMs for  <code>radiusclient-0.3.2-0.2.el5.rf.i386.rpm</code> and <code>radiusclient-devel-0.3.2-0.2.el5.rf.i386.rpm</code>.</p>
<h4>GD</h4>
<p>It is quite tricky to get <code>statusmap.c</code> to be compiled for the <code>.cgi</code> of Nagios status map. Compilation needs <code>gd</code> library from <a href="http://www.libgd.org/">http://www.libgd.org/</a>. <code>gd</code> requires <code>zlib</code>, <code>libjpeg</code>, and <code>libpng</code>. On first attempt, I installed from RPMs. This appeared to be not working as I could still see warnings about <code>gd2</code> during .<code>/configure</code>.</p>
<p>So, I choose to compile from the source <code>gd-2.0.33.tar.bz2</code>. This tarball was found in the older section of current <code>gd2</code> web. I chose this version because the RPM used was <code>gd-2.0.33-9.4.el5_1.1.rpm</code>. I removed this RPM first which made me to remove also <code>libmwf</code> and <code>ImageMagick</code>.</p>
<p>After straightforward  <code>configure-make-install</code> the library will be installed under <code>/usr/local/lib</code> i.e <code>libgd.so.2.0.0</code>. Header files will also be available in /<code>usr/local/include</code> i.e <code>gd.h</code>. These are different from the situation when I installed from RPM where <code>libgd.so.2.0.0</code> is under <code>/usr/lib/</code> and no <code>gd.h</code> found under <code>/usr/include</code>.</p>
<p>So, I <code>make devclean</code> and rerun</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-gd-lib</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">--with-gd-inc</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">--with-command-group</span>=nagcmd</pre></div></div>

<p>I configure the /usr/local/nagios/etc/cgi.conf but status map page is still empty. Next workaround is to install back  <code>gd-2.0.33-9.4.el5_1.1.rpm</code>. (which also bring back <code>libmwf</code> and <code>ImageMagick</code>) and point the <code>gd</code> library to the ones created from RPM. I <code>make devclean</code> and rerun:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-gd-lib</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">--with-gd-inc</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">--with-command-group</span>=nagcmd</pre></div></div>

<p>At this point I regret not to have Ubuntu implementation in the first place. Just a small regret.</p>
<p>Other library needed for <code>check_smtp</code>, <code>check_http</code>, etc. don&#8217;t seem to trouble me much, I need <code>openssl</code>, <code>openldap</code>, etc. and simply get them from RPMs.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/10/install-nagios-3-and-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hijri Calendar</title>
		<link>https://lakm.us/logit/2009/09/hijri-calendar/</link>
		<comments>https://lakm.us/logit/2009/09/hijri-calendar/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 07:29:53 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[install-deinstall]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=86</guid>
		<description><![CDATA[Not succeding to find Hijri Calendar in Synaptic, I go for http://www.ojuba.org/wiki/hijra/. First, let Google translate does the job. Secondly, install this python applet. Inside hijra-0.1.18 run $ sudo python setup.py install It&#8217;d fail as it couldn&#8217;t find HijriApplet. Rename HijriApplet.py to HijriApplet to make it work. Now, it is in path (/usr/bin/) and can [...]]]></description>
				<content:encoded><![CDATA[<p>Not succeding to find Hijri Calendar in Synaptic, I go for <a title="http://www.ojuba.org/wiki/hijra" href="http://www.ojuba.org/wiki/hijra" target="_blank">http://www.ojuba.org/wiki/hijra/</a>. First, let Google translate does the job. Secondly, install this python applet.</p>
<p>Inside hijra-0.1.18 run <code>$ sudo python setup.py install</code></p>
<p>It&#8217;d fail as it couldn&#8217;t find <code>HijriApplet</code>. Rename <code>HijriApplet.py</code> to <code>HijriApplet</code> to make it work. Now, it is in path (<code>/usr/bin/</code>) and can be called by <code>HijriApplet</code> command. We can copy <code>hijra-autostart.desktop</code> description to i.e. <code>~/.gnome2/panel2.d/default/launchers</code> for shortcut launcher.</p>
<p><code>python-gnome2-extras</code> must be installed or else it&#8217;d fail to launch saying can&#8217;t find <code>egg.trayicon</code></p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/09/hijri-calendar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tagsistant (1)</title>
		<link>https://lakm.us/logit/2009/09/tagsistant-1/</link>
		<comments>https://lakm.us/logit/2009/09/tagsistant-1/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 06:09:59 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[fuse]]></category>
		<category><![CDATA[install-deinstall]]></category>
		<category><![CDATA[make-install]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=82</guid>
		<description><![CDATA[Installation of tagsistant requires SQLite and FUSE, in Ubuntu they are satisfied as libsqlite3-dev and libfuse-dev (which will also requires libselinux1-dev and libsepol1-dev). A series of configure, make, and make-install will fail during the make-install. /usr/local/share/pixmaps must be created first before running $ sudo make install After that I test tagsistant to organize /data/tags/ $ [...]]]></description>
				<content:encoded><![CDATA[<p>Installation of <strong>tagsistant</strong> requires SQLite and FUSE, in Ubuntu they are satisfied as libsqlite3-dev and libfuse-dev (which will also requires libselinux1-dev and libsepol1-dev). A series of configure, make, and make-install will fail during the make-install. <code>/usr/local/share/pixmaps</code> must be created first before running</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>After that I test tagsistant to organize <code>/data/tags/</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ tagsistant <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>tags</pre></div></div>

<p>The tagging works as expected but not too handy since no browser GUI is embedded. It is just like browsing through multiple OR and AND folders.</p>
<p>The installation process will also install <strong>tagman</strong> (a tag manager GUI) if <code>libgtk2.0-dev</code> and <code>libglib2.0-dev</code> are installed.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/09/tagsistant-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring Cacti</title>
		<link>https://lakm.us/logit/2009/09/configuring-cacti/</link>
		<comments>https://lakm.us/logit/2009/09/configuring-cacti/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 05:55:04 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[Cacti]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[RRDtool]]></category>
		<category><![CDATA[snmp]]></category>
		<category><![CDATA[web-based]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=77</guid>
		<description><![CDATA[A successful installation in a LAMP system may require more library. I added php5-cli to enable php through command line i.e $ /usr/bin/php , libphp-adodb, php5-snmp. In localhost snmpd is installed and configured /etc/default/snmpd: SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid' and edit /etc/snmp/snmpd.conf to have: com2sec readonly  localhost         &#60;some community string&#62; Install [...]]]></description>
				<content:encoded><![CDATA[<p>A successful installation in a LAMP system may require more library. I added php5-cli to enable php through command line i.e <code>$ /usr/bin/php <some_command></code>, libphp-adodb, php5-snmp.</p>
<p>In localhost <code>snmpd</code> is installed and configured <code>/etc/default/snmpd</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SNMPDOPTS</span>=<span style="color: #ff0000;">'-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid'</span></pre></div></div>

<p>and edit <code>/etc/snmp/snmpd.conf</code> to have:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">com2sec <span style="color: #7a0874; font-weight: bold;">readonly</span>  localhost         <span style="color: #000000; font-weight: bold;">&lt;</span>some community string<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Install <code>snmp</code>, then I can test <code>snmpwalk</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ snmpwalk <span style="color: #660033;">-Os</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&lt;</span>some community string<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-v</span> <span style="color: #000000;">1</span> localhost system</pre></div></div>

<p>Cacti requires RRDTool and the correct version to be set in Settings menu of the Cacti web console. In my case, RRDTool version is 1.3x. In Cacti 0.8.6.x and above <code>poller.php</code> is called by cron instead of <code>cmd.php</code>, put this trough crontab in Cacti user (enter this Cacti user crontab from <code>crontab -e -u <some Cacti user></code> or embed the user in crontab by root instead of individually edited).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>cacti<span style="color: #000000; font-weight: bold;">/</span>poller.php</pre></div></div>

<p>It will generate file under <code>rra</code> directory of the web <code>/var/www/cacti/rra/<some file>.rrd</code>. RRD tool will create image based on this polling result file.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/09/configuring-cacti/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
