<?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>Frederik Konietzny</title>
	<atom:link href="http://www.frederikkonietzny.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.frederikkonietzny.de</link>
	<description>a Linux sysadmin blog</description>
	<lastBuildDate>Fri, 04 May 2012 20:26:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>LG verlost einen CINEMA 3D TV 42LM760S</title>
		<link>http://www.frederikkonietzny.de/2012/05/lg-verlost-einen-cinema-3d-tv-42lm760s/</link>
		<comments>http://www.frederikkonietzny.de/2012/05/lg-verlost-einen-cinema-3d-tv-42lm760s/#comments</comments>
		<pubDate>Fri, 04 May 2012 20:25:37 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[42LM760S]]></category>
		<category><![CDATA[CINEMA]]></category>
		<category><![CDATA[gewinnspiel]]></category>
		<category><![CDATA[LG]]></category>
		<category><![CDATA[TV]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=193</guid>
		<description><![CDATA[Unter der folgenden URL ist das Gewinnspiel von LG zu finden: &#8220;Wir feiern 111.111 Facebook Fans und verlosen den CINEMA 3D TV 42LM760S&#8221; Viel Glück Related Posts:How to setup and expand a replicated Glusterfs 3.2.4 volume on Debian 6.xhow to determine the runtime and start time of a Linux processSetting … <a href="http://www.frederikkonietzny.de/2012/05/lg-verlost-einen-cinema-3d-tv-42lm760s/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>Unter der folgenden URL ist das Gewinnspiel von LG zu finden:</p>
<p><a href="http://www.lgblog.de/2012/05/03/wir-feiern-111-111-facebook-fans-und-verlosen-den-cinema-3d-tv-42lm760s/" title="Wir feiern 111.111 Facebook Fans und verlosen den CINEMA 3D TV 42LM760S" target="_blank">&#8220;Wir feiern 111.111 Facebook Fans und verlosen den CINEMA 3D TV 42LM760S&#8221;</a></p>
<p>Viel Glück <img src='http://www.frederikkonietzny.de/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/" rel="bookmark" class="crp_title">How to setup and expand a replicated Glusterfs 3.2.4 volume on Debian 6.x</a></li><li><a href="http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/" rel="bookmark" class="crp_title">how to determine the runtime and start time of a Linux process</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/setting-up-drbd-volumes/" rel="bookmark" class="crp_title">Setting up DRBD Volumes</a></li><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-gitorious-on-ubuntu-server-11-10/" rel="bookmark" class="crp_title">how to setup gitorious on ubuntu server 11.10</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2012/05/lg-verlost-einen-cinema-3d-tv-42lm760s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to setup and expand a replicated Glusterfs 3.2.4 volume on Debian 6.x</title>
		<link>http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/</link>
		<comments>http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 20:50:06 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[High availability]]></category>
		<category><![CDATA[backports]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[expand]]></category>
		<category><![CDATA[gluster]]></category>
		<category><![CDATA[Glusterfs]]></category>
		<category><![CDATA[replicated]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[volume]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=181</guid>
		<description><![CDATA[In this tutorial I will describe how to setup and expand a replicated Glusterfs Volume on Debian Squeeze. Glusterfs is a clustered, scalable network file system licensed under the GNU GPL. Glusterfs should be able to handle petabytes of data and thousands of clients &#8211; may be I will try … <a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will describe how to setup and expand a replicated <a href="http://www.gluster.org/" title="http://www.gluster.org/" target="_blank">Glusterfs</a> Volume on Debian Squeeze. Glusterfs is a clustered, scalable network file system licensed under the GNU GPL. Glusterfs should be able to handle petabytes of data and thousands of clients &#8211; may be I will try that later .. In my tutorial I will use only four storage server and one client.</p>
<p><span id="more-181"></span></p>
<div id="toc_container" class="no_bullets"><p class="toc_title">Contents</p><ul class="toc_list"><li><a href="#references">1 references</a></li><li><a href="#First_step_8211_setup_a_replicated_Glusterfs_volume">2 First step &#8211; setup a replicated Glusterfs volume</a><ul><li><a href="#preparation">2.1 preparation</a></li><li><a href="#Glusterfs_setup">2.2 Glusterfs setup</a></li></ul></li><li><a href="#Second_step_8211_expand_a_replicated_Glusterfs_volume">3 Second step &#8211; expand a replicated Glusterfs volume</a><ul><li><a href="#Two_more_nodes">3.1 Two more nodes?</a></li><li><a href="#preparation-2">3.2 preparation</a></li><li><a href="#expanding_the_Glusterfs_Volume">3.3 expanding the Glusterfs Volume</a></li></ul></li><li><a href="#Accessing_the_Glusterfs_volume_with_a_client">4 Accessing the Glusterfs volume with a client</a><ul><li><a href="#mount_the_Glusterfs_volume">4.1 mount the Glusterfs volume</a></li></ul></li><li><a href="#Logfiles">5 Logfiles</a><ul><li><ul><li><a href="#Related_Posts">5.0.1 Related Posts:</a></li></ul></li></ul></li></ul></div>

<h1><span id="references">references</span></h1>
<ul>
<li><a href="http://en.wikipedia.org/wiki/GlusterFS" title="http://en.wikipedia.org/wiki/GlusterFS" target="_blank">http://en.wikipedia.org/wiki/GlusterFS</a></li>
<li><a href="http://backports-master.debian.org/" title="http://backports-master.debian.org/" target="_blank">http://backports-master.debian.org/</a></li>
<li><a href="http://www.gluster.org/" title="http://www.gluster.org/" target="_blank">http://www.gluster.org/</a></li>
</ul>
<p>In the first step I will setup a glusterfs volume </p>
<h1><span id="First_step_8211_setup_a_replicated_Glusterfs_volume">First step &#8211; setup a replicated Glusterfs volume</span></h1>
<p>In the first step I will setup a replicated Glusterfs volume on Debian 6.x with on two Debian 6.x server.<br />
The hostnames for my setup are debian01 and debian02. Because I am using an simple test-environment, I have<br />
to add the nodes to the /etc/hosts file.</p>
<h2><span id="preparation">preparation</span></h2>
<blockquote><p>
10.2.1.251      debian01<br />
10.2.1.255      debian02
</p></blockquote>
<p>I will use the newer Glusterfs version 3.2.4 from <a href="http://backports-master.debian.org/" title="Debian Backports " target="_blank">Debian Backports</a>:</p>
<p>Add the following line to /etc/apt/sources.list </p>
<blockquote><p>
deb http://backports.debian.org/debian-backports squeeze-backports main
</p></blockquote>
<p>And install Glusterfs</p>
<p></p><pre class="crayon-plain-tag">apt-get update
apt-get install glusterfs-server=3.2.4-1~bpo60+1 glusterfs-client=3.2.4-1~bpo60+1</pre><p> </p>
<p>The glusterfs daemon should be started after the installation.</p>
<p>In my example the Glusterfs will use the following directory as the storage on both nodes.</p>
<p></p><pre class="crayon-plain-tag">root@debian01 # mkdir -p /export/data
root@debian02 # mkdir -p /export/data</pre><p></p>
<h2><span id="Glusterfs_setup">Glusterfs setup</span></h2>
<p>Now add the node debian02 to the storage pool.</p>
<p></p><pre class="crayon-plain-tag">root@debian01:~# gluster peer probe debian02
Probe successful</pre><p></p>
<p>Its not necessary to add the localhost (in this example debian01) to the pool.</p>
<p>The Glusterfs volume will be created with the gluster command</p>
<blockquote><p>Syntax# gluster volume create NEW-VOLNAME [replica COUNT] [transport tcp | rdma] NEW-BRICK&#8230;</p></blockquote>
<p>For the two nodes replicated volume I used the following command:</p>
<p></p><pre class="crayon-plain-tag">root@debian01:/etc/glusterfs# gluster volume create datastore replica 2 transport tcp debian01:/export/data debian02:/export/data/
Creation of volume datastore has been successful. Please start the volume to access data.</pre><p></p>
<p>I set the following ACL for the volume (access is allowed only from the 10.2.0.0/16 network)</p><pre class="crayon-plain-tag">root@debian02:~# gluster volume set test-volume auth.allow 10.2.*
Volume test-volume does not exist
Set volume unsuccessful</pre><p></p>
<p>Start the created Glusterfs Volume with the following command:</p>
<p></p><pre class="crayon-plain-tag">root@debian01:/etc/glusterfs# gluster volume start datastore
Starting volume datastore has been successful</pre><p></p>
<p>Verify the setup with the following commands / checks:</p>
<p></p><pre class="crayon-plain-tag">root@debian02:~# showmount -e debian02
Export list for debian02:
/datastore *</pre><p></p>
<p></p><pre class="crayon-plain-tag">root@debian02:/# gluster volume info
Volume Name: datastore
Type: Replicate
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: debian01:/export/data
Brick2: debian02:/export/data</pre><p></p>
<p>After stopping the Gusterfs volume, the NFS export should`t be available :</p>
<p></p><pre class="crayon-plain-tag">root@debian02:~# gluster volume stop datastore 
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
root@debian01:/etc# showmount -e debian01
clnt_create: RPC: Program not registered</pre><p></p>
<p>Start the Gluserfs volume again:</p><pre class="crayon-plain-tag">root@debian02:~# gluster volume start datastore 
Starting volume datastore has been successful</pre><p></p>
<p>Create a mountpoint for the Glusterfs volume and mount it on both nodes:</p>
<p></p><pre class="crayon-plain-tag">root@debian01:/etc# mkdir /mnt/datastore 
root@debian01:/etc# mount -t glusterfs debian01:/datastore /mnt/datastore 
root@debian01:/etc# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
debian01:/datastore on /mnt/datastore type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)</pre><p></p>
<p></p><pre class="crayon-plain-tag">root@debian02:/etc# mkdir /mnt/datastore 
root@debian02:/# mount -t glusterfs debian02:/datastore /mnt/datastore
root@debian02:/# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
debian02:/datastore on /mnt/datastore type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)</pre><p></p>
<h1><span id="Second_step_8211_expand_a_replicated_Glusterfs_volume">Second step &#8211; expand a replicated Glusterfs volume</span></h1>
<p>I will expand the Glusterfs volume datastore with two nodes. I will use the hostnames debian03 and debian04 in my example.</p>
<h2><span id="Two_more_nodes">Two more nodes?</span></h2>
<p>First I tried to add only one node in my test setup and got the following error.</p>
<p></p><pre class="crayon-plain-tag">root@debian02:/# gluster volume add-brick datastore debian03:/export/data
Incorrect number of bricks supplied 1 for type REPLICATE with count 2</pre><p></p>
<p>And the answer is in the Glusterfs documentation:</p>
<blockquote><p>Note: When expanding distributed replicated and distributed striped volumes, you need to add a number of bricks that is a multiple of the replica or stripe count. For example, to expand a distributed replicated volume with a replica count of 2, you need to add bricks in multiples of 2 (such as 4, 6, 8, etc.). </p></blockquote>
<h2><span id="preparation-2">preparation</span></h2>
<p>On all four nodes extend the /etc/hosts file with the new nodes debian03 and debian04:</p>
<blockquote><p>
10.2.1.251      debian01<br />
10.2.1.255      debian02<br />
10.2.2.34       debian03<br />
10.2.2.35	debian04
</p></blockquote>
<p>Installation of Glusterfs as with debian01 and debian02</p>
<blockquote><p>
deb http://backports.debian.org/debian-backports squeeze-backports main
</p></blockquote>
<p>And install Glusterfs</p>
<p></p><pre class="crayon-plain-tag">apt-get update
apt-get install glusterfs-server=3.2.4-1~bpo60+1 glusterfs-client=3.2.4-1~bpo60+1</pre><p> </p>
<p></p><pre class="crayon-plain-tag">root@debian03 # mkdir -p /export/data
root@debian04 # mkdir -p /export/data</pre><p></p>
<h2><span id="expanding_the_Glusterfs_Volume">expanding the Glusterfs Volume</span></h2>
<p>On debian01 add the new nodes to the storage pool:</p>
<p></p><pre class="crayon-plain-tag">root@debian01:/# gluster peer probe debian03
Probe successful

root@debian01:/# gluster peer probe debian04
Probe successful</pre><p></p>
<p>Expand the volume with the gluster command:</p>
<p></p><pre class="crayon-plain-tag">root@debian02:/# gluster volume add-brick datastore debian03:/export/data debian04:/export/data
Add Brick successful</pre><p></p>
<p>Verify the volume, we should have 3 peer nodes now:</p>
<p></p><pre class="crayon-plain-tag">root@debian01:/etc# gluster peer status
Number of Peers: 3

Hostname: debian02
Uuid: cb6ae562-ea21-4c2d-baa2-4c2b2597e18a
State: Peer in Cluster (Connected)

Hostname: debian03
Uuid: 380fda84-b952-4261-af55-27a9d8d1afbc
State: Peer in Cluster (Connected)

Hostname: debian04
Uuid: 65f37919-6f88-48fa-a782-b4292539a9bf
State: Peer in Cluster (Connected)</pre><p></p>
<p></p><pre class="crayon-plain-tag">root@debian01:/etc# gluster volume info
Volume Name: datastore
Type: Distributed-Replicate
Status: Started
Number of Bricks: 2 x 2 = 4
Transport-type: tcp
Bricks:
Brick1: debian01:/export/data
Brick2: debian02:/export/data
Brick3: debian03:/export/data
Brick4: debian04:/export/data</pre><p></p>
<p>After expanding the volume a rebalancing of the volume data is necessary:</p><pre class="crayon-plain-tag">root@debian01:/etc# gluster volume rebalance datastore start</pre><p></p>
<p>Check the rebalancing:</p><pre class="crayon-plain-tag">root@debian01:/etc# gluster volume rebalance datastore status
rebalance step 1: layout fix in progress
root@debian01:/etc# gluster volume rebalance datastore status
rebalance step 1: layout fix in progress: fixed layout 41
root@debian01:/etc# gluster volume rebalance datastore status
rebalance step 1: layout fix in progress: fixed layout 69
root@debian01:/etc# gluster volume rebalance datastore status
rebalance step 2: data migration in progress: rebalanced 18 files of size 173669 (total files scanned 46)
root@debian01:/etc# gluster volume rebalance datastore status
rebalance step 2: data migration in progress: rebalanced 473 files of size 1634033 (total files scanned 1988)
root@debian01:/etc# gluster volume rebalance datastore status
rebalance completed: rebalanced 1121 files of size 3702686 (total files scanned 4977)</pre><p></p>
<h1><span id="Accessing_the_Glusterfs_volume_with_a_client">Accessing the Glusterfs volume with a client</span></h1>
<p>If you mound the Glusterfs volume you specify only one of the storage server nodes,<br />
but the client is using this node only to fetch the volume configuration. Subsequently,<br />
the client will communicate directly will all available Glusterfs nodes.</p>
<h2><span id="mount_the_Glusterfs_volume">mount the Glusterfs volume</span></h2>
<p>Mount the Glusterfs volume datastore and fetch the configuration from debian01.</p>
<p></p><pre class="crayon-plain-tag">mkdir /mnt/datastore
root@slayer:~# mount -t glusterfs debian01:datastore /mnt/datastore</pre><p></p>
<p>verify:</p><pre class="crayon-plain-tag">root@slayer:~# mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/roger/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=roger)
/dev/sdb1 on /media/backup type vfat (rw,nosuid,nodev)
debian01:datastore on /mnt/datastore type fuse.glusterfs (rw,allow_other,default_permissions,max_read=131072)</pre><p></p>
<p><strong>Now I stopped the node debian01.</strong></p>
<p>the Glusterfs volume is still available, although debian01 is disconnected:</p>
<p></p><pre class="crayon-plain-tag">root@slayer:~# ls -al /mnt/datastore/
insgesamt 2408
drwxr-xr-x  4 root root    8192 2012-04-17 17:25 .
drwxr-xr-x  6 root root    4096 2012-04-17 17:24 ..
-rw-r--r--  1 root root 2420250 2012-04-17 16:15 glusterfs.tar.gz
drwxr-xr-x  3 root root    8192 2012-04-17 17:17 usr
drwxr-xr-x 12 root root    8192 2012-04-17 17:25 virtualbox</pre><p></p>
<p></p><pre class="crayon-plain-tag">root@debian02:/# gluster peer status
Number of Peers: 3

Hostname: debian01
Uuid: fc556a5f-4945-467b-b095-f874b90454f3
State: Peer in Cluster (Disconnected)

Hostname: debian04
Uuid: 65f37919-6f88-48fa-a782-b4292539a9bf
State: Peer in Cluster (Connected)

Hostname: debian03
Uuid: 380fda84-b952-4261-af55-27a9d8d1afbc
State: Peer in Cluster (Connected)</pre><p></p>
<h1><span id="Logfiles">Logfiles</span></h1>
<p>Find the logfiles of glusterfs:</p>
<p></p><pre class="crayon-plain-tag">root@debian01:/etc# gluster volume log locate datastore
log file location: /var/log/glusterfs/bricks
root@debian01:/etc# less /var/log/glusterfs/bricks/export-data.log</pre><p></p>
<div id="crp_related"><h3><span id="Related_Posts">Related Posts:</span></h3><ul><li><a href="http://www.frederikkonietzny.de/2010/11/setting-up-drbd-volumes/" rel="bookmark" class="crp_title">Setting up DRBD Volumes</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup a FAI Install server on debian squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/" rel="bookmark" class="crp_title">how to determine the runtime and start time of a Linux process</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/hadoop-cluster-setup-on-debian-lenny/" rel="bookmark" class="crp_title">Hadoop Cluster Setup on Debian Lenny</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/pxe-network-boot-of-grml-rescue-system/" rel="bookmark" class="crp_title">PXE network boot of grml rescue system</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>how to setup gitorious on ubuntu server 11.10</title>
		<link>http://www.frederikkonietzny.de/2012/04/how-to-setup-gitorious-on-ubuntu-server-11-10/</link>
		<comments>http://www.frederikkonietzny.de/2012/04/how-to-setup-gitorious-on-ubuntu-server-11-10/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 15:12:47 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[11.10]]></category>
		<category><![CDATA[gitorious]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[sphinxsearch]]></category>
		<category><![CDATA[stompserver]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=138</guid>
		<description><![CDATA[In this tutorial I will describe how to setup gitorious on Ubuntu 11.10. Gitorious &#8211; a Ruby on Rails web application &#8211; can be used to conclude git projects in an easy to manage user interface. In the README of the gitorious repository I found the evidence &#8220;One of the … <a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-gitorious-on-ubuntu-server-11-10/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will describe how to setup <a href="http://www.gitorious.org/" title="gitorious">gitorious</a> on Ubuntu 11.10. Gitorious &#8211; a Ruby on Rails web application &#8211; can be used to conclude git projects in an easy to manage user interface. In the README of the gitorious repository I found the evidence &#8220;One of the main challenges in Gitorious is its installation process. It is anything but trivial.&#8221; &#8211; It appears correct <img src='http://www.frederikkonietzny.de/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  During the installation I got some errors by the sphinx search engine and some ruby gems. You will find the workarounds in this tutorial. </p>
<p><span id="more-138"></span></p>
<div id="toc_container" class="no_bullets"><p class="toc_title">Contents</p><ul class="toc_list"><li><a href="#software_installation">1 software installation</a><ul><li><a href="#Required_packages">1.1 Required packages</a></li><li><a href="#Ruby_sphinxsearch_stompserver">1.2 Ruby, sphinxsearch, stompserver</a></li><li><a href="#fetch_gitorious">1.3 fetch gitorious</a></li></ul></li><li><a href="#git_user">2 git user</a></li><li><a href="#gitorious_configuration">3 gitorious configuration</a><ul><li><a href="#prepare_configuration_files">3.1 prepare configuration files</a></li><li><a href="#create_a_secret_key">3.2 create a secret key</a></li><li><a href="#setup_configgitoriousyml">3.3 setup config/gitorious.yml</a></li><li><a href="#fix_gem_spec_files">3.4 fix gem spec files</a></li><li><a href="#fix_git-ultrasphinx">3.5 fix git-ultrasphinx</a></li></ul></li><li><a href="#Apache_configuration">4 Apache configuration</a></li><li><a href="#create_MySQL_User_for_gitorious">5 create MySQL User for gitorious</a></li><li><a href="#Starting_gitorious">6 Starting gitorious</a><ul><li><a href="#fix_ultrasphinxproductionconf">6.1 fix ultrasphinx/production.conf</a></li></ul></li><li><a href="#git-ultrasphinx_cronjob">7 git-ultrasphinx cronjob</a></li><li><a href="#create_an_admin_user">8 create an admin user</a></li><li><a href="#screenshot">9 screenshot</a><ul><li><ul><li><ul><li><a href="#gitorious">9.0.0.1 gitorious</a></li></ul></li><li><a href="#Related_Posts">9.0.1 Related Posts:</a></li></ul></li></ul></li></ul></div>

<p><strong>This tutorial is based on the <a href="https://www.gitorious.org/gitorious/pages/UbuntuInstallation" title="gitorious - UbuntuInstallation" target="_blank">gitorious &#8211; UbuntuInstallation</a> tutorial.</strong></p>
<p>In this setup I will use the hostname gitorious.linux-adm.de &#8211; change this hostname in your installation.</p>
<h1><span id="software_installation">software installation</span></h1>
<h2><span id="Required_packages">Required packages</span></h2>
<p></p><pre class="crayon-plain-tag">apt-get install build-essential zlib1g-dev tcl-dev libexpat-dev \
    libcurl4-openssl-dev postfix apache2 mysql-server mysql-client \
    apg geoip-bin libgeoip1 libgeoip-dev sqlite3 libsqlite3-dev \
    imagemagick libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev \
    libmysqlclient15-dev apache2-dev libonig-dev ruby-dev rubygems \
    libopenssl-ruby phpmyadmin libdbd-mysql-ruby libmysql-ruby \
    libmagick++-dev  zip unzip memcached git-core git-svn git-doc \
    git-cvs irb libxslt1.1 libxslt1-dev</pre><p></p>
<h2><span id="Ruby_sphinxsearch_stompserver">Ruby, sphinxsearch, stompserver</span></h2>
<p></p><pre class="crayon-plain-tag">apt-get install libchronic-ruby librmagick-ruby libdaemons-ruby \
ruby-hoe ruby-echoe libyadis-ruby ruby-mime-types libopenid-ruby \
libdifflcs-ruby libjson-ruby librack-ruby libhmac-ruby rake stompserver \
libapache2-mod-passenger rails sphinxsearch sphinxbase-utils</pre><p></p>
<h2><span id="fetch_gitorious">fetch gitorious</span></h2>
<p></p><pre class="crayon-plain-tag">git clone git://gitorious.org/gitorious/mainline.git /var/www/gitorious</pre><p></p>
<p>install missing ruby gems</p><pre class="crayon-plain-tag">cd /var/www/gitorious/
gem install bundler
bundle install</pre><p></p>
<h1><span id="git_user">git user</span></h1>
<p>Create a git user with the homedir in /var/www/gitorious/ and set the correct ownership. </p>
<p></p><pre class="crayon-plain-tag">adduser --system --home /var/www/gitorious/ --no-create-home --group --shell /bin/bash git
chown git:git -R /var/www/gitorious/</pre><p></p>
<p>Create a directory for the repositories and a cache directory. Gitorious will add the SSH public keys of the registered users to the authorized_keys file, therefore we have to create a .ssh file and an empty authorized_keys file with the correct permissions.</p>
<p></p><pre class="crayon-plain-tag">su - git
git submodule init &amp;&amp; \
git submodule update
mkdir -p tmp/pids
mkdir repositories
mkdir tarballs
mkdir .ssh
touch .ssh/authorized_keys
chmod 700 .ssh/
chmod 600 .ssh/authorized_keys</pre><p></p>
<p>Put gitorious binary on path:</p><pre class="crayon-plain-tag">cat &gt;&gt; /var/www/gitorious/.bash_profile &lt;&lt;EOF
export PATH=&quot;$PATH:/var/www/gitorious/script/&quot;
EOF</pre><p></p>
<h1><span id="gitorious_configuration">gitorious configuration</span></h1>
<h2><span id="prepare_configuration_files">prepare configuration files</span></h2>
<p></p><pre class="crayon-plain-tag">cd /var/www/gitorious
cp config/database.sample.yml config/database.yml
cp config/gitorious.sample.yml config/gitorious.yml
cp config/broker.yml.example config/broker.yml</pre><p></p>
<h2><span id="create_a_secret_key">create a secret key</span></h2>
<p>Create a secret key for the session cookie. (we need this key later in the next step.</p>
<p></p><pre class="crayon-plain-tag">apg -m 32</pre><p></p>
<h2><span id="setup_configgitoriousyml">setup config/gitorious.yml</span></h2>
<p>Setup gitorious in /var/www/gitorious/config/gitorious.yml:</p>
<p><code><br />
	  repository_base_path: "/var/www/gitorious/repositories"</p>
<p>          cookie_secret: xxx         # add a secret key here the command "apg -m 32"</p>
<p>          gitorious_client_port should be 80</p>
<p>	  gitorious_host: gitorious.linux-adm.de       # change to your hostname</p>
<p>          archive_cache_dir: "/var/www/gitorious/tarballs"</p>
<p>	  archive_work_dir: "/tmp/tarballs-work"</p>
<p>	  hide_http_clone_urls: true</p>
<p>	  is_gitorious_dot_org: false<br />
</code></p>
<p>Create the logroate configuration and the init scripts.</p>
<p></p><pre class="crayon-plain-tag">cp /var/www/gitorious/doc/templates/ubuntu/gitorious-logrotate /etc/logrotate.d/

cp /var/www/gitorious/doc/templates/ubuntu/git-ultrasphinx /etc/init.d/
cp /var/www/gitorious/doc/templates/ubuntu/git-daemon /etc/init.d/
cp /var/www/gitorious/doc/templates/ubuntu/git-poller /etc/init.d/</pre><p></p>
<p>Set in  /etc/init.d/git-daemon and in  /etc/init.d/git-poller the RUBY_HOME variable to &#8220;/usr&#8221;<br />
<code><br />
#RUBY_HOME="/opt/ruby-enterprise"<br />
RUBY_HOME="/usr"<br />
</code></p>
<p>Activate the new gitorious init scripts</p>
<p></p><pre class="crayon-plain-tag">update-rc.d git-daemon defaults &amp;&amp; \
    update-rc.d git-poller defaults &amp;&amp; \
    update-rc.d git-ultrasphinx defaults</pre><p></p>
<h2><span id="fix_gem_spec_files">fix gem spec files</span></h2>
<p>Try to start /etc/init.d/git-ultrasphinx<br />
If you get the following error message you have to fix the spec files:</p>
<p></p><pre class="crayon-plain-tag">root@ubuntu03:/var/www/gitorious# /etc/init.d/git-ultrasphinx start
Invalid gemspec in [/var/lib/gems/1.8/specifications/json-1.5.4.gemspec]: invalid date format in specification: &quot;2011-08-31 00:00:00.000000000Z&quot;
Invalid gemspec in [/var/lib/gems/1.8/specifications/childprocess-0.2.1.gemspec]: invalid date format in specification: &quot;2011-08-11 00:00:00.000000000Z&quot;
Invalid gemspec in [/var/lib/gems/1.8/specifications/paperclip-2.4.5.gemspec]: invalid date format in specification: &quot;2011-10-21 00:00:00.000000000Z&quot;
(in /var/www/gitorious)
Invalid gemspec in [/var/lib/gems/1.8/specifications/json-1.5.4.gemspec]: invalid date format in specification: &quot;2011-08-31 00:00:00.000000000Z&quot;
Invalid gemspec in [/var/lib/gems/1.8/specifications/childprocess-0.2.1.gemspec]: invalid date format in specification: &quot;2011-08-11 00:00:00.000000000Z&quot;
Invalid gemspec in [/var/lib/gems/1.8/specifications/paperclip-2.4.5.gemspec]: invalid date format in specification: &quot;2011-10-21 00:00:00.000000000Z&quot;
Invalid gemspec in [/var/lib/gems/1.8/specifications/json-1.5.4.gemspec]: invalid date format in specification: &quot;2011-08-31 00:00:00.000000000Z&quot;
Invalid gemspec in [/var/lib/gems/1.8/specifications/childprocess-0.2.1.gemspec]: invalid date format in specification: &quot;2011-08-11 00:00:00.000000000Z&quot;
Invalid gemspec in [/var/lib/gems/1.8/specifications/paperclip-2.4.5.gemspec]: invalid date format in specification: &quot;2011-10-21 00:00:00.000000000Z&quot;
rake aborted!
Bundler couldn't find some gems. Did you run `bundle install`?
/var/www/gitorious/Rakefile:4
(See full trace by running task with --trace)</pre><p></p>
<p>Change the &#8220;s.date&#8221; in the following spec files:</p>
<p>/var/lib/gems/1.8/specifications/json-1.5.4.gemspec<br />
/var/lib/gems/1.8/specifications/childprocess-0.2.1.gemspec<br />
/var/lib/gems/1.8/specifications/paperclip-2.4.5.gemspec</p>
<p>from:<br />
<code><br />
  s.date = %q{2011-08-31 00:00:00.000000000Z}<br />
</code><br />
in:<br />
<code><br />
  s.date = %q{2012-08-31}<br />
</code></p>
<h2><span id="fix_git-ultrasphinx">fix git-ultrasphinx</span></h2>
<p>You have to fix the /var/www/gitorious/config/boot.rb file,<br />
if you get the following error message after starting /etc/init.d/git-ultrasphinx.</p>
<p></p><pre class="crayon-plain-tag">root@ubuntu03:/var/www/gitorious# /etc/init.d/git-ultrasphinx start
(in /var/www/gitorious)
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
/var/www/gitorious/Rakefile:10:in `require'
(See full trace by running task with --trace)</pre><p></p>
<p>Add the following line in /var/www/gitorious/config/boot.rb.</p>
<p><code><br />
# Don't change this file!<br />
# Configure your app in config/environment.rb and config/environments/*.rb</p>
<p>require 'thread'<br />
</code></p>
<h1><span id="Apache_configuration">Apache configuration</span></h1>
<p>Disable the default vhost configuration</p>
<p></p><pre class="crayon-plain-tag">a2dissite default
a2dissite default-ssl</pre><p></p>
<p>create a new vhost configuration</p><pre class="crayon-plain-tag">cat &gt;&gt; /etc/apache2/sites-available/gitorious &lt;&lt;EOF
&lt;VirtualHost *:80&gt;
    ServerName gitorious.linux-adm.de         # change the hostname!
    DocumentRoot /var/www/gitorious/public
&lt;/VirtualHost&gt;
EOF</pre><p></p>
<p>create a new SSL vhost configuration</p><pre class="crayon-plain-tag">cat &gt;&gt; /etc/apache2/sites-available/gitorious-ssl &lt;&lt;EOF
&lt;IfModule mod_ssl.c&gt;
    &lt;VirtualHost _default_:443&gt;
        ServerName gitorious.linux-adm.de   # change the hostname!
        DocumentRoot /var/www/gitorious/public
        SSLEngine on
        SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
        SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
        BrowserMatch &quot;.*MSIE.*&quot; nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    &lt;/VirtualHost&gt;
&lt;/IfModule&gt;
EOF</pre><p></p>
<p></p><pre class="crayon-plain-tag">a2ensite gitorious
a2ensite gitorious-ssl
a2enmod ssl   # enable SSL</pre><p></p>
<h1><span id="create_MySQL_User_for_gitorious">create MySQL User for gitorious</span></h1>
<p></p><pre class="crayon-plain-tag">mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'gitorious'@'localhost' IDENTIFIED BY 'XXXX' WITH GRANT OPTION;
FLUSH PRIVILEGES;</pre><p><strong>change the password XXXX!</strong></p>
<p>Add the MySQL User to the production section in /var/www/gitorious/config/database.yml </p>
<p><code><br />
production:<br />
  adapter: mysql<br />
  database: gitorious_production<br />
  username: gitorious<br />
  password: XXXX      # change the password!<br />
  host: localhost<br />
  encoding: utf8<br />
</code></p>
<p><center></p>
<div>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4450147633208283";
/* 250_250_media */
google_ad_slot = "4856058014";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p></center></p>
<h1><span id="Starting_gitorious">Starting gitorious</span></h1>
<p>Run the following commands as user git.</p>
<p></p><pre class="crayon-plain-tag">export RAILS_ENV=production &amp;&amp; 
bundle exec rake db:create &amp;&amp; 
bundle exec rake db:migrate &amp;&amp; 
bundle exec rake ultrasphinx:bootstrap</pre><p></p>
<h2><span id="fix_ultrasphinxproductionconf">fix ultrasphinx/production.conf</span></h2>
<p>If you get the following error message, you have to fix the /var/www/gitorious/ultrasphinx/production.conf file.</p>
<p></p><pre class="crayon-plain-tag">export RAILS_ENV=production &amp;&amp; 
bundle exec rake db:create &amp;&amp; 
bundle exec rake db:migrate &amp;&amp; 
bundle exec rake ultrasphinx:bootstrap

Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file '/var/www/gitorious/config/ultrasphinx/production.conf'...
WARNING: key 'address' is deprecated in /var/www/gitorious/config/ultrasphinx/production.conf line 11; use 'listen' instead.
listening on all interfaces, port=3312
WARNING: index 'main': preload: failed to open /var/www/gitorious/db/sphinx//sphinx_index_main.sph: No such file or directory; NOT SERVING
FATAL: no valid indexes to serve
Failed to start
Done
Please restart your application containers</pre><p></p>
<p>Change in /var/www/gitorious/config/ultrasphinx/production.conf the word &#8220;base_tags&#8221; to &#8220;tags&#8221;.</p>
<h1><span id="git-ultrasphinx_cronjob">git-ultrasphinx cronjob</span></h1>
<p>Add the following cronjob for the git user.</p>
<p></p><pre class="crayon-plain-tag">crontab -e -u git</pre><p></p>
<p><code><br />
* * * * * cd /var/www/gitorious &#038;&#038; /usr/local/bin/bundle exec rake ultrasphinx:index RAILS_ENV=production<br />
</code></p>
<h1><span id="create_an_admin_user">create an admin user</span></h1>
<p></p><pre class="crayon-plain-tag">git@ubuntu03:/var/www/gitorious$ env RAILS_ENV=production ruby1.8 script/create_admin
Type in Administrator's e-mail: 
admin@gitorious.linux-adm.de
Type in Administrator's password: 
test
Admin user created successfully.</pre><p></p>
<h1><span id="screenshot">screenshot</span></h1>
<p>After a reboot of your system the gitorious web front-end should be available.</p>
<div class="flashalbum" style="width:100%;height:500px;">
<div class="flagallery_swfobject" id="sid_114403120_div"><style type="text/css">
@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_nocrawler.css");@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_noflash.css");
#fancybox-title-over .title { color: #ff9900; }
#fancybox-title-over .descr { color: #cfcfcf; }
.flag_alternate .flagcatlinks { background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat { border-color: #ffffff; color: #ffffff; background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat:hover { border-color: #ffffff; }
.flag_alternate .flagcatlinks a.active, .flag_alternate .flagcatlinks a.flagcat:hover { color: #ffffff; background-color: #737373; }
	.flag_alternate .flagcategory a.flag_pic_alt { background-color: #ffffff; border: 2px solid #ffffff; color: #ffffff; }
.flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #ffffff; border: 2px solid #4a4a4a; color: #4a4a4a; }
.flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #4a4a4a; }
</style>
	<script type="text/javascript">var ExtendVar='fancybox', hitajax = 'http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/lib/hitcounter.php';</script>
	<div id="sid_114403120_jq" class="flag_alternate">
		<div class="flagcatlinks"></div>
			<div class="flagCatMeta">
			<h4><span id="gitorious">gitorious</span></h4>
			<p></p>
		</div>
		<div class="flagcategory" id="gid_4_sid_114403120">
			<a class="i0 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/gitorious/git.jpg" id="flag_pic_9" rel="gid_4_sid_114403120" title="">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/gitorious/thumbs/thumbs_git.jpg]<span class="flag_pic_desc" id="flag_desc_9"><strong></strong><br /><span></span></span></a>		</div>
	</div>

</div></div>
<script type="text/javascript" defer="defer">
flag_alt['sid_114403120'] = jQuery("div#sid_114403120_jq").clone().wrap(document.createElement('div')).parent().html();
var sid_114403120_div = {
	params : {
		wmode : "opaque",
		allowfullscreen : "true",
		allowScriptAccess : "always",
		saling : "lt",
		scale : "noScale",
		menu : "false",
		bgcolor : "#281e15"},
	flashvars : {
		path : "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/",
		gID : "4",
		galName : "gitorious",
		skinID : "sid_114403120",
		postID : "138",
		postTitle : "how+to+setup+gitorious+on+ubuntu+server+11.10+"},
	attr : {
		styleclass : "flashalbum",
		id : "sid_114403120"},
	start : function() {
		swfobject.embedSWF("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/gallery.swf", "sid_114403120_div", "100%", "100%", "10.1.52", "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/skins/expressInstall.swf", this.flashvars, this.params , this.attr );
swfobject.createCSS("#sid_114403120","outline:none");
	}
}
sid_114403120_div.start();
</script>
<div id="crp_related"><h3><span id="Related_Posts">Related Posts:</span></h3><ul><li><a href="http://www.frederikkonietzny.de/2011/08/how-to-setup-postfix-with-spampd-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup Postfix with spampd on Debian Squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/" rel="bookmark" class="crp_title">how to determine the runtime and start time of a Linux process</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup a FAI Install server on debian squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/check-the-status-exit-code-of-pipelined-commands-with-pipestatus/" rel="bookmark" class="crp_title">check the status / exit code of pipelined commands with PIPESTATUS</a></li><li><a href="http://www.frederikkonietzny.de/2011/10/perl-script-for-logfile-monitoring/" rel="bookmark" class="crp_title">Perl script for logfile monitoring</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2012/04/how-to-setup-gitorious-on-ubuntu-server-11-10/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>new nagios / icinga plugin check_juniper_srx_ipsec_tunnel.pl</title>
		<link>http://www.frederikkonietzny.de/2012/04/new-nagios-icinga-plugin-check_juniper_srx_ipsec_tunnel-pl/</link>
		<comments>http://www.frederikkonietzny.de/2012/04/new-nagios-icinga-plugin-check_juniper_srx_ipsec_tunnel-pl/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 07:23:57 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[ipsec]]></category>
		<category><![CDATA[juniper]]></category>
		<category><![CDATA[snmp]]></category>
		<category><![CDATA[srx]]></category>
		<category><![CDATA[state]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=104</guid>
		<description><![CDATA[At the weekend I completed a new nagios / icinga plugin. The check_juniper_srx_ipsec_tunnel.pl plugin checks via SNMP the IPSec VPN / Tunnel State for a given VPN Gateway on a Juniper SRX gateway. [crayon-4fb769547b23f/] You will find the plugin on my projects page Related Posts:how to determine the runtime and … <a href="http://www.frederikkonietzny.de/2012/04/new-nagios-icinga-plugin-check_juniper_srx_ipsec_tunnel-pl/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>At the weekend I completed a new nagios / icinga plugin. The check_juniper_srx_ipsec_tunnel.pl plugin checks via SNMP the IPSec VPN / Tunnel State for a given VPN Gateway on a Juniper SRX gateway.</p>
<p> <span id="more-104"></span></p><pre class="crayon-plain-tag">Usage: ./check_juniper_srx_ipsec_tunnel.pl -H &amp;lt;Juniper Hostname&amp;gt; -g &amp;lt;IPSec Tunnel Gateway&amp;gt; -C &amp;lt;SNMP Community&amp;gt;</pre><p> </p>
<p>You will find the plugin on my <a href="http://www.frederikkonietzny.de/projects/" title="projects">projects page</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/" rel="bookmark" class="crp_title">how to determine the runtime and start time of a Linux process</a></li><li><a href="http://www.frederikkonietzny.de/2011/10/how-to-setup-bonding-on-debian-linux/" rel="bookmark" class="crp_title">How to setup bonding on Debian Linux</a></li><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/" rel="bookmark" class="crp_title">How to setup and expand a replicated Glusterfs 3.2.4 volume on Debian 6.x</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-test-the-plain-and-encrypted-smtppop3imap-and-http-protocols/" rel="bookmark" class="crp_title">how to test the plain and encrypted SMTP/POP3/IMAP and HTTP protocols</a></li><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-gitorious-on-ubuntu-server-11-10/" rel="bookmark" class="crp_title">how to setup gitorious on ubuntu server 11.10</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2012/04/new-nagios-icinga-plugin-check_juniper_srx_ipsec_tunnel-pl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to determine the runtime and start time of a Linux process</title>
		<link>http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/</link>
		<comments>http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 15:57:53 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[hertz]]></category>
		<category><![CDATA[Jiffies]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[proc]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[runtime]]></category>
		<category><![CDATA[start time]]></category>
		<category><![CDATA[stat]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=15</guid>
		<description><![CDATA[Yesterday, I needed to determine the runtime of a Linux process for a monitoring script. Cos the format for start_time of the ps command may change if the process was not started in the same year, I decided to take the neccessary informations from the /proc/&#60;PID&#62;/stat file. In this file … <a href="http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I needed to determine the runtime of a Linux process for a monitoring script.</p>
<p>Cos the format for start_time of the ps command may change if the process was not started in the same year, I decided to take the neccessary informations from the /proc/&lt;PID&gt;/stat file.</p>
<p>In this file the process start time <strong>since boot</strong> is defined at the twenty-second field, expressed in <a title="Jiffies" href="http://en.wikipedia.org/wiki/Jiffies" target="_blank">Jiffies</a> &#8211; the scale unit of the system timer. (One Jiffie is one tick of the system timer).</p>
<p>To convert Jiffies to seconds I just have to divide the number of Jiffies by the frequency (hertz) of the system timer, which is defined in the Linux Kernel header file include/asm-generic/param.h. The frequency may differ between Linux kernel versions and hardware platform! On my Linux systems the frequency is 100 HZ.</p>
<p><span id="more-15"></span></p>
<p>In a shell script the following line will determine the start-time of a process since boot time.</p>
<p></p><pre class="crayon-plain-tag">HZ=&quot;100&quot;
((p_seconds_since_boot = $(cat /proc/$PID/stat | cut -d &quot; &quot; -f 22) / $HZ ))</pre><p></p>
<p>To get the absolute start time I am adding the boot time of the Linux system from the /proc/stat file to the start time of<br />
the process.</p>
<p></p><pre class="crayon-plain-tag">boottime=$(grep btime /proc/stat | cut -d &quot; &quot; -f 2)
(( p_starttime = $boottime + $p_seconds_since_boot ))</pre><p></p>
<p>To get the runtime in seconds of the process I just subtract the absolute start time of the process from the actual time.</p>
<p></p><pre class="crayon-plain-tag">now=$(date &quot;+%s&quot;)
(( p_runtime = $now - $p_starttime ))</pre><p></p>
<p>Download the nagios / icinga plugin from my <a href="http://www.frederikkonietzny.de/projects/" title="projects page">projects page</a> or the check the  following example which shows a simple shell script that takes a process string and determine the runtime and the start time. </p>
<p></p><pre class="crayon-plain-tag">#!/bin/bash
#------------------------------------------------------------
# starttime.sh
#------------------------------------------------------------


if (($# != 2)); then
        echo -e &quot;\n\tUsage: $0 -p \&quot;process string\&quot; \n&quot; &gt;&amp;2
        exit 4
fi

while getopts &quot;:p:&quot; opt; do
  case $opt in
    p)
                process=&quot;$OPTARG&quot;
      ;;
    \?)
      echo &quot;Invalid option: -$OPTARG&quot; &gt;&amp;2
      ;;
     :)
      echo &quot;Option -$OPTARG requires an argument.&quot; &gt;&amp;2
      exit 1
      ;;
  esac
done

PID=$(pgrep -oxf &quot;$process&quot;)
test -z $PID &amp;&amp; {
        echo -e &quot;\n\tError: \&quot;$process\&quot; not found\n\n&quot;
        exit 4
}

test -f /proc/stat || {
        echo -e &quot;\n\tError: \&quot;/proc/stat\&quot; not found\n\n&quot;
        exit 4
}

HZ=&quot;100&quot; 
now=$(date &quot;+%s&quot;)

boottime=$(grep btime /proc/stat | cut -d &quot; &quot; -f 2)

((p_seconds_since_boot = $(cat /proc/$PID/stat | cut -d &quot; &quot; -f 22) / $HZ ))

(( p_starttime = $boottime + $p_seconds_since_boot ))

(( p_runtime = $now - $p_starttime ))

echo -en &quot;\nProcess \&quot;$process\&quot; is running since &quot;
echo -e &quot;$p_runtime Seconds (Started: $(date -d @$p_starttime))\n&quot;
#------------------------------------------------------------
# eof
#------------------------------------------------------------</pre><p></p>
<p>Output of the script for the pidgin process. </p>
<p></p><pre class="crayon-plain-tag">roger@slayer:~/scripts/starttime$ ./starttime.sh -p pidgin

Process &quot;pidgin&quot; is running since 13795 Seconds (Started: Sa 31. M&auml;r 14:28:13 CEST 2012)</pre><p></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2012/04/new-nagios-icinga-plugin-check_juniper_srx_ipsec_tunnel-pl/" rel="bookmark" class="crp_title">new nagios / icinga plugin check_juniper_srx_ipsec_tunnel.pl</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/performance-monitoring-with-nmon/" rel="bookmark" class="crp_title">Performance monitoring with nmon</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/pxe-network-boot-of-grml-rescue-system/" rel="bookmark" class="crp_title">PXE network boot of grml rescue system</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup a FAI Install server on debian squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/" rel="bookmark" class="crp_title">How to setup and expand a replicated Glusterfs 3.2.4 volume on Debian 6.x</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2012/03/how-to-determine-the-runtime-and-start-time-of-a-linux-process/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to setup bonding on Debian Linux</title>
		<link>http://www.frederikkonietzny.de/2011/10/how-to-setup-bonding-on-debian-linux/</link>
		<comments>http://www.frederikkonietzny.de/2011/10/how-to-setup-bonding-on-debian-linux/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 19:33:16 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[High availability]]></category>
		<category><![CDATA[bond]]></category>
		<category><![CDATA[bonding]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[ifenslave]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=163</guid>
		<description><![CDATA[In this article I will describe the setup of bonding on a debian linux system for a high availability setup. The host is connected with two network cards to two different switches. If a switch or a network card fails the host will be still available in the network. Purpose … <a href="http://www.frederikkonietzny.de/2011/10/how-to-setup-bonding-on-debian-linux/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>In this article I will describe the setup of bonding on a debian linux system for a high availability setup. The host is connected with two network cards to two different switches. If a switch or a network card fails the host will be still available in the network.</p>
<p><span id="more-163"></span></p>
<div class="flashalbum" style="width:100%;height:500px;">
<div class="flagallery_swfobject" id="sid_1095069480_div"><style type="text/css">
@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_nocrawler.css");@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_noflash.css");
#fancybox-title-over .title { color: #ff9900; }
#fancybox-title-over .descr { color: #cfcfcf; }
.flag_alternate .flagcatlinks { background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat { border-color: #ffffff; color: #ffffff; background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat:hover { border-color: #ffffff; }
.flag_alternate .flagcatlinks a.active, .flag_alternate .flagcatlinks a.flagcat:hover { color: #ffffff; background-color: #737373; }
	.flag_alternate .flagcategory a.flag_pic_alt { background-color: #ffffff; border: 2px solid #ffffff; color: #ffffff; }
.flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #ffffff; border: 2px solid #4a4a4a; color: #4a4a4a; }
.flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #4a4a4a; }
</style>
	<script type="text/javascript">var ExtendVar='fancybox', hitajax = 'http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/lib/hitcounter.php';</script>
	<div id="sid_1095069480_jq" class="flag_alternate">
		<div class="flagcatlinks"></div>
			<div class="flagCatMeta">
			<h4>bonding</h4>
			<p></p>
		</div>
		<div class="flagcategory" id="gid_5_sid_1095069480">
			<a class="i0 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/bonding/ha-bonding400x400.jpg" id="flag_pic_10" rel="gid_5_sid_1095069480" title="">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/bonding/thumbs/thumbs_ha-bonding400x400.jpg]<span class="flag_pic_desc" id="flag_desc_10"><strong></strong><br /><span></span></span></a>		</div>
	</div>

</div></div>
<script type="text/javascript" defer="defer">
flag_alt['sid_1095069480'] = jQuery("div#sid_1095069480_jq").clone().wrap(document.createElement('div')).parent().html();
var sid_1095069480_div = {
	params : {
		wmode : "opaque",
		allowfullscreen : "true",
		allowScriptAccess : "always",
		saling : "lt",
		scale : "noScale",
		menu : "false",
		bgcolor : "#281e15"},
	flashvars : {
		path : "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/",
		gID : "5",
		galName : "Linux",
		skinID : "sid_1095069480",
		postID : "163",
		postTitle : "How+to+setup+bonding+on+Debian+Linux+"},
	attr : {
		styleclass : "flashalbum",
		id : "sid_1095069480"},
	start : function() {
		swfobject.embedSWF("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/gallery.swf", "sid_1095069480_div", "100%", "100%", "10.1.52", "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/skins/expressInstall.swf", this.flashvars, this.params , this.attr );
swfobject.createCSS("#sid_1095069480","outline:none");
	}
}
sid_1095069480_div.start();
</script>
<h1>Purpose</h1>
<p>This document describes how to setup and configure bonding on debian linux.</p>
<h1>General</h1>
<p>Linux bonding is an arrangement of two or more network interfaces on the same host for redundancy or performance benefit. The new logical network interface is called bonding interface (devices are bond0, bond1, bond2,..) The network interfaces ethX becoming the slave interfaces. On other platforms bonding its known under different names, like port trunking on cisco IOS.</p>
<h1>List of references</h1>
<ul>
<li><a href="http://www.amazon.de/gp/product/3836213397?ie=UTF8&#038;tag=frederikkonie-21&#038;linkCode=as2&#038;camp=1638&#038;creative=6742&#038;creativeASIN=3836213397">Linux Hochverfügbarkeit: Einsatzszenarien und Praxislösungen (Galileo Computing)</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.de/e/ir?t=frederikkonie-21&amp;l=as2&#038;o=3&#038;a=3836213397" border="0" alt="" width="1" height="1" /></li>
<li><a href="http://www.kernel.org/doc/Documentation/networking/bonding.txt">bonding.txt</a></li>
</ul>
<h1>Prerequisite</h1>
<p>For this tutorial we need a linux debian host with at least two network interfaces (eth0, eth1).</p>
<h1>Installation and setup</h1>
<p>Install the following debian package.</p>
<p></p><pre class="crayon-plain-tag">apt-get install ifenslave-2.6</pre><p> </p>
<h1>Bonding kernel module options</h1>
<h2>option mode</h2>
<p>There are several bonding policies (mode)</p>
<ul>
<li>0 = balance-rr. The default mode balance-rr is a round-robin policy providing load balancing and fault tolerance, use this mode for performance benefits.</li>
<li>1 = active-backup. In the active-backup mode, only one slave of the bond is active, if a link failure is detected on it, another slave becomes active and takes over the MAC address of the last active slave.</li>
<li>2 = balance-xor. This mode is using all slaves, and the link for the transmisson, is calculated by the following policy [(source MAC address XOR'd with destination MAC address)modulo slave count], to select other. This mode is configurable with the xmit_hash_policy. This modes provides load balancing and fault tolerance</li>
<li>3 = broadcast. Broadcast from all slaves. This mode provides fault tolerance</li>
<li>4 = 802.3ad. IEEE 802.3ad Dynamic link aggregation. A switch thats supports IEEE 802.3ad Dynamic link aggregation is needed</li>
<li>5 = balance-tlb. In this mode, the incoming traffic is received by the active slave, the outgoing traffic is load balanced through all slaves, depending on the current slaves load.</li>
</ul>
<p>For the complete description read the official documentation: <a href="http://www.kernel.org/doc/Documentation/networking/bonding.txt">bonding.txt</a> In this tutorial we will use mode 1 (active-backup)</p>
<p>To change the mode of an active bonding device use the sysfs interface</p>
<p></p><pre class="crayon-plain-tag">echo 1 &gt; /sys/class/net/bond0/bonding/mode</pre><p></p>
<h2>option miimon</h2>
<p>The option miimon defines how often the MII link is monitored  (in milliseconds). We will use a value of 100 for our setup.</p>
<h2>option max_bonds</h2>
<p>max_bonds defines the number of bonding devices the kernel module has to create. (Default is 1)</p>
<h2>option downdelay</h2>
<p>Downdelay defines the time to wait before deactivating a slave, after a link failure has been detected. We will use a value of 200 for our setup.</p>
<h2>option updelay</h2>
<p>Updelay defines the time to wait before activating a slave, after a link recovery has been detected. We will use a value of 200 for our setup</p>
<h1>Setup bonding manually</h1>
<p></p><pre class="crayon-plain-tag">modprobe bonding mode=1 miimon=100 max_bonds=1 downdelay=200 updelay=200</pre><p></p>
<h2>load module at system startup</h2>
<p>Add the following lines to /etc/modprobe.d/arch/x86_64 or /etc/modprobe.d/arch/i386, depending on your systems architecture.</p>
<blockquote><p>alias bond0     bonding<br />
options bonding mode=1 miimon=100 downdelay=200 updelay=200
</p></blockquote>
<p>Add the following line to /etc/modules to load the bonding module at the system startup.</p>
<blockquote><p>bonding</p></blockquote>
<p>Update kernel modules</p>
<p></p><pre class="crayon-plain-tag">update-modules</pre><p></p>
<h2>Start the bonding interface manually</h2>
<p>Start the bonding interface with the ifconfig command (Replace <em>IP</em>, <em>NETMASK</em> and <em>BROADCAST</em> with the correct values for your network before)</p>
<p></p><pre class="crayon-plain-tag">ifconfig bond0 IP netmask NETMASK broadcast BROADCAST up</pre><p></p>
<p>Attach the network interfaces eth0 and eth1 to the bond0 interface with the ifenslave command</p>
<p></p><pre class="crayon-plain-tag">ifenslave bond0 eth0
ifenslave bond0 eth1</pre><p></p>
<p>The bonding interface is now available, use one of the next /etc/network/interface configurations, to start the bonding interface automatically at system startup.</p>
<h2>setup the interface</h2>
<p>Add the following lines to /etc/network/interfaces and replace <em>IP</em>, <em>NETMASK</em>, <em>GATEWAY</em> and <em>BROADCAST</em> with the correct values for your network.</p>
<blockquote><p>
auto bond0<br />
iface bond0 inet static<br />
address IP<br />
netmask NETMASK<br />
up /sbin/ifenslave bond0 eth0<br />
up /sbin/ifenslave bond0 eth1<br />
gateway GATEWAY<br />
broadcast BROADCAST
</p></blockquote>
<h2>restart networking</h2>
<p>Restart your network configuration with the following command</p>
<p></p><pre class="crayon-plain-tag">/etc/init.d/networking restart</pre><p></p>
<h1>Setup the bonding interface automatically</h1>
<p>Add the following lines to /etc/network/interfaces and replace <em>IP</em>, <em>NETMASK</em>, <em>GATEWAY</em> and <em>BROADCAST</em> with the correct values for your network.</p>
<p>In this setup, the mode of the bonding modul is configured in the interfaces file. It`s not necessary to define the mode of the bonding interface at the module load time in this setup. Other supported options are bond_mode, bond_miimon, bond_primary, bond_updelay, bond_downdelay, bond_arp_ip_target, bond_arp_interval, bond_xmit_hash_policy and bond_lacp_rate.</p>
<h2>setup the interface</h2>
<p>Add the following lines to /etc/network/interfaces</p>
<blockquote><p>
iface bond0 inet static<br />
address IP<br />
netmask NETMASK<br />
broadcast BROADCAST<br />
gateway GATEWAY<br />
slaves eth0 eth1<br />
bond_mode    active-backup<br />
bond_primary eth0
</p></blockquote>
<h2>restart networking</h2>
<p>Restart your network configuration with the following command</p>
<p></p><pre class="crayon-plain-tag">/etc/init.d/networking restart</pre><p></p>
<h1>status monitoring</h1>
<p>The status of the bonding interface is in /proc/net/bonding/bond0</p>
<p></p><pre class="crayon-plain-tag">user@host:~ # cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:28:18:47:11:2e
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:28:18:47:11:2f</pre><p></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2010/11/hadoop-cluster-setup-on-debian-lenny/" rel="bookmark" class="crp_title">Hadoop Cluster Setup on Debian Lenny</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup a FAI Install server on debian squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/pxe-network-boot-of-grml-rescue-system/" rel="bookmark" class="crp_title">PXE network boot of grml rescue system</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/setting-up-drbd-volumes/" rel="bookmark" class="crp_title">Setting up DRBD Volumes</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/performance-monitoring-with-nmon/" rel="bookmark" class="crp_title">Performance monitoring with nmon</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2011/10/how-to-setup-bonding-on-debian-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl script for logfile monitoring</title>
		<link>http://www.frederikkonietzny.de/2011/10/perl-script-for-logfile-monitoring/</link>
		<comments>http://www.frederikkonietzny.de/2011/10/perl-script-for-logfile-monitoring/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 14:30:24 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[logfile]]></category>
		<category><![CDATA[monitors]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[pointer]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=161</guid>
		<description><![CDATA[The following Perl script monitors a logfile for an error message, if the message is found the exit code of the Perl script is 1. Combine this error code with a cronjob to restart a daemon if the error message rise up. To save resources the script saves the file … <a href="http://www.frederikkonietzny.de/2011/10/perl-script-for-logfile-monitoring/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>The following Perl script monitors a logfile for an error message, if the message is found the exit code of the Perl script is 1. Combine this error code with a cronjob to restart a daemon if the error message rise up. To save resources the script saves the file pointer position of the file, and reads at the next run only new lines behind this pointer. (all old lines are ignored)</p>
<p><span id="more-161"></span><br />
Example cronjob from /etc/crontab or the <em>crontab -e</em> command:</p>
<blockquote><p>
*/2 * * * *  /usr/local/bin/apache_check.pl /var/log/apache2/error.log  || /etc/init.d/apache2 restart
</p></blockquote>
<p></p><pre class="crayon-plain-tag">#!/usr/bin/perl -w
#------------------------------------------------------------
# save position
#------------------------------------------------------------
sub save_pos {
my $pos = $_[0];
my $file = $_[1];

open(POS, &quot;&amp;gt;$file&quot;) || die &quot;error&quot;;
     print POS &quot;$pos&quot;;
     close(POS);
}

#------------------------------------------------------------
# get position
#------------------------------------------------------------
sub get_pos {
     my $file = $_[0];
     my $pos = 0;

      open(POS, &quot;&amp;lt;$file&quot;) || die &quot;error&quot;;;

      $pos=(&amp;lt;POS&amp;gt;);
      if ($pos !~ /^\d+/) {
        $pos=0;
      }
      close(POS);
      return $pos;
}

#------------------------------------------------------------
# main
#------------------------------------------------------------
my $datafile=&quot;&quot;;

if (defined $ARGV[0] &amp;amp;&amp;amp; -r $ARGV[0] ) {
       $datafile=&quot;$ARGV[0]&quot;;
} else {
       die &quot;Usage: $0 \n&quot;;
}
my $posfile=&quot;/tmp/pos.txt&quot;;
my $oldpos=0;
my $lines=0;
my $foundpattern=0;
my $ret=0;

if (-e $datafile) {
       open(DATA, &quot;&amp;lt;$datafile&quot;) || die &quot;error&quot;;
       if (-e $posfile) {
              $oldpos=get_pos($posfile);
              # check if this is a new file
              seek(DATA, 0, 2);
              if ($oldpos &amp;gt; tell(DATA)) {
                            #print &quot;new file - e.g. logrotate\n&quot;;
                            $oldpos=0;
              }
              seek(DATA, $oldpos, 0);
        }
        while(&amp;lt;DATA&amp;gt;) {
              $lines++;
              #print &quot;$_&quot;;
              if ($_ =~ /child pid [d]+ exit signal Segmentation fault/) {
                            #print &quot;Found pattern\n&quot;;
                            $foundpattern++;
              }
        }
        if ($lines &amp;gt; 0) {
              #print &quot;Save Pos!n&quot;;
              save_pos(tell(DATA), $posfile);
        }
        close(DATA);
}

print &quot;Found pattern $foundpattern times\n&quot;;
if ($foundpattern &amp;gt; 0) {
	$ret=1;
}

exit $ret;
#------------------------------------------------------------
# eof
#------------------------------------------------------------</pre><p> </p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2010/11/check-the-status-exit-code-of-pipelined-commands-with-pipestatus/" rel="bookmark" class="crp_title">check the status / exit code of pipelined commands with PIPESTATUS</a></li><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-gitorious-on-ubuntu-server-11-10/" rel="bookmark" class="crp_title">how to setup gitorious on ubuntu server 11.10</a></li><li><a href="http://www.frederikkonietzny.de/2011/07/pipe-viewer-monitoring-limit-the-throughput-of-a-pipe/" rel="bookmark" class="crp_title">pipe viewer &#8211; monitoring / limit the throughput of a pipe</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-test-the-plain-and-encrypted-smtppop3imap-and-http-protocols/" rel="bookmark" class="crp_title">how to test the plain and encrypted SMTP/POP3/IMAP and HTTP protocols</a></li><li><a href="http://www.frederikkonietzny.de/2011/08/how-to-setup-postfix-with-spampd-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup Postfix with spampd on Debian Squeeze</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2011/10/perl-script-for-logfile-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance monitoring with nmon</title>
		<link>http://www.frederikkonietzny.de/2011/09/performance-monitoring-with-nmon/</link>
		<comments>http://www.frederikkonietzny.de/2011/09/performance-monitoring-with-nmon/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 19:50:25 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[nmon]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=126</guid>
		<description><![CDATA[In this tutorial I will describe, how to use nmon (Nigel&#8217;s performance Monitor) to monitor performance data in the interactive mode or in the capture mode. nmon can display / capture the following performance data CPU utilization Memory use Kernel statistics and run queue Disks I/O rates, transfers, and read/write … <a href="http://www.frederikkonietzny.de/2011/09/performance-monitoring-with-nmon/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will describe, how to use <a href="http://nmon.sourceforge.net/pmwiki.php">nmon</a> (<strong>N</strong>igel&#8217;s performance <strong>Mon</strong>itor) to monitor performance data in the interactive mode or in the capture mode.</p>
<p>nmon can display / capture the following performance data </p>
<ul>
<li>CPU utilization</li>
<li>Memory use</li>
<li>Kernel statistics and run queue</li>
<li>Disks I/O rates, transfers, and read/write ratios</li>
<li>File systems size and free space</li>
<li>Disk adapters</li>
<li>Network I/O rates, transfers, and read/write ratios</li>
<li>Paging space and paging rates</li>
<li>Machine details, CPU and OS specification</li>
<li>Top processors</li>
<li>User defined disk groups</li>
<li>Asynchronous I/O &#8211; AIX only</li>
<li>Workload Manager &#8211; AIX only</li>
<li>ESS and other disk subsystem &#8211; AIX only</li>
<li>Dynamic LPAR changes &#8211; AIX and Linux (on POWER hardware)</li>
</ul>
<p><span id="more-126"></span></p>
<h1>list of references</h1>
<ul>
<li><a href="http://nmon.sourceforge.net/pmwiki.php">http://nmon.sourceforge.net/pmwiki.php</a></li>
</ul>
<h1>Installation</h1>
<p>Install nmon on Ubuntu / Debian with the following command</p>
<p></p><pre class="crayon-plain-tag">apt-get install nmon</pre><p> </p>
<h1>using nmon</h1>
<p>Run the nmon command with the -h option to get the help.</p>
<h2>interactive mode</h2>
<p>Run the nmon command as a normale user (root user is not necessary!) and select the performance information you want to display in the nmon tool with the following keys.</p>
<blockquote><p>
        h   = Online help information<br />
        r   = Machine type, machine name, cache details and OS version + LPAR<br />
        c   = CPU by processor stats with bar graphs<br />
        l   = long term CPU (over 75 snapshots) with bar graphs<br />
        m   = Memory stats<br />
        L   = Huge memory page stats<br />
        V   = Virtual Memory and Swap stats<br />
        k   = Kernel Internal stats<br />
        n   = Network stats and errors<br />
        N   = NFS Network File System<br />
        d   = Disk I/O Graphs<br />
        D   = Disk I/O Stats<br />
        o   = Disk I/O Map (one character per disk showing how busy it is)<br />
        o   = User Defined Disk Groups<br />
        j   = File Systems<br />
        t   = Top Process stats use 1,3,4,5 to select the data &#038; order<br />
        u   = Top Process full command details<br />
        v   = Verbose mode &#8211; tries to make recommendations<br />
        b   = black and white mode (or use -b option)<br />
        .   = minimum mode i.e. only busy disks and processes</p>
<p>        key &#8212; Other Controls &#8212;<br />
        +   = double the screen refresh time<br />
        &#8211;   = halves the screen refresh time<br />
        q   = quit (also x, e or control-C)<br />
        0   = reset peak counts to zero (peak = &#8220;>&#8221;)<br />
        space = refresh screen now
</p></blockquote>
<div class="flashalbum" style="width:100%;height:500px;">
<div class="flagallery_swfobject" id="sid_1275068370_div"><style type="text/css">
@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_nocrawler.css");@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_noflash.css");
#fancybox-title-over .title { color: #ff9900; }
#fancybox-title-over .descr { color: #cfcfcf; }
.flag_alternate .flagcatlinks { background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat { border-color: #ffffff; color: #ffffff; background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat:hover { border-color: #ffffff; }
.flag_alternate .flagcatlinks a.active, .flag_alternate .flagcatlinks a.flagcat:hover { color: #ffffff; background-color: #737373; }
	.flag_alternate .flagcategory a.flag_pic_alt { background-color: #ffffff; border: 2px solid #ffffff; color: #ffffff; }
.flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #ffffff; border: 2px solid #4a4a4a; color: #4a4a4a; }
.flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #4a4a4a; }
</style>
	<script type="text/javascript">var ExtendVar='fancybox', hitajax = 'http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/lib/hitcounter.php';</script>
	<div id="sid_1275068370_jq" class="flag_alternate">
		<div class="flagcatlinks"></div>
			<div class="flagCatMeta">
			<h4>nmon</h4>
			<p></p>
		</div>
		<div class="flagcategory" id="gid_3_sid_1275068370">
			<a class="i0 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/nmon-01.png" id="flag_pic_4" rel="gid_3_sid_1275068370" title="">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/thumbs/thumbs_nmon-01.png]<span class="flag_pic_desc" id="flag_desc_4"><strong></strong><br /><span></span></span></a><a class="i1 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/nmon-02.png" id="flag_pic_5" rel="gid_3_sid_1275068370" title="">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/thumbs/thumbs_nmon-02.png]<span class="flag_pic_desc" id="flag_desc_5"><strong></strong><br /><span></span></span></a><a class="i2 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/nmon-03.png" id="flag_pic_6" rel="gid_3_sid_1275068370" title="">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/thumbs/thumbs_nmon-03.png]<span class="flag_pic_desc" id="flag_desc_6"><strong></strong><br /><span></span></span></a><a class="i3 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/nmon-04.png" id="flag_pic_7" rel="gid_3_sid_1275068370" title="">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/thumbs/thumbs_nmon-04.png]<span class="flag_pic_desc" id="flag_desc_7"><strong></strong><br /><span></span></span></a><a class="i4 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/nmon-05.png" id="flag_pic_8" rel="gid_3_sid_1275068370" title="">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/nmon/thumbs/thumbs_nmon-05.png]<span class="flag_pic_desc" id="flag_desc_8"><strong></strong><br /><span></span></span></a>		</div>
	</div>

</div></div>
<script type="text/javascript" defer="defer">
flag_alt['sid_1275068370'] = jQuery("div#sid_1275068370_jq").clone().wrap(document.createElement('div')).parent().html();
var sid_1275068370_div = {
	params : {
		wmode : "opaque",
		allowfullscreen : "true",
		allowScriptAccess : "always",
		saling : "lt",
		scale : "noScale",
		menu : "false",
		bgcolor : "#281e15"},
	flashvars : {
		path : "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/",
		gID : "3",
		galName : "nmon",
		skinID : "sid_1275068370",
		postID : "126",
		postTitle : "Performance+monitoring+with+nmon+"},
	attr : {
		styleclass : "flashalbum",
		id : "sid_1275068370"},
	start : function() {
		swfobject.embedSWF("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/gallery.swf", "sid_1275068370_div", "100%", "100%", "10.1.52", "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/skins/expressInstall.swf", this.flashvars, this.params , this.attr );
swfobject.createCSS("#sid_1275068370","outline:none");
	}
}
sid_1275068370_div.start();
</script>
<h2>capture mode</h2>
<p>To capture the perfomance data into a comma separated file run the nmon command with the -f option (spreadsheet output format) and the -s (interval) and -c (number of refreshes) options. </p>
<p>In this example, nmon will capture the performance data every seconds and will exit after 30 refreshes.</p>
<p></p><pre class="crayon-plain-tag">nmon -f -s1 -c 30</pre><p></p>
<p>nmun will run in the background like a daemon, and you can logout of the system while nmon is running.</p>
<p>The perfomance data will be written to a file with your hostname as prefix and the date and time (e.g.slayer_110928_2126.nmon)</p>
<p>The performance data for each refresh (called snapshot) is identified by a uniq tag. To get all tags from the capture file use the following grep command.</p>
<p></p><pre class="crayon-plain-tag">grep ZZZZ your_capture_file.nmon</pre><p></p>
<p>for example:</p>
<p></p><pre class="crayon-plain-tag">roger@slayer:~$ grep ZZZZ slayer_110928_2126.nmon 
ZZZZ,T0001,21:26:07,28-SEP-2011
ZZZZ,T0002,21:26:08,28-SEP-2011
ZZZZ,T0003,21:26:09,28-SEP-2011
ZZZZ,T0004,21:26:10,28-SEP-2011
ZZZZ,T0005,21:26:11,28-SEP-2011
ZZZZ,T0006,21:26:12,28-SEP-2011
ZZZZ,T0007,21:26:13,28-SEP-2011
ZZZZ,T0008,21:26:14,28-SEP-2011
ZZZZ,T0009,21:26:15,28-SEP-2011
ZZZZ,T0010,21:26:16,28-SEP-2011
ZZZZ,T0011,21:26:17,28-SEP-2011
ZZZZ,T0012,21:26:18,28-SEP-2011
ZZZZ,T0013,21:26:19,28-SEP-2011
ZZZZ,T0014,21:26:20,28-SEP-2011
ZZZZ,T0015,21:26:21,28-SEP-2011
ZZZZ,T0016,21:26:22,28-SEP-2011
ZZZZ,T0017,21:26:23,28-SEP-2011
ZZZZ,T0018,21:26:24,28-SEP-2011
ZZZZ,T0019,21:26:25,28-SEP-2011
ZZZZ,T0020,21:26:26,28-SEP-2011
ZZZZ,T0021,21:26:27,28-SEP-2011
ZZZZ,T0022,21:26:28,28-SEP-2011
ZZZZ,T0023,21:26:29,28-SEP-2011
ZZZZ,T0024,21:26:30,28-SEP-2011
ZZZZ,T0025,21:26:31,28-SEP-2011
ZZZZ,T0026,21:26:32,28-SEP-2011
ZZZZ,T0027,21:26:33,28-SEP-2011
ZZZZ,T0028,21:26:34,28-SEP-2011
ZZZZ,T0029,21:26:35,28-SEP-2011
ZZZZ,T0030,21:26:36,28-SEP-2011</pre><p></p>
<p>To get the performance data of a specified tag use the grep command again</p>
<p></p><pre class="crayon-plain-tag">roger@slayer:~$ grep T0019 slayer_110928_2126.nmon 
ZZZZ,T0019,21:26:25,28-SEP-2011
CPU01,T0019,3.0,0.0,0.0,97.0
CPU02,T0019,3.0,1.0,0.0,96.0
CPU03,T0019,0.0,0.0,0.0,100.0
CPU04,T0019,1.0,0.0,0.0,99.0
CPU_ALL,T0019,1.8,0.3,0.0,98.0,,4
MEM,T0019,3961.7,-0.0,-0.0,7629.4,1711.4,-0.0,-0.0,7629.3,-0.0,863.3,1209.7,-1.0,105.3,0.0,533.6
VM,T0019,-1,-1,-1,831,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-7
PROC,T0019,1.0,-1.0,1599.3,-1.0,-1.0,-1.0,0.0,-1.0,-1.0,-1.0
NET,T0019,0.0,436.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
NETPACKET,T0019,0.0,326.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
JFSFILE,T0019,20.0,0.0,0.1,0.0,0.0,14.4
DISKBUSY,T0019,1.0,1.0,0.0,0.0,0.0
DISKREAD,T0019,0.0,0.0,0.0,0.0,0.0
DISKWRITE,T0019,75.8,75.8,0.0,0.0,0.0
DISKXFER,T0019,3.0,3.0,0.0,0.0,0.0
DISKBSIZE,T0019,25.3,25.3,0.0,0.0,0.0</pre><p></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2010/11/setting-up-drbd-volumes/" rel="bookmark" class="crp_title">Setting up DRBD Volumes</a></li><li><a href="http://www.frederikkonietzny.de/2011/10/how-to-setup-bonding-on-debian-linux/" rel="bookmark" class="crp_title">How to setup bonding on Debian Linux</a></li><li><a href="http://www.frederikkonietzny.de/2011/10/perl-script-for-logfile-monitoring/" rel="bookmark" class="crp_title">Perl script for logfile monitoring</a></li><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/" rel="bookmark" class="crp_title">How to setup and expand a replicated Glusterfs 3.2.4 volume on Debian 6.x</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-test-the-plain-and-encrypted-smtppop3imap-and-http-protocols/" rel="bookmark" class="crp_title">how to test the plain and encrypted SMTP/POP3/IMAP and HTTP protocols</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2011/09/performance-monitoring-with-nmon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to setup a FAI Install server on debian squeeze</title>
		<link>http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/</link>
		<comments>http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 22:35:50 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[FAI]]></category>
		<category><![CDATA[bootp]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[dnsmasq]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[Install server]]></category>
		<category><![CDATA[NFS]]></category>
		<category><![CDATA[PXE]]></category>
		<category><![CDATA[pxelinux]]></category>
		<category><![CDATA[syslinux]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=79</guid>
		<description><![CDATA[Ok, Debian Squeeze is out for a while and now it`s time to setup a new FAI (Fully Automatic Installation) install server. In this tutorial, I will describe, how to setup FAI with dhcpd3 or dnsmasq for bootp and DHCP. purpose This document describes how to set up a FAI … <a href="http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>Ok, Debian Squeeze is out for a while and now it`s time to setup a new <a href="http://fai-project.org/">FAI (Fully Automatic Installation)</a> install server. In this tutorial, I will describe, how to setup FAI with dhcpd3 or dnsmasq for bootp and DHCP. </p>
<p><span id="more-79"></span></p>
<h1>purpose</h1>
<p>This document describes how to set up a FAI install server 3.4.8 on Debian Linux 6.x with dhcpd3 or dnsmasq</p>
<h1>list of references</h1>
<ul>
<li><a href="http://fai-project.org/">fai project</a></li>
</ul>
<h1>related article</h1>
<ul>
<li><a href="http://frederikkonietzny.de/wp/2010/11/17/network-boot-of-grml-resuce-system/">PXE network boot of grml rescue system</a></li>
<li><a href="http://frederikkonietzny.de/wp/2010/12/07/tutorial-booting-systemrescuecd-with-pxenfs/">Tutorial: booting SystemRescueCd with PXE/NFS</a></li>
<li><a href="http://thekelleys.org.uk/dnsmasq/doc.html">http://thekelleys.org.uk/dnsmasq/doc.html</a></li>
<li><a href="http://www.isc.org/software/dhcp">http://www.isc.org/software/dhcp</a></li>
</ul>
<h1>prerequisite</h1>
<h2>software</h2>
<p>The FAI install server is installed with a Debian Squeeze 6.x, and apt-cacher is installed.</p>
<h2>Hardware</h2>
<p>I will use the following network and hardware informations (MAC address), change these settings for your setup!</p>
<ul>
<li>FAI install server, Debian Squeeze 6.x, IP 192.168.2.245, Hostname fai.local</li>
<li>Client debian-vm-01, MAC address 00:16:3e:1c:64:9b,  IP: 192.168.2.240</li>
</ul>
<h1>install FAI</h1>
<p>Add the FAI repository to a new configuration file named /etc/apt/sources.list.d/fai.list</p>
<blockquote><p>deb http://fai-project.org/download squeeze koeln</p></blockquote>
<p>To verify the packages from fai-project, add the following gpg key</p>
<p>c</p><pre class="crayon-plain-tag">gpg -a --recv-keys AB9B66FD; gpg -a --export AB9B66FD | apt-key add -</pre><p> </p>
<p>Now we install the FAI packages and some helper tools </p>
<p></p><pre class="crayon-plain-tag">apt-get install fai-server fai-client fai-doc fai-setup-storage fai-quickstart makepasswd dnsmasq</pre><p></p>
<p>Answer all questions during the installation with the default answer.</p>
<h1>setup FAI</h1>
<h2>FAI</2></p>
<h3>fai logging user</h3>
<p>During the installation, clients will send logfiles to the &#8220;fai&#8221; user.</p>
<p></p><pre class="crayon-plain-tag">useradd -d /home/fai -m -s /bin/bash -c &quot;FAI logging&quot; fai</pre><p></p>
<h3>/etc/fai/fai.conf</h3>
<p>Open /etc/fai/fai.conf in your favourite editor and add/edit the following options.</p>
<blockquote><p>
FAI_CONFIG_SRC=nfs://192.168.2.245/srv/fai/config<br />
LOGUSER=fai<br />
FAI_DEBMIRROR=192.168.2.245:/srv/mirror/debian-squeeze<br />
MNTPOINT=/media/mirror<br />
FAI=/var/lib/fai/config
</p></blockquote>
<p>Use the <strong>makepasswd</strong> command, to create a new password, and add the encrypted password to the FAI_ROOTPW variable in the /etc/fai/make-fai-nfsroot.conf configuration file. (default password is fai)</p>
<p></p><pre class="crayon-plain-tag">user@host:/ # makepasswd --crypt-md5
e2TjmLPMW     $1$zu3UkGiA$ylbHHsa7WQ1VJm3d4YkQQ/</pre><p></p>
<h3>fai-setup</h3>
<p>Run the fai-setup command to create the nfs root directory, NFS exports and to add the FAI user to the system.</p>
<p></p><pre class="crayon-plain-tag">fai-setup -v
cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config/</pre><p></p>
<h3>NFS exports</h3>
<p>Add the following NFS exports to /etc/exports and restart the NFS Kernel Daemon:</p>
<p></p><pre class="crayon-plain-tag">cat &gt;&gt; /etc/exports   &lt;&lt; &quot;EOF&quot;
/srv/fai/config 192.168.2.0/255.255.255.0(async,ro,no_subtree_check)
/srv/fai/nfsroot 192.168.2.0/255.255.255.0(async,ro,no_subtree_check,no_root_squash) 
/srv/mirror/debian-squeeze 192.168.2.0/255.255.255.0(async,ro,no_subtree_check) 
EOF
/etc/init.d/nfs-kernel-server restart</pre><p></p>
<h3>FAI / Debian mirror </h3>
<p>The fai-mirror script creates a mirror of the needed Debian packages (defined in /srv/fai/config/package_config/)  </p>
<p></p><pre class="crayon-plain-tag">mkdir -p /srv/mirror/debian-squeeze
fai-mirror /srv/mirror/debian-squeeze/</pre><p></p>
<h3>NFS root</h3>
<p>With the following command we will create the FAI nfsroot:</p>
<p></p><pre class="crayon-plain-tag">make-fai-nfsroot -v</pre><p></p>
<p>Add to the nfsroot apt sources configuration (/srv/fai/nfsroot/live/filesystem.dir/etc/apt/sources.list) the apt-cacher proxy (including Debian backports repositories) &#8211; Check the releated articled for the apt-cacher setup.</p>
<blockquote><p>
deb http://192.168.2.44/apt-cacher/ftp.de.debian.org/debian/ squeeze main non-free contrib<br />
deb http://192.168.2.44/apt-cacher/security.debian.org/ squeeze/updates main non-free contrib<br />
deb http://192.168.2.44/apt-cacher/fai-project.org/download squeeze koeln
</p></blockquote>
<p>Set the boot NFS option in /srv/fai/nfsroot/live/filesystem.dir/etc/initramfs-tools/initramfs.conf to NFS</p>
<blockquote><p>BOOT=nfs </p></blockquote>
<h1>setup PXE</h1>
<h2>pxelinux.cfg</h2>
<p></p><pre class="crayon-plain-tag"># copy the menu binary
cp /usr/lib/syslinux/menu.c32 /srv/tftp/fai

cat &gt; /srv/tftp/fai/pxelinux.cfg/default &lt;&lt; &quot;EOF&quot;
DEFAULT menu.c32                                                                                                    # Prompt user for selection                                                                                                   PROMPT 0                                                                                                           

menu color tabmsg 37;40      #80ffffff #00000000
menu color hotsel 30;47      #40000000 #20ffffff
menu color sel 30;47      #40000000 #20ffffff
menu color scrollbar 30;47      #40000000 #20ffffff
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20
TIMEOUT 100
ALLOWOPTIONS 1

MENU TITLE PXE Boot Menu

LABEL local
        menu label ^Boot local harddisk
        menu default
        localboot 0

LABEL install
menu label Debian Squeeze Install 
KERNEL vmlinuz-2.6.32-5-amd64
APPEND ip=dhcp boot=live netboot=nfs nfsroot=192.168.2.245:/srv/fai/nfsroot root=/dev/nfs initrd=initrd.img-2.6.32-5-amd64 FAI_FLAGS=&quot;createvt,sshd,verbose&quot; FAI_ACTION=install panic=60
EOF</pre><p></p>
<h1>tftpd</h1>
<p>Setup the tftpd-hpa daemon in /etc/default/tftpd-hpa to serve the kernel and initrd file to the install client.</p>
<blockquote><p>
TFTP_USERNAME=&#8221;tftp&#8221;<br />
TFTP_DIRECTORY=&#8221;/srv/tftp/fai&#8221;<br />
TFTP_ADDRESS=&#8221;0.0.0.0:69&#8243;<br />
TFTP_OPTIONS=&#8221;&#8211;secure&#8221;
</p></blockquote>
<h1>DHCP/bootp</h1>
<p>Decide, if you want to use <a href="http://thekelleys.org.uk/dnsmasq/doc.html">dnsmasq</a>, or <a href="http://www.isc.org/software/dhcp">dhcpd3</a> </p>
<h2>dnsmasq</h2>
<p></p><pre class="crayon-plain-tag">cp /etc/dnsmasq.conf /etc/dnsmasq.conf.backup
cat &gt; /etc/dnsmasq.conf  &lt;&lt; &quot;EOF&quot;
dhcp-range=192.168.2.235,192.168.2.240,static
dhcp-host=00:16:3e:1c:64:9b,debian-vm-03
dhcp-boot=pxelinux.0
log-queries
log-dhcp</pre><p></p>
<h2>dhcp</h2>
<p></p><pre class="crayon-plain-tag">cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.backup
cat &gt; /etc/dhcp/dhcpd.conf  &lt;&lt; &quot;EOF&quot;
log-facility local7;
 
option dhcp-max-message-size 2048;
use-host-decl-names on;
deny unknown-clients;
 
allow bootp;
allow booting;
 
option domain-name &quot;local&quot;;
option domain-name-servers 192.168.2.245;
 
 
subnet 192.168.2.0 netmask 255.255.255.0 {
  option routers 192.168.2.1;
  option broadcast-address 192.168.2.255;
}
 
group {
 
        filename &quot;pxelinux.0&quot;;
        next-server 192.168.2.245;
 
        option root-path &quot;192.168.2.245:/srv/fai/nfsroot&quot;;
 
        host test1 {
                hardware ethernet 00:16:3e:1c:64:9b;
                fixed-address 192.168.2.240;
        }
}
 
EOF</pre><p></p>
<h1>Install the client</h1>
<p>Boot the client with PXE boot enabled (enable PXE in the Clients BIOS) and select &#8220;Debian Squeeze Install&#8221; from the menu.</p>
<div class="flashalbum" style="width:100%;height:500px;">
<div class="flagallery_swfobject" id="sid_1292745101_div"><style type="text/css">
@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_nocrawler.css");@import url("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/admin/css/flagallery_noflash.css");
#fancybox-title-over .title { color: #ff9900; }
#fancybox-title-over .descr { color: #cfcfcf; }
.flag_alternate .flagcatlinks { background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat { border-color: #ffffff; color: #ffffff; background-color: #292929; }
.flag_alternate .flagcatlinks a.flagcat:hover { border-color: #ffffff; }
.flag_alternate .flagcatlinks a.active, .flag_alternate .flagcatlinks a.flagcat:hover { color: #ffffff; background-color: #737373; }
	.flag_alternate .flagcategory a.flag_pic_alt { background-color: #ffffff; border: 2px solid #ffffff; color: #ffffff; }
.flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #ffffff; border: 2px solid #4a4a4a; color: #4a4a4a; }
.flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #4a4a4a; }
</style>
	<script type="text/javascript">var ExtendVar='fancybox', hitajax = 'http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/lib/hitcounter.php';</script>
	<div id="sid_1292745101_jq" class="flag_alternate">
		<div class="flagcatlinks"></div>
			<div class="flagCatMeta">
			<h4>FAI Installation</h4>
			<p></p>
		</div>
		<div class="flagcategory" id="gid_1_sid_1292745101">
			<a class="i0 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/fai-install-2011/virt-viewer-debian-install02.png" id="flag_pic_1" rel="gid_1_sid_1292745101" title="FAI Installation">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/fai-install-2011/thumbs/thumbs_virt-viewer-debian-install02.png]<span class="flag_pic_desc" id="flag_desc_1"><strong>FAI Installation</strong><br /><span></span></span></a><a class="i1 flag_pic_alt" href="http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/fai-install-2011/virt-viewer-debian-install03.png" id="flag_pic_2" rel="gid_1_sid_1292745101" title="PXE boot menu">[img src=http://www.frederikkonietzny.de/wordpress/wp-content/flagallery/fai-install-2011/thumbs/thumbs_virt-viewer-debian-install03.png]<span class="flag_pic_desc" id="flag_desc_2"><strong>PXE boot menu</strong><br /><span></span></span></a>		</div>
	</div>

</div></div>
<script type="text/javascript" defer="defer">
flag_alt['sid_1292745101'] = jQuery("div#sid_1292745101_jq").clone().wrap(document.createElement('div')).parent().html();
var sid_1292745101_div = {
	params : {
		wmode : "opaque",
		allowfullscreen : "true",
		allowScriptAccess : "always",
		saling : "lt",
		scale : "noScale",
		menu : "false",
		bgcolor : "#281e15"},
	flashvars : {
		path : "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/",
		gID : "1",
		galName : "Fai-Install",
		skinID : "sid_1292745101",
		postID : "79",
		postTitle : "How+to+setup+a+FAI+Install+server+on+debian+squeeze+"},
	attr : {
		styleclass : "flashalbum",
		id : "sid_1292745101"},
	start : function() {
		swfobject.embedSWF("http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flagallery-skins/chocolate/gallery.swf", "sid_1292745101_div", "100%", "100%", "10.1.52", "http://www.frederikkonietzny.de/wordpress/wp-content/plugins/flash-album-gallery/skins/expressInstall.swf", this.flashvars, this.params , this.attr );
swfobject.createCSS("#sid_1292745101","outline:none");
	}
}
sid_1292745101_div.start();
</script>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2010/11/pxe-network-boot-of-grml-rescue-system/" rel="bookmark" class="crp_title">PXE network boot of grml rescue system</a></li><li><a href="http://www.frederikkonietzny.de/2011/08/how-to-setup-postfix-with-spampd-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup Postfix with spampd on Debian Squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2012/04/how-to-setup-and-expand-a-replicated-glusterfs-3-2-4-volume-on-debian-6-x/" rel="bookmark" class="crp_title">How to setup and expand a replicated Glusterfs 3.2.4 volume on Debian 6.x</a></li><li><a href="http://www.frederikkonietzny.de/2011/10/how-to-setup-bonding-on-debian-linux/" rel="bookmark" class="crp_title">How to setup bonding on Debian Linux</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/hadoop-cluster-setup-on-debian-lenny/" rel="bookmark" class="crp_title">Hadoop Cluster Setup on Debian Lenny</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>how to test the plain and encrypted SMTP/POP3/IMAP and HTTP protocols</title>
		<link>http://www.frederikkonietzny.de/2011/09/how-to-test-the-plain-and-encrypted-smtppop3imap-and-http-protocols/</link>
		<comments>http://www.frederikkonietzny.de/2011/09/how-to-test-the-plain-and-encrypted-smtppop3imap-and-http-protocols/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 19:02:40 +0000</pubDate>
		<dc:creator>fkonietzny</dc:creator>
				<category><![CDATA[Debug]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[s_client]]></category>
		<category><![CDATA[telnet]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.frederikkonietzny.de/?p=97</guid>
		<description><![CDATA[In this article I will describe how to test the plain and the encrypted SMTP/POP3/IMAP and HTTP protocols with telnet and the openssl s_client command. list of references For a complete list of available commands for the used protocols check the RFCs please: RFC &#8211; Post Office Protocol &#8211; Version … <a href="http://www.frederikkonietzny.de/2011/09/how-to-test-the-plain-and-encrypted-smtppop3imap-and-http-protocols/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>In this article I will describe how to test the plain and the encrypted SMTP/POP3/IMAP and HTTP protocols with <strong>telnet</strong> and the <strong>openssl s_client</strong> command.</p>
<p><span id="more-97"></span></p>
<h1>list of references</h1>
<p>For a complete list of available commands for the used protocols check the RFCs please: </p>
<ul>
<li><a href="http://www.ietf.org/rfc/rfc1939.txt">RFC &#8211; Post Office Protocol &#8211; Version 3</a></li>
<li><a href="http://www.ietf.org/rfc/rfc2821.txt">RFC &#8211; Simple Mail Transfer Protocol</a></li>
<li><a href="http://tools.ietf.org/html/rfc3501">RFC &#8211; INTERNET MESSAGE ACCESS PROTOCOL &#8211; VERSION 4rev1</a></li>
<li><a href="http://tools.ietf.org/html/rfc2616">RFC &#8211; Hypertext Transfer Protocol &#8212; HTTP/1.1</a></li>
</ul>
<h1>SMTP</h1>
<h2>sending mail</h2>
<p>In the first example I will open a telnet connection to a SMTP Server on localhost port 25 and send an email to a local email address. </p>
<p>Replace example.net with the domain of your SMTP server, and use an existing user in the email address.</p>
<p></p><pre class="crayon-plain-tag">user@host:~# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.example.net ESMTP
helo testing
250 mail.example.net 
mail from: user@example.net 
250 2.1.0 Ok
rcpt to: local@example.net
250 2.1.5 Ok
data
354 End data with &amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;.&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;

from: user@example.net
to: local@example.net
Subject: test 1908
 

Test 1908

.
250 2.0.0 Ok: queued as 2BA152A005D
quit
221 2.0.0 Bye
Connection closed by foreign host.</pre><p> </p>
<h2>SMTP STARTTLS (SSL)</h2>
<p>An encrypted SMTP connection can`t be handled by telnet, so I will use the <strong>openssl s_client</strong> command.</p>
<h3>check StartTLS support</h3>
<p>To check if your SMTP server supports the StartTLS command, open a telnet connection and use the <strong>ehlo</strong> command to get a list of supported commands.</p>
<p></p><pre class="crayon-plain-tag">user@host:~# telnet localhost 25
220 mail.example.net ESMTP
ehlo testing
250-mail.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit</pre><p></p>
<h3>encrypted SMTP (SSL) connection</h3>
<p>If your SMTP server supports the StartTLS command, run the following command, to open an encrpyted SMTP connection to 127.0.0.1 on port 25.</p>
<p></p><pre class="crayon-plain-tag">user@host:~#  openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25
&lt;output of the certificate verification .. &gt;
---

250 DSN
ehlo testing
250-mail.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: user@example.net
250 2.1.0 Ok
rcpt to: local@example.net
250 2.1.5 Ok
data
354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;
From: user@example.net
To: local@example.net
Subject: test 1908

Test 1908

.
250 2.0.0 Ok: queued as 12C842A005D
quit</pre><p></p>
<h1>POP3</h1>
<h2>POP3 plain</h2>
<p>Login to the POP3 server with a telnet connection on localhost port 110.</p>
<p>username: local@example.net<br />
password: JZY+0t6dF$278%</p>
<p></p><pre class="crayon-plain-tag">user@host:~#  telnet localhost 110
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
+OK Hello there.
user local@example.net
+OK Password required.
pass JZY+0t6dF$278%
+OK logged in.
stat
+OK 47 13458471
quit</pre><p></p>
<h2>POP3 SSL</h2>
<p>Use the <strong>openssl s_client</strong> command to open an encrypted connection to localhost port 995.</p>
<p>username: local@example.net<br />
password: JZY+0t6dF$278%</p>
<p></p><pre class="crayon-plain-tag">user@host:~#  openssl s_client -connect 127.0.0.1:995
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
+OK Hello there.
user local@example.net
+OK Password required.
pass JZY+0t6dF$278%
+OK logged in.
stat
+OK 47 13458471
quit</pre><p></p>
<h2>SMTP AUTH</h2>
<p>In my example, I will use the following user and password to authenticate against the SMTP server with SMTP AUTH</p>
<p>username: local<br />
password: JZY+0t6dF$278%</p>
<p>For the SMTP AUTH, we need an base64 encoded string of the username and the password.<br />
Use the following perl command, to get the authentication string:</p>
<p></p><pre class="crayon-plain-tag">user@host:~# perl -MMIME::Base64 -e 'print encode_base64(&quot; 00local 00JZY+0t6dF$278%&quot;)'
AGxvY2FsAEpaWSswdDZkRiU=</pre><p></p>
<p>Open again an encrypted SMTP connection, and use the AUTH PLAIN command with the generated base64 string of the username and password.</p>
<p></p><pre class="crayon-plain-tag">user@host:~# openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25
ehlo testing
250-mail.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN AGxvY2FsAEpaWSswdDZkRiU=
235 2.7.0 Authentication successful</pre><p>If the authentication fails, you will get an error message:</p>
<blockquote><p>535 5.7.8 Error: authentication failed: bad protocol / cancel</p></blockquote>
<h1>IMAP</h1>
<h2>IMAP SSL / IMAPs</h2>
<p>To test the IMAP connection, I will use the openssl s_client command, the following user account and the <stong>1 LOGIN username password</strong> command.</p>
<p>username: local<br />
password: JZY+0t6dF$278%</p>
<p></p><pre class="crayon-plain-tag">user@host:~# openssl s_client -connect 127.0.0.1:993
&lt;output of the certificate verification .. &gt;
---

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
1 LOGIN local JZY+0t6dF$278%
1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in</pre><p></p>
<p>Select a mailbox with the <strong>SELECT</strong> command to get access to the messages in the mailbox.</p>
<p></p><pre class="crayon-plain-tag">1 select inbox
* FLAGS (Answered Flagged Deleted Seen Draft)
* OK [PERMANENTFLAGS (Answered Flagged Deleted Seen Draft *)] Flags       ted.
* 3214 EXISTS
* 0 RECENT
* OK [UNSEEN 4] First unseen.
* OK [UIDVALIDITY 1311685071] UIDs valid
* OK [UIDNEXT 3215] Predicted next UID
* OK [HIGHESTMODSEQ 6] Highest
1 OK [READ-WRITE] Select completed.</pre><p></p>
<p>To fetch the header of a message in the mailbox use the fetch command:</p>
<p></p><pre class="crayon-plain-tag">1 fetch 1 all
* 1 FETCH (FLAGS (Seen) INTERNALDATE &quot;25-Jul-2011 19:41:03 +0200&quot; RFC822.SIZE 923 ENVELOPE (&quot;Mon, 25 Jul 2011 19:40:58 +0200 (CEST)&quot; &quot;test1&quot; ((NIL NIL &quot;local&quot; &quot;example.net&quot;)) ((NIL NIL &quot;local&quot; &quot;example.net&quot;)) ((NIL NIL &quot;local&quot; &quot;example.net&quot;)) ((NIL NIL &quot;undisclosed-recipients&quot; NIL)(NIL NIL NIL NIL)) NIL NIL NIL &quot;&lt;20110725124058.A900F2A004C@mail.example.net&gt;&quot;))
1 OK Fetch completed.</pre><p></p>
<p>To fetch the mail with the header and the body use the following command:</p>
<p></p><pre class="crayon-plain-tag">1 fetch 1 body[]
* 1 FETCH (BODY[] {923}
Return-Path: &lt;user@example.net&gt;
X-Original-To: local@example.net
Delivered-To: local@example.net
Received: from mail.example.net (localhost [127.0.0.1])
       by mail.example.net (Postfix) with ESMTP id A900F2A004C
       for &lt;local@example.net&gt;; Mon, 25 Jul 2011 19:40:58 +0200 (CEST)
       by mail.example.net (Postfix) with SMTP
       for &lt;local@example.net&gt;; Mon, 25 Jul 2011 19:40:57 +0200 (CEST)
from: user@example.net
Subject: test 1922
Message-Id: &lt;20110725124058.A900F2A004C@mail.example.net&gt;
Date: Mon, 25 Jul 2011 19:40:58 +0200 (CEST)
To: undisclosed-recipients:;


test

)
1 OK Fetch completed.</pre><p></p>
<h1>HTTP</h1>
<h2>unencrypted HTTP</h2>
<p>Open a telnet connection to a remote host on port 80 and get the file /test.html from the web server.<br />
Enter return twice after you typed the following command:</p>
<blockquote><p>
GET /test.html HTTP/1.1<br />
HOST: www.linux-adm.de</p>
</blockquote>
<p></p><pre class="crayon-plain-tag">user@host:~# telnet www.linux-adm.de 80
Trying 46.163.114.237...
Connected to www.linux-adm.de.
Escape character is '^]'.

GET /index.html HTTP/1.1
HOST: www.linux-adm.de

 

HTTP/1.1 200 OK
Date: Fri, 02 Sep 2011 18:22:46 GMT
Server: Apache/2.2.14 (Ubuntu)
Last-Modified: Wed, 17 Aug 2011 18:40:01 GMT
ETag: &quot;10c8ca17-745-4aab7d2e80240&quot;
Accept-Ranges: bytes
Content-Length: 1861
Vary: Accept-Encoding
Content-Type: text/html</pre><p></p>
<h2>encrypted HTTP</h2>
<p>Open a SSL connection a remote host on port 443 with the <strong>openssl s_client</strong> command and get the file /test.html from the web server.<br />
Enter return twice after you typed the following command:</p>
<blockquote><p>
GET /test.html HTTP/1.1<br />
HOST: ssl.linux-adm.de</p>
</blockquote>
<p></p><pre class="crayon-plain-tag">openssl s_client -connect ssl.linux-adm.de:443
&lt;output of the certificate verification .. &gt;
---

GET /test.html HTTP/1.1
HOST: ssl.linux-adm.de

HTTP/1.1 200 OK
Date: Fri, 02 Sep 2011 18:24:48 GMT
Server: Apache/2.2.14 (Ubuntu)
Last-Modified: Fri, 02 Sep 2011 18:24:36 GMT
ETag: &quot;15dac002-e-4abf9793ba100&quot;
Accept-Ranges: bytes
Content-Length: 14
Vary: Accept-Encoding
Content-Type: text/html
X-Pad: avoid browser bug

&lt;h1&gt;test&lt;/h1&gt;</pre><p></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.frederikkonietzny.de/2010/11/dumping-http-header-with-ngrep-the-network-grep/" rel="bookmark" class="crp_title">Dumping HTTP header with ngrep &#8211; the network grep</a></li><li><a href="http://www.frederikkonietzny.de/2011/09/how-to-setup-a-fai-install-server-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup a FAI Install server on debian squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2011/08/how-to-setup-postfix-with-spampd-on-debian-squeeze/" rel="bookmark" class="crp_title">How to setup Postfix with spampd on Debian Squeeze</a></li><li><a href="http://www.frederikkonietzny.de/2010/11/pxe-network-boot-of-grml-rescue-system/" rel="bookmark" class="crp_title">PXE network boot of grml rescue system</a></li><li><a href="http://www.frederikkonietzny.de/2011/10/perl-script-for-logfile-monitoring/" rel="bookmark" class="crp_title">Perl script for logfile monitoring</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.frederikkonietzny.de/2011/09/how-to-test-the-plain-and-encrypted-smtppop3imap-and-http-protocols/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

