<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en" xml:base="http://www.miljan.org/main/wp-atom.php">
	<title type="text">Miljan Karadzic</title>
	<subtitle type="text">Wisdom is the key</subtitle>

	<updated>2009-11-30T22:28:21Z</updated>
	<generator uri="http://wordpress.org/" version="2.8.6">WordPress</generator>

	<link rel="alternate" type="text/html" href="http://www.miljan.org/main" />
	<id>http://www.miljan.org/main/feed/atom/</id>
	

			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/miljanorg" /><feedburner:info uri="miljanorg" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmiljanorg" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmiljanorg" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmiljanorg" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/miljanorg" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmiljanorg" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fmiljanorg" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmiljanorg" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[PS1 for your Shell?]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/RUHj1LXweeQ/" />
		<id>http://www.miljan.org/main/?p=123</id>
		<updated>2009-11-30T22:28:21Z</updated>
		<published>2009-11-30T22:22:42Z</published>
		<category scheme="http://www.miljan.org/main" term="General" /><category scheme="http://www.miljan.org/main" term="Linux" /><category scheme="http://www.miljan.org/main" term="Shell" /><category scheme="http://www.miljan.org/main" term="UNIX" />		<summary type="html"><![CDATA[Few years ago I went on a quest to find a perfect shell prompt. I asked the mighty Internets for ideas, but it seemed futile. I tried many things, simple prompts, complex prompts, but nothing could satisfy my requirements (I don't even remember what were my requirements back then.) So I picked best of both [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2009/11/30/ps1-for-your-shell/"><![CDATA[Few years ago I went on a quest to find a perfect shell prompt. I asked the mighty Internets for ideas, but it seemed futile. I tried many things, simple prompts, complex prompts, but nothing could satisfy my requirements (I don't even remember what were my requirements back then.) So I picked best of both worlds and got this little monster.

<p class="code">:) oscar:~# </p>

Happy face! And in case of an error, it looks sad.

<p class="code">:( 2 oscar:~# </p>

Cute, a? It even prints the exit code. Useful and cute at the same time!

And here is definition of the prompt. As you can see it uses simple function to determine return code of executed command and adjust its feelings accordingly.

<p class="code">smiley() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;RC=$?<br />
&nbsp;&nbsp;&nbsp;&nbsp;[[ ${RC} == 0 ]] &#038;& echo ':)' || echo ":( ${RC}"<br />
}<br />
export PS1="\$(smiley) \u@\h:\w\\$ "</p>

I think I got the idea for the smiley thing somewhere, but unfortunately I don't remember anymore where from.<br />

For more adventurous people, maybe this prompt would be more interesting.<br />

<p class="code">export PS1="\[\033[0;36m\]\033(0l\033(B\[\033[0m\][\[\033[1;31m\]\u\[\033[0m\]]\[\033[0;36m\]\033(0q\033(B\[\033[0m\][\[\033[1;33m\]@\h\[\033[0m\]]\[\033[0;36m\]\033(0q\033(B\[\033[0m\][\[\033[0;37m\]\T\[\033[0m\]]\[\033[0;36m\]\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\033(0q\033(B\[\033[0m\][\[\033[1;33m\]\w\[\033[0m\]]\n\[\033[0;36m\]\033(0m\033(B\[\033[0m\]\$ "</p>

Magic! :)<br />
<br />
What is your favorite prompt? Please leave boring \u@\h:\w for dinner with your parents. :P]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2009/11/30/ps1-for-your-shell/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2009/11/30/ps1-for-your-shell/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2009/11/30/ps1-for-your-shell/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[Load Average &gt; 680]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/kGx9meLthX0/" />
		<id>http://www.miljan.org/main/?p=103</id>
		<updated>2009-11-23T09:15:57Z</updated>
		<published>2009-11-23T09:15:57Z</published>
		<category scheme="http://www.miljan.org/main" term="General" /><category scheme="http://www.miljan.org/main" term="Linux" /><category scheme="http://www.miljan.org/main" term="News" />		<summary type="html"><![CDATA[I just found this old screenshot from one of my previous jobs. It was taken on December 9th 2003, while one of the web hosting servers went woowoo due to badly optimized web site. Load average went sky high to 682! Anyone else had such a high load before or am I the absolute champion? [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2009/11/23/load-average-680/"><![CDATA[<p>I just found this old screenshot from one of my previous jobs. It was taken on December 9th 2003, while one of the web hosting servers went woowoo due to badly optimized web site. Load average went sky high to 682! Anyone else had such a high load before or am I the absolute champion? :)</p>
<p><a href="http://www.miljan.org/gallery/blog/load.jpg"><img alt="" src="http://www.miljan.org/gallery/blog/load.jpg" title="load average" class="alignnone" width="650" height="488" /></a></p>
<p>PS: I was using Fluxbox back than! Wow, crazy youth! :)</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2009/11/23/load-average-680/#comments" thr:count="6" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2009/11/23/load-average-680/feed/atom/" thr:count="6" />
		<thr:total>6</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2009/11/23/load-average-680/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[LVM Snapshots and XFS]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/JlwmcVTMxzQ/" />
		<id>http://www.miljan.org/main/?p=95</id>
		<updated>2009-11-17T08:48:01Z</updated>
		<published>2009-11-16T10:39:10Z</published>
		<category scheme="http://www.miljan.org/main" term="Linux" />		<summary type="html"><![CDATA[Small note for everyone planing to use Linux LVM snapshots and using XFS at the same time. XFS has UUIDs which are unique identifiers of the filesystem. Two file systems with same UUID can not be mounted on the same server. Now, if we know that a snapshot of a logical volume represents a point-in-time [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2009/11/16/lvm-snapshots-and-xfs/"><![CDATA[Small note for everyone planing to use Linux LVM snapshots and using XFS at the same time. XFS has UUIDs which are unique identifiers of the filesystem. Two file systems with same UUID can not be mounted on the same server. Now, if we know that a snapshot of a logical volume represents a point-in-time copy of the original logical volume it doesn't take much time to realize that the filesystem on the snapshot is also a copy, thus it will have the same UUID as the filesystem on the original logical volume. So here is what happens when you try to mount the snapshot:

<p class="code">[root@server ~]# df -hT /var/lib/mysql_backup/<br />
Filesystem    Type    Size  Used Avail Use% Mounted on<br />
/dev/mapper/sys-mysql_backup<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xfs&nbsp;&nbsp;&nbsp;&nbsp;25G&nbsp;&nbsp;&nbsp;19G&nbsp;&nbsp;6.3G&nbsp;&nbsp;76% /var/lib/mysql_backup<br />
&nbsp;<br />
[root@server ~]# lvcreate -s -n bkp-snap -L1G /dev/sys/mysql_backup<br />
&nbsp;&nbsp;Logical volume "bkp-snap" created<br />
&nbsp;<br />
[root@server ~]# mount /dev/sys/bkp-snap /mnt/misc/<br />
mount: wrong fs type, bad option, bad superblock on /dev/sys/bkp-snap,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;missing codepage or other<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;In some cases useful info is found in syslog - try<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dmesg | tail  or so<br />
&nbsp;<br />
[root@server ~]# dmesg | tail -1<br />
XFS: Filesystem dm-9 has duplicate UUID - can't mount</p>

It doesn't look very good.
There are two solution for this problem. One is to use nouuid option for mount command.
<p class="code">[root@server ~]# mount -o nouuid /dev/sys/bkp-snap /mnt/misc/<br />
&nbsp;<br />
[root@server ~]# dmesg | tail -3<br />
XFS mounting filesystem dm-9<br />
Starting XFS recovery on filesystem: dm-9 (logdev: internal)<br />
Ending XFS recovery on filesystem: dm-9 (logdev: internal)</p>

Another option would be to change UUID of the filesystem on the snapshot using xfs_admin command.
<p class="code">[root@server ~]# xfs_admin -U generate /dev/sys/bkp-snap<br />
Clearing log and setting UUID<br />
writing all SBs<br />
new UUID = 1bdcf6e1-62fb-47f2-83e4-dc398bb7a1cd<br />
&nbsp;<br />
[root@server ~]# dmesg | tail -2<br />
XFS mounting filesystem dm-9<br />
Ending clean XFS mount for filesystem: dm-9</p>

I am in favour of the first option (mount -o nouuid) since it does not perform any modification on the filesystem. It just feels safer, that's all... :)]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2009/11/16/lvm-snapshots-and-xfs/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2009/11/16/lvm-snapshots-and-xfs/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2009/11/16/lvm-snapshots-and-xfs/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[More information on Linux memory management]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/uujYMIq0u3s/" />
		<id>http://www.miljan.org/main/?p=90</id>
		<updated>2009-11-11T10:43:33Z</updated>
		<published>2009-11-10T15:13:19Z</published>
		<category scheme="http://www.miljan.org/main" term="Linux" />		<summary type="html"><![CDATA[I have just noticed that I missed to mention one very important thing in my previous post.
File /proc/meminfo contains a very useful field named Committed_AS. This field indicates TOTAL value of committed memory. If all applications would require all memory allocated to them your server would need this amount of memory.
If we look in the [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2009/11/10/more-information-on-linux-memory-management/"><![CDATA[<p>I have just noticed that I missed to mention one very important thing in my previous post.</p>
<p>File /proc/meminfo contains a very useful field named Committed_AS. This field indicates TOTAL value of committed memory. If all applications would require all memory allocated to them your server would need this amount of memory.</p>
<p>If we look in the example from my previous post we would find following values:</p>
<p class="code">loreto:/tmp # cat /proc/meminfo<br />
MemTotal:     33274944 kB<br />
&#8230;<br />
Committed_AS: 49751960 kB<br />
&#8230;</p>
<p>So my server has 32GB of RAM, but total amount of memory allocated is 48GB. That is 150%! If all this memory would be required at once server would crash pretty bad (or OOM killer would start butchering my Oracle databases to get some memory back!). :-)</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2009/11/10/more-information-on-linux-memory-management/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2009/11/10/more-information-on-linux-memory-management/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2009/11/10/more-information-on-linux-memory-management/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[Linux memory management]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/CN78oYiQErM/" />
		<id>http://www.miljan.org/main/?p=76</id>
		<updated>2009-11-11T10:43:49Z</updated>
		<published>2009-07-10T15:45:04Z</published>
		<category scheme="http://www.miljan.org/main" term="Linux" />		<summary type="html"><![CDATA[Yesterday I had a request for memory usage report on Oracle servers in my company. As we are using Centreon, Nagios frontend which makes good use of performance data reported by Nagios plugins and makes nice graphs out of it, it was a matter of pasting the images into the mail and sending it. But [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2009/07/10/linux-memory-management/"><![CDATA[<p>Yesterday I had a request for memory usage report on Oracle servers in my company. As we are using <a title="Centreon" href="http://www.centreon.com" target="_blank">Centreon</a>, <a title="Nagios" href="http://www.nagios.org/" target="_blank">Nagios</a> frontend which makes good use of performance data reported by Nagios plugins and makes nice graphs out of it, it was a matter of pasting the images into the mail and sending it. But than interesting question was raised: how come on a server with 32GB of RAM and with 30+ databases running, only 5GB of RAM is reported as used? Strange indeed.</p>
<p>I quickly logged in to server and checked memory usage:</p>
<p class="code">loreto:/tmp # free<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;total&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;used&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;free&nbsp;&nbsp;&nbsp;&nbsp;shared&nbsp;&nbsp;&nbsp;buffers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cached<br />
Mem:      33274944   32931032     343912&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20   27013200<br />
-/+ buffers/cache:    5917812   27357132<br />
Swap:     16779884    5603256   11176628</p>
<p>Really only 5GB, check_memory plugin was not wrong. Next this I checked were shared memory segments &#8211; Oracle uses shared memory in huge quantities, so this is also very important parameter.
</p>
<p class="code">loreto:/tmp # a=0; for i in $(ipcs -m|grep ^0x|awk &#8216;{print $5}&#8217;); do let a+=$i; done; echo $a<br />
20443037885</p>
<p>Ugh, 20GB allocated  for shared memory, while system reports only 5GB. Something is very wrong here. Confused, I took out the artillery.
</p>
<p class="code">loreto:/tmp # cat /proc/meminfo<br />
MemTotal:     33274944 kB<br />
MemFree:        198580 kB<br />
Buffers:            20 kB<br />
Cached:       27439580 kB<br />
SwapCached:     223880 kB<br />
Active:       16333936 kB<br />
Inactive:     15428724 kB<br />
HighTotal:    32634140 kB<br />
HighFree:        33516 kB<br />
LowTotal:       640804 kB<br />
LowFree:        165064 kB<br />
SwapTotal:    16779884 kB<br />
SwapFree:     10856700 kB<br />
Dirty:            1668 kB<br />
Writeback:           0 kB<br />
AnonPages:     4089416 kB<br />
Mapped:       10222968 kB<br />
Slab:           427584 kB<br />
CommitLimit:  33417356 kB<br />
Committed_AS: 49751960 kB<br />
PageTables:     826016 kB<br />
VmallocTotal:   112632 kB<br />
VmallocUsed:     22228 kB<br />
VmallocChunk:    90180 kB<br />
HugePages_Total:     0<br />
HugePages_Free:      0<br />
HugePages_Rsvd:      0<br />
Hugepagesize:     2048 kB</p>
<p>Usually, used memory on Linux is calculated as (Total Memory &#8211; (Unused Memory + Buffers + Page Cache)). Why buffers and caches are not counted into memory usage? Simply because it contains data that is not really critical for operating system and applications running. It contains data that can be flushed and removed from the memory at any time.</p>
<p>So in my case that was:
</p>
<p class="code">33274944 &#8211; (198580 + 20 + 27439580) = 5636764</p>
<p>OK, this matches output from free command. But what about those 20GB of allocated shared memory?</p>
<p>Next few hours I spent in searching and reading Linux documentation on memory management and found few interesting things.</p>
<p>Linux uses principle of memory overcommitment. Basically, what this means is that when application requests memory to be allocated, kernel will always &#8220;give: the memory hoping that application will not really use it, or at least not the whole size allocated. Only when application tries to write the data into the memory, kernel will mark the memory as used. This can lead to situation where the size of allocated memory is actually higher than the size of physical memory inside the machine. But as long as there is no demand for allocated memory, system is running without problems.</p>
<p>And this is the core of my dilemma. Shared memory is allocated, but since there is no data in it, it is not counted into used memory.</p>
<p>Memory overcommit can be configured via two parameters:</p>
<p class="code">loreto:/tmp # sysctl -a|grep overcommit<br />
vm.overcommit_ratio = 50<br />
vm.overcommit_memory = 0</p>
<p>From Red Hat manual:</p>
<ul>
<li><strong>overcommit_memory</strong> — Configures the conditions under which a large memory request is accepted or denied. The following three modes are available:
<ul>
<li><strong>0</strong> — The kernel performs heuristic memory over commit handling by estimating the amount of memory available and failing requests that are blatantly invalid. Unfortunately, since memory is allocated using a heuristic rather than a precise algorithm, this setting can sometimes allow available memory on the system to be overloaded. This is the default setting.</li>
<li><strong>1</strong> — The kernel performs no memory over commit handling. Under this setting, the potential for memory overload is increased, but so is performance for memory intensive tasks (such as those executed by some scientific software).</li>
<li><strong>2</strong> — The kernel fails requests for memory that add up to all of swap plus the percent of physical RAM specified in /proc/sys/vm/overcommit_ratio. This setting is best for those who desire less risk of memory overcommitment.<br />
<strong>Note</strong> This setting is only recommended for systems with swap areas larger than physical memory.</li>
</ul>
</li>
<li><strong>overcommit_ratio</strong> — Specifies the percentage of physical RAM considered when /proc/sys/vm/overcommit_memory is set to 2. The default value is 50.</li>
</ul>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2009/07/10/linux-memory-management/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2009/07/10/linux-memory-management/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2009/07/10/linux-memory-management/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[Pidgin status v2]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/JSSfDYkl810/" />
		<id>http://www.miljan.org/main/?p=64</id>
		<updated>2008-10-10T19:40:04Z</updated>
		<published>2008-10-10T19:34:58Z</published>
		<category scheme="http://www.miljan.org/main" term="Linux" /><category scheme="http://www.miljan.org/main" term="News" /><category scheme="http://www.miljan.org/main" term="Pidgin" /><category scheme="http://www.miljan.org/main" term="Python" />		<summary type="html"><![CDATA[As requested by bleketux, I made some modifications to pidgin_status.py script.
Main news is that now it is possible to change Pidgin status message periodically. Script will go to background (it is a real daemon now :P), change the status, and wait for the set time interval until it changes the message again, and then all [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2008/10/10/pidgin-status-v2/"><![CDATA[<p>As requested by bleketux, I made some modifications to pidgin_status.py script.</p>
<p>Main news is that now it is possible to change Pidgin status message periodically. Script will go to background (it is a real daemon now :P), change the status, and wait for the set time interval until it changes the message again, and then all over again, wait-change-wait-change.</p>
<p>To change status message every 5 minutes with a random line from file /home/miljan/quotes/dusko_radovic.txt:</p>
<p class="code">pidgin_status.py -d -t 5 -f /home/miljan/quote/dusko_radovic.txt</p>
<p>And in Pidgin you would get something like this every five minutes:<br />
<a href="http://www.miljan.org/main/wp-content/uploads/2008/10/status.png"><img class="alignnone size-full wp-image-63" title="status" src="http://www.miljan.org/main/wp-content/uploads/2008/10/status.png" alt="" width="264" height="88" /></a></p>
<p>To show the song you are listening to as status message:</p>
<p class="code">pidgin_status.py -s &#8220;Mukeka di Rato &#8211; Kustapassaaessedrmobral&#8221;</p>
<p>And in Pidgin it would look like:</p>
<p><a href="http://www.miljan.org/main/wp-content/uploads/2008/10/status1.png"><img class="alignnone size-full wp-image-65" title="status1" src="http://www.miljan.org/main/wp-content/uploads/2008/10/status1.png" alt="" width="267" height="90" /></a></p>
<p>You can see all possible options by running script with -h argument for help.</p>
<p>bleketux, I hope you are still around to enjoy this. ;)</p>
<p class="download"> Download: <a href="/download/pidgin_status_v2.py">pidgin_status_v2.py</a></p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2008/10/10/pidgin-status-v2/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2008/10/10/pidgin-status-v2/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2008/10/10/pidgin-status-v2/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[American SPAM]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/pTchFe51R2U/" />
		<id>http://www.miljan.org/main/?p=61</id>
		<updated>2008-09-25T09:56:29Z</updated>
		<published>2008-09-25T09:56:29Z</published>
		<category scheme="http://www.miljan.org/main" term="News" /><category scheme="http://www.miljan.org/main" term="Web" />		<summary type="html"><![CDATA[This is so funny that I have to post it. :)
We all know about Nigerian SPAM, but how about American SPAM? :o)
]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2008/09/25/american-spam/"><![CDATA[<p>This is so funny that I have to post it. :)</p>
<p>We all know about Nigerian SPAM, but how about <a title="American SPAM" href="http://www.boingboing.net/2008/09/22/hank-paulsons-bailou.html" target="_blank">American SPAM</a>? :o)</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2008/09/25/american-spam/#comments" thr:count="0" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2008/09/25/american-spam/feed/atom/" thr:count="0" />
		<thr:total>0</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2008/09/25/american-spam/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[Why I love strace]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/sYTBFG91I_E/" />
		<id>http://www.miljan.org/main/2008/03/25/why-i-love-strace/</id>
		<updated>2008-03-29T23:02:48Z</updated>
		<published>2008-03-24T23:39:44Z</published>
		<category scheme="http://www.miljan.org/main" term="Linux" /><category scheme="http://www.miljan.org/main" term="Shell" /><category scheme="http://www.miljan.org/main" term="UNIX" />		<summary type="html"><![CDATA[Strace is a tool that should be in a toolbox of every system administrator. Not only that it can help in troubleshooting simple problems (ie. missing libraries in newly created chroot, which ldd mysteriously misses to report) but it also helps in debugging very complex system problems and performance issues.
Recently I experienced a very strange [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2008/03/25/why-i-love-strace/"><![CDATA[<p>Strace is a tool that should be in a toolbox of every system administrator. Not only that it can help in troubleshooting simple problems (ie. missing libraries in newly created chroot, which ldd mysteriously misses to report) but it also helps in debugging very complex system problems and performance issues.</p>
<p>Recently I experienced a very strange problem with one of the RHEL 3 servers we&#8217;ve got. Problem manifested in a very strange way,  SSH and su logins hanged, other daemons were also hanging during the startup, only way to reboot or shutdown the server was to physically press the restart/power off button, etc. All this could have been caused by problems on both software and hardware level. First suspicious was bad RAID controller, but after tests this proved to be a mislead. After more tests and brainstorms hardware problems were definitely excluded, so problem has to be on the software side. But what could be the problem?</p>
<p>After few more misleading steps I tried to trace system calls created by su command and found very interesting results.</p>
<p class="code">$ strace -f -s 1024 -o /tmp/su.strace.out su -<br />
[-- cut --]<br />
3138  open(&#8221;/dev/audit&#8221;, O_RDWR)                      = 3<br />
3138  fcntl64(3, F_GETFD)                                        = 0<br />
3138  fcntl64(3, F_SETFD, FD_CLOEXEC)     = 0<br />
3138  ioctl(3, 0&#215;801c406f</p>
<p>And this is where the strace output ends and su command hangs. Audit device file is opened (file descriptor 3) and as soon as the first request is dispatched to this device (ioctl system call to file descriptor 3) command freezes. According to this I should just disable audit on the server and the problem will be gone.<br />
As a test, audit daemon was temporarily stopped and I tried to switch to another user and the problem was indeed gone.</p>
<p>After searching for similar problems with audit daemon I found an article in Red Hat knowledge base regarding the exactly same<br />
issue (<a href="http://kbase.redhat.com/faq/FAQ_79_6169.shtm">http://kbase.redhat.com/faq/FAQ_79_6169.shtm</a>).<br />
From the article:</p>
<blockquote><p>When the free space in the filesystem holding the audit logs is less than 20%, the above notify command will error out and auditd will enter suspend mode. This causes all system calls to block.</p></blockquote>
<p>So this behavior is not a bug but actual feature of the software. :o) From security point of view this is expected behaviour &#8211; attacker could fill up filesystem where audit logs are stored before the attack and audit will be disabled, meaning no logs of his activity, so better not to allow ANY activity on the system if audit is not able to write to its logs. But still, this kind of behaviour renders the system completely useless to legitimate users.</p>
<p>The topic of this post is not audit, so I will stop here. Important thing is that strace led us directly to the main source of the problem. Resolution of issues like this would be much more complex and time consuming without this great little tool. :)</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2008/03/25/why-i-love-strace/#comments" thr:count="2" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2008/03/25/why-i-love-strace/feed/atom/" thr:count="2" />
		<thr:total>2</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2008/03/25/why-i-love-strace/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[Setting Pidgin Status with Python or How to Waste Perfectly Good Saturday]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/9bkWkO-O46A/" />
		<id>http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/</id>
		<updated>2008-03-08T23:54:32Z</updated>
		<published>2008-03-08T23:53:24Z</published>
		<category scheme="http://www.miljan.org/main" term="Linux" /><category scheme="http://www.miljan.org/main" term="Pidgin" /><category scheme="http://www.miljan.org/main" term="Python" />		<summary type="html"><![CDATA[I was very bored today. Tired from working on Ratuus (don&#8217;t go there, site is under heavy construction :)) I needed something to help me take my mind off everything. And what better way to do it, than playing with Python, Pidgin and D-BUS. :D
To cut the long story short, I needed something that will [...]]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/"><![CDATA[<p>I was very bored today. Tired from working on <a href="http://www.ratuus.org/">Ratuus</a> (don&#8217;t go there, site is under heavy construction :)) I needed something to help me take my mind off everything. And what better way to do it, than playing with Python, Pidgin and D-BUS. :D</p>
<p>To cut the long story short, I needed something that will update my Pidgin status message with the information about the current song I am listening. Till recently I was using Rhythmbox player and there is a perfect little Pidgin plugin called Current Track that worked with this player. Last week I discovered <a href="http://squentin.free.fr/gmusicbrowser/gmusicbrowser.html">gmusicbrowser</a> and fell in love immediately. It is fast, rich with functionalities but still simple to use. Exactly what I want from audio player. (Hm, I just noticed it is written in PERL. Now when Python is used for everything this comes as a big surprise.)</p>
<p>gmusicbrowser already has a plugin called NowPlaying. It will trigger some command whenever song is changed. I just needed to write this command that will inform Pidgin about the change. So, this seemed like a perfect exercise for slow Saturday. :)</p>
<p>Quick search on Pidgin and D-BUS showed extensive documentation about <a href="http://developer.pidgin.im/wiki/DbusHowto">Pidgin API accessible through D-BUS</a>. There is even a working example of how to change the status message! :)</p>
<p>But that was too simple, so I got another idea. Some time ago, I wrote a small daemon in C that will bind to a specific port and display random bofh-excuses fortune messages when someone would telnet to it. (Seems like I have a lot of spare time. I should really find some hobby!) Something similar to telnet bofh.jeffballard.us 666 (<a href="http://pages.cs.wisc.edu/~ballard/bofh/">here</a> for more information). So I was thinking about implementing the same for my Pidgin status. Random BOFH excuses in your status message! How <del>cool</del> geeky is that!</p>
<p>The result of all that is short (~60 lines of code) Python script that will set your Pidgin status message to:</p>
<p>a) you current song</p>
<p class="code">pidgin_status.py -m The Real McKenzies &#8211; Outta Scotch</p>
<p>b) random line from a file</p>
<p class="code">pidgin_status.py -f /usr/local/share/bofh-example</p>
<p>c) anything you give as the command line argument</p>
<p class="code">pidgin_status.py Some very interesting and funny status message</p>
<p>Only difference between a) and c) is the type of the icon that will be shown. In example a) there will be a small musical note, while in example b) and c) nice arrow pointing to right side will be show.</p>
<p>In the middle of testing I noticed this strange message:</p>
<p><img src="http://www.miljan.org/gallery/blog/bofh-rofl.png" /></p>
<p>Being from Serbia myself, I find this extremely funny. Although, I didn&#8217;t know Serbian hackers are so notorious! :)</p>
<p>I hope someone will find it useful. In any case, I am accepting donations for some long and adventurous vacation. As you can see, I really need it! :D</p>
<p class="download"><a href="http://www.miljan.org/download/pidgin_status.py">pidgin_status.py</a><br />
<a href="http://www.miljan.org/download/bofh-excuses">bofh-excuses</a></p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/#comments" thr:count="19" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/feed/atom/" thr:count="19" />
		<thr:total>19</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2008/03/09/setting-pidgin-status-with-python-or-how-to-waste-perfectly-good-saturday/</feedburner:origLink></entry>
		<entry>
		<author>
			<name>miljan</name>
						<uri>http://www.miljan.org</uri>
					</author>
		<title type="html"><![CDATA[Building Scalable Web Architectures]]></title>
		<link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/miljanorg/~3/IvzA1jADnhI/" />
		<id>http://www.miljan.org/main/2007/09/13/building-scalable-web-architectures/</id>
		<updated>2007-09-13T06:35:43Z</updated>
		<published>2007-09-13T06:35:43Z</published>
		<category scheme="http://www.miljan.org/main" term="Apache" /><category scheme="http://www.miljan.org/main" term="Linux" /><category scheme="http://www.miljan.org/main" term="News" /><category scheme="http://www.miljan.org/main" term="Web" />		<summary type="html"><![CDATA[I just read a very interesting presentation done by Aaron Bannert for ApacheCon 2005. Presentation is on &#8220;Building Scalable Web Architectures&#8221; and it is a very good reading for anyone interested in high scale web environments. Here is the link to the presentation.
]]></summary>
		<content type="html" xml:base="http://www.miljan.org/main/2007/09/13/building-scalable-web-architectures/"><![CDATA[<p>I just read a very interesting presentation done by Aaron Bannert for ApacheCon 2005. Presentation is on &#8220;Building Scalable Web Architectures&#8221; and it is a very good reading for anyone interested in high scale web environments. <a href="http://www.codemass.com/presentations/apachecon2005/ac2005scalablewebarch.pdf" target="_blank">Here</a> is the <a href="http://www.codemass.com/presentations/apachecon2005/ac2005scalablewebarch.pdf" target="_blank">link</a> to the <a href="http://www.codemass.com/presentations/apachecon2005/ac2005scalablewebarch.pdf" target="_blank">presentation</a>.</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.miljan.org/main/2007/09/13/building-scalable-web-architectures/#comments" thr:count="1" />
		<link rel="replies" type="application/atom+xml" href="http://www.miljan.org/main/2007/09/13/building-scalable-web-architectures/feed/atom/" thr:count="1" />
		<thr:total>1</thr:total>
	<feedburner:origLink>http://www.miljan.org/main/2007/09/13/building-scalable-web-architectures/</feedburner:origLink></entry>
	</feed>
