<?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>Running Systems&#187; cacti</title>
	<atom:link href="http://run.tournament.org.il/tag/cacti/feed/" rel="self" type="application/rss+xml" />
	<link>http://run.tournament.org.il</link>
	<description>(and me chasing them)</description>
	<lastBuildDate>Wed, 02 Jun 2010 13:50:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Work around ISP QoS limitations</title>
		<link>http://run.tournament.org.il/work-around-isp-qos-limitations/</link>
		<comments>http://run.tournament.org.il/work-around-isp-qos-limitations/#comments</comments>
		<pubDate>Fri, 29 May 2009 09:38:32 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ISP]]></category>
		<category><![CDATA[Linux router]]></category>
		<category><![CDATA[masquerade]]></category>
		<category><![CDATA[mrtg]]></category>
		<category><![CDATA[nntp]]></category>
		<category><![CDATA[QoS]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=466</guid>
		<description><![CDATA[ISPs which enforce QoS limitations suddenly, without alerting the customer, are abusing their force. QoS limitation is not a bad thing, from the ISP&#8217;s point of view, but changing the customer deal without notifying him seems to me to be unfair.
This is a recipe for a QoS workaround.
Ingredients:

One fast Internet connection which is not used [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>ISPs which enforce QoS limitations suddenly, without alerting the customer, are abusing their force. QoS limitation is not a bad thing, from the ISP&#8217;s point of view, but changing the customer deal without notifying him seems to me to be unfair.</p>
<p>This is a recipe for a QoS workaround.</p>
<p>Ingredients:</p>
<ul>
<li>One fast Internet connection which is not used to its full capacity</li>
<li>Defined target service provider. I use <a href="http://www.giganews.com/?c=ezaton" target="_blank">Giganews</a> as an NNTP, which is the fastest method of obtaining content today. You should have the service list of IPs. Luckily, Giganews use only two IP addresses</li>
<li>One &#8220;evil&#8221; ISP which enforces QoS for external targets</li>
<li>One server in the ISP&#8217;s hosting farm, which has no speed or transfer limitations, and is probably not bound by the ISP&#8217;s QoS</li>
<li>For a better looking dish &#8211; some graphing solution, such as <a href="http://cacti.net" target="_blank">Cacti</a> or MRTG</li>
</ul>
<p>Directions:</p>
<ul>
<li>Setup <a href="http://openvpn.net/index.php/open-source/documentation/howto.html" target="_blank">OpenVPN Server</a> on the hosted server</li>
<li>Setup OpenVPN Client on your NNTP/Other service client (your desktop, your <a href="http://run.tournament.org.il/cables-connection-in-israel-for-linux/" target="_blank">Linux router</a>, etc) &#8211; This can also be a Windows machine, but configuration varies a bit.</li>
<li>Define, in your OpenVPN client.conf line(s) which look like this:</li>
</ul>
<blockquote><p>route &lt;SERVICE_IP&gt;</p>
<p>route &lt;SERVICE_IP2&gt;</p></blockquote>
<ul>
<li>If this is a router machine, activate NAT on it. Of course &#8211; remember to set this rule to work after reboot too!</li>
</ul>
<blockquote><p>iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE</p></blockquote>
<ul>
<li>For your good feeling, try to pickup data from before and after, and compare.</li>
<li>Start the OpenVPN Service on the server, on the client, and restart your NNTP/Other service downloads.</li>
<li>Serve with a smile <img src='http://run.tournament.org.il/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>The result dish is both tasty and good looking! see below:</p>
<p><a href="http://run.tournament.org.il/files/2009/05/Qos_override.png"><img class="alignnone size-full wp-image-467" title="QoS_override.png" src="http://run.tournament.org.il/files/2009/05/graph_imagephp.png" alt="QoS_override.png" width="603" height="286" /></a></p>
<p>A word of warning &#8211; OpenVPN is a VPN tool. As such, it uses encryption and varios methods which are very secure. This means that for high througput, such as mine (about 10Mb/s) you will see the impact on the router/workstation&#8217;s CPU. Under virtualization, I get about 2% additional system CPU utilization from a 2&#215;3GHz Xeon CPU. For older router devices this could result in an overworked router. I am so glad I got rid of my old P2 350MHz router in favor of the virtualized one.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/work-around-isp-qos-limitations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centreon and batch-adding hosts</title>
		<link>http://run.tournament.org.il/centreon-and-batch-adding-hosts/</link>
		<comments>http://run.tournament.org.il/centreon-and-batch-adding-hosts/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 10:51:09 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting/Programing]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[centreon]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[nagios]]></category>

		<guid isPermaLink="false">http://run.tournament.org.il/?p=447</guid>
		<description><![CDATA[Centreon is a nice GUI wrapper for Nagios. It is using MySQL as its configuration engine, and it functions quite well. One thing Cacti can do but Centreon can&#8217;t is mass automatic addition of servers. I have had a new site with an installed Centreon, and I wanted to add about 40 servers to be [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.centreon.com/" target="_blank">Centreon</a> is a nice GUI wrapper for <a href="http://www.nagios.org" target="_blank">Nagios</a>. It is using MySQL as its configuration engine, and it functions quite well. One thing <a href="http://www.cacti.net" target="_blank">Cacti</a> can do but Centreon can&#8217;t is mass automatic addition of servers. I have had a new site with an installed Centreon, and I wanted to add about 40 servers to be monitored. This is a tedious work, and I was searching for some semi-automatic method of doing it.<br />
This is not perfect, but it worked for me.<br />
In this case I do not replicate service-group relationship, but only add a mass of servers.</p>
<p>First &#8211; create a text file containing a list of servers and IPs. It should look like this:<br />
serv1:1.2.3.4<br />
serv2:10.2.1.3<br />
new_srv:2.3.4.1<br />
&#8230;</p>
<p>I have placed in in /tmp/machines</p>
<p>Second &#8211; find the last host entry. In my case the DB name is Centreon, so I run the following command:</p>
<blockquote><p>mysql -u root -p centreon -e&#8217;select host_id from host&#8217;</p></blockquote>
<p>This should return a colum with numbers. Find the largest one and increment it by one. In my example the last one was 19, so my initial host_id will be 20.</p>
<p>You should now find the host_template_model_html_id you are to use. There are few methods for that, but the easiest way is to find another host information which matches to some level your desired information. In my case it was called &#8220;DB1&#8243;, so this looks like this:</p>
<blockquote><p>mysql -u root -p centreon -e&#8221;select host_template_model_htm_id from host where host_name=&#8217;DB1&#8242;&#8221;</p></blockquote>
<p>Please note that my blog formatting might change the quote character. You might not want to copy/paste it, but type it yourselves.</p>
<p>The result of the above query should give us a template ID. In my case it was &#8220;2&#8243;, which is fine by me.</p>
<p>If you want a better reference for the values entered, you can do a whole select for a single host to verify your values match mine:</p>
<blockquote><p>mysql -u root -p centreon -e&#8221;select * from host where host_name=&#8217;DB1&#8242;\G&#8221;</p></blockquote>
<p>This should give you long listing and information of the host, as a reference.</p>
<p>My script goes like this, based on the assumptions made above:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://run.tournament.org.il/wp-content/plugins/wp-codebox/wp-codebox.php?p=447&amp;download=populate_oreon.sh">populate_oreon.sh</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4472"><td class="code" id="p447code2"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">HOST</span>=<span style="color: #000000;">20</span>
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>machines<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">do</span>
   <span style="color: #007800;">NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f1</span> -d:<span style="color: #000000; font-weight: bold;">`</span>
   <span style="color: #007800;">IP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$2</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f2</span> -d:<span style="color: #000000; font-weight: bold;">`</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;insert into host values ('<span style="color: #007800;">$HOST</span>',2,NULL,NULL,1,NULL,NULL,NULL,NULL,'<span style="color: #007800;">$NAME</span>','<span style="color: #007800;">$NAME</span>','<span style="color: #007800;">$IP</span>',NULL,NULL,'2','2','2','2','2',NULL,'2',NULL,NULL,'2','2','2','2',NULL,NULL,'2',NULL,NULL,'0',NULL,'1','1');&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>insert_sql.sql
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;insert into extended_host_information values('',<span style="color: #007800;">$HOST</span>,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>insert_sql.sql
   <span style="color: #7a0874; font-weight: bold;">let</span> HOST++
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>This should create a file called /tmp/insert_sql.sql which then should be first reviewed, and then inserted into your database.</p>
<p>Needless to say &#8211; back up your database first, just in case:</p>
<blockquote><p>mysqldump -u root -p &#8211;opt -B centreon &gt; /tmp/centreon_backup.sql</p></blockquote>
<p>and then insert the newly created data:</p>
<blockquote><p>mysql -u root -p centreon &lt; /tmp/insert_sql.sql</p></blockquote>
<p>Notice &#8211; at this point, no service relationship is created. I think it is quite a chore only to create the nodes. Adding the service relationships complicates things a bit, and I did not want to go there at this specific stage. However, for few tenths of monitored hosts, this is quite a lifesaver.</p>
<p>Notice that this is only Centreon configuration, and you will be required to apply it (through the GUI) to Nagios.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/centreon-and-batch-adding-hosts/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Xen VMs performance collection</title>
		<link>http://run.tournament.org.il/xen-vms-performance-collection/</link>
		<comments>http://run.tournament.org.il/xen-vms-performance-collection/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 18:58:43 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting/Programing]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[SNMP]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.tournament.org.il/run/?p=486</guid>
		<description><![CDATA[Unlike VMware Server, Xen&#8217;s HyperVisor does not allow an easy collection of performance information. The management machine, called &#8220;Domain-0&#8243; is actually a privileged virtual machine, and thus &#8211; get its own small share of CPUs and RAM. Collecting performance information on it will lead to, well, collecting performance information for a single VM, and not [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Unlike VMware Server, Xen&#8217;s HyperVisor does not allow an easy collection of performance information. The management machine, called &#8220;Domain-0&#8243; is actually a privileged virtual machine, and thus &#8211; get its own small share of CPUs and RAM. Collecting performance information on it will lead to, well, collecting performance information for a single VM, and not the whole bunch.</p>
<p>Local tools, such as &#8220;<em>xentop</em>&#8221; allows collection of information, however, combining this with <a href="http://www.cacti.net/" target="_blank">Cacti</a>, or any other SNMP-based collection tool is a bit tricky.</p>
<p>A great solution is provided by Ian P. Christian in his blog post about <a href="http://pookey.co.uk/blog/archives/53-Monitoring-Xen-via-SNMP-update.html" target="_blank">Xen monitoring</a>. He has created a Perl script to collect information. I have taken the liberty to fix several minor things with his permission. The modified scripts are presented below. Name the script (according to your version of Xen) &#8220;<em>/usr/local/bin/xen_stats.pl</em>&#8221; and set it to be executable:</p>
<p><strong>For Xen 3.1</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://run.tournament.org.il/wp-content/plugins/wp-codebox/wp-codebox.php?p=216&amp;download=xen_stats.pl">xen_stats.pl</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2165"><td class="code" id="p216code5"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># declare...</span>
<span style="color: #000000; font-weight: bold;">sub</span> trim<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$)</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">#&lt;a href=&quot;/blog/files/xen_cloud.tar.gz&quot; title=&quot;xen_cloud.tar.gz&quot; target=&quot;_blank&quot;&gt;xen_cloud.tar.gz&lt;/a&gt;</span>
<span style="color: #666666; font-style: italic;"># we need to run 2 iterations because CPU stats show 0% on the first, and I'm putting .1 second betwen them to speed it up</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@result</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\n/</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">`xentop -b -i 2 -d.1`</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># remove the first line</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">while</span> <span style="color: #0000ff;">@result</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!~</span> <span style="color: #009966; font-style: italic;">/^xentop - /</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># the next 3 lines are headings..</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$line</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@xenInfo</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[\t ]+/</span><span style="color: #339933;">,</span> trim<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <a href="http://perldoc.perl.org/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;name: %s, cpu_sec: %d, cpu_percent: %.2f, vbd_rd: %d, vbd_wr: %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">14</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#93;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># trims leading and trailing whitespace</span>
<span style="color: #000000; font-weight: bold;">sub</span> trim<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$)</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #339933;">;</span>
  <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/^\s+//</span><span style="color: #339933;">;</span>
  <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/\s+$//</span><span style="color: #339933;">;</span>
  <a href="http://perldoc.perl.org/functions/return.html"><span style="color: #000066;">return</span></a> <span style="color: #0000ff;">$string</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>For Xen 3.2 and Xen 3.3</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://run.tournament.org.il/wp-content/plugins/wp-codebox/wp-codebox.php?p=216&amp;download=xen_stats.pl">xen_stats.pl</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2166"><td class="code" id="p216code6"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># declare…</span>
<span style="color: #000000; font-weight: bold;">sub</span> trim<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$)</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># we need to run 2 iterations because CPU stats show 0% on the first, and I’m putting .1 second between them to speed it up</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@result</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\n/</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">`/usr/sbin/xentop -b -i 2 -d.1`</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># remove the first line</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">while</span> <span style="color: #0000ff;">@result</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">$result</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!~</span> <span style="color: #009966; font-style: italic;">/^[\t ]+NAME/</span><span style="color: #339933;">;</span>
<a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$line</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@result</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@xenInfo</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/split.html"><span style="color: #000066;">split</span></a><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[\t ]+/</span><span style="color: #339933;">,</span> trim<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <a href="http://perldoc.perl.org/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span>“name<span style="color: #339933;">:</span> <span style="color: #339933;">%</span><a href="http://perldoc.perl.org/functions/s.html"><span style="color: #000066;">s</span></a><span style="color: #339933;">,</span> cpu_sec<span style="color: #339933;">:</span> <span style="color: #0000ff;">%d</span><span style="color: #339933;">,</span> cpu_percent<span style="color: #339933;">:</span> <span style="color: #339933;">%.</span>2f<span style="color: #339933;">,</span> vbd_rd<span style="color: #339933;">:</span> <span style="color: #0000ff;">%d</span><span style="color: #339933;">,</span> vbd_wr<span style="color: #339933;">:</span> <span style="color: #0000ff;">%d</span><span style="color: #0000ff;">\n</span>“<span style="color: #339933;">,</span>
        <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">14</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">$xenInfo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#93;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;"># trims leading and trailing whitespace</span>
<span style="color: #000000; font-weight: bold;">sub</span> trim<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$)</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/shift.html"><span style="color: #000066;">shift</span></a><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/^\s+//</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/\s+$//</span><span style="color: #339933;">;</span>
        <a href="http://perldoc.perl.org/functions/return.html"><span style="color: #000066;">return</span></a> <span style="color: #0000ff;">$string</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Cron settings for Domain-0</strong></p>
<p>Create a file &#8220;<em>/etc/cron.d/xenstat</em>&#8221; with the following contents:</p>
<blockquote><p># This will run xen_stats.pl every minute<br />
*/1 * * * * root /usr/local/bin/xen_stats.pl &gt; /tmp/xen-stats.new &amp;&amp; cat /tmp/xen-stats.new &gt; /var/run/xen-stats</p></blockquote>
<p><strong>SNMP settings for Domain-0</strong></p>
<p>Add the line below to &#8220;<em>/etc/snmp/snmpd.conf</em>&#8221; and then restart the snmpd service</p>
<blockquote>
<pre>extend xen-stats   /bin/cat /var/run/xen-stats</pre>
</blockquote>
<p><strong>Cacti</strong></p>
<p>I reduced Ian Cacti script to be based on a per-server setup, meaning this script gets the host (dom-0) name from Cacti, but cannot support live migrations. I will try to deal with combining live migrations with Cacti in the future.</p>
<p>Download and extract my modified <a href="http://run.tournament.org.il/files/2008/10/xen_cloud.tar.gz">xen_cloud.tar.gz</a> file. Extract it, place the script and config in its relevant location, and import the template into <a href="http://www.cacti.net/" target="_blank">Cacti</a>. It should work like charm.</p>
<p>A note &#8211; the PHP script will work only on PHP5 and above. Works flawlessly on Centos5.2 for me.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/xen-vms-performance-collection/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>New version of Cacti, and using spine</title>
		<link>http://run.tournament.org.il/new-version-of-cacti-and-using-spine/</link>
		<comments>http://run.tournament.org.il/new-version-of-cacti-and-using-spine/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 22:04:10 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[General Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scripting/Programing]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[dag RPMS]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[monitoring system]]></category>
		<category><![CDATA[performance impact]]></category>
		<category><![CDATA[performance measurement]]></category>
		<category><![CDATA[rpmforge]]></category>
		<category><![CDATA[spine]]></category>
		<category><![CDATA[system performance]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://www.tournament.org.il/run-new/?p=176</guid>
		<description><![CDATA[A while ago, a newer version of Cacti became available through Dag&#8217;s RPM repository. An upgrade went without any special events, and was nothing to write home about.
A failure in one of my customer&#8217;s Cacti system lead me to test the system using &#8220;spine&#8221; &#8211; the &#8220;cactid&#8221; new generation.
I felt as if it acts faster [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>A while ago, a newer version of <a href="http://www.cacti.net/" target="_blank">Cacti</a> became available through <a href="http://dag.wieers.com/rpm">Dag&#8217;s RPM repository</a>. An upgrade went without any special events, and was nothing to write home about.</p>
<p>A failure in one of my customer&#8217;s <a href="http://www.cacti.net/" target="_blank">Cacti system</a> lead me to test the system using <a href="http://dag.wieers.com/rpm/packages/cacti-spine/">&#8220;spine&#8221;</a> &#8211; the <a href="http://dag.wieers.com/rpm/packages/cacti-cactid/">&#8220;cactid&#8221;</a> new generation.</p>
<p>I felt as if it acts faster and better, but had no measurable results (as the broken <a href="http://www.cacti.net/">Cacti system</a> did not work at all). I have decided to propagate the change to a local system I have, which is running <a href="http://www.cacti.net/" target="_blank">Cacti</a> locally. This is a virtual machine, dedicated only to this task.</p>
<p>Almost a day later I can see the results. Not only the measurements are continuous, but the load on the system dropped, and the load on the VM server dropped in accordance. Check the graphs below!</p>
<div class="serendipity_imageComment_center" style="width: 687px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:113 --><img src="/files/Pictures/centos4-01-mysql-cpu.png" alt="" width="687" height="334" /></div>
<div class="serendipity_imageComment_txt">MySQL CPU load reduces at around midnight</div>
</div>
<div class="serendipity_imageComment_center" style="width: 687px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:114 --><img src="/files/Pictures/centos4-01-mysql-innodb-locks.png" alt="" width="687" height="280" /></div>
<div class="serendipity_imageComment_txt">as well as the amount of MySQL locks</div>
</div>
<div class="serendipity_imageComment_center" style="width: 687px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:115 --><img src="/files/Pictures/centos4-01-mysql-io.png" alt="" width="687" height="280" /></div>
<div class="serendipity_imageComment_txt">and innoDB I/O</div>
</div>
<div class="serendipity_imageComment_center" style="width: 687px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:116 --><img src="/files/Pictures/centos4-01-mysql-lock.png" alt="" width="687" height="298" /></div>
<div class="serendipity_imageComment_txt">A small increase in the amount of table locks</div>
</div>
<div class="serendipity_imageComment_center" style="width: 603px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:117 --><img src="/files/Pictures/centos4-01-traffic.png" alt="" width="603" height="286" /></div>
<div class="serendipity_imageComment_txt">A graph which didn&#8217;t function starts working</div>
</div>
<div class="serendipity_imageComment_center" style="width: 603px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:111 --><img src="/files/Pictures/centos4-01-load-daily.png" alt="" width="603" height="250" /></div>
<div class="serendipity_imageComment_txt">System load average reduces dramatically</div>
</div>
<div class="serendipity_imageComment_center" style="width: 603px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:112 --><img src="/files/Pictures/centos4-01-load-weekly.png" alt="" width="603" height="250" /></div>
<div class="serendipity_imageComment_txt">Also comparing to a longer period of time</div>
</div>
<div class="serendipity_imageComment_center" style="width: 603px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:118 --><img src="/files/Pictures/kruvi-cpu.png" alt="" width="603" height="268" /></div>
<div class="serendipity_imageComment_txt">And the virtual host (the carrier), which runs several other guests in addition to this one, without any other change, shows a great improvement in CPU consumption</div>
</div>
<p>These measures talk for themselves. From now on (unless it&#8217;s realy vital), spine is my perfered engine.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/new-version-of-cacti-and-using-spine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Misconfigured Amavisd and its impact</title>
		<link>http://run.tournament.org.il/misconfigured-amavisd-and-its-impact/</link>
		<comments>http://run.tournament.org.il/misconfigured-amavisd-and-its-impact/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 10:10:04 +0000</pubDate>
		<dc:creator>ez-aton</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[amavis]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[graphical tool]]></category>
		<category><![CDATA[heavy load]]></category>
		<category><![CDATA[performance impact]]></category>
		<category><![CDATA[performance measurement]]></category>
		<category><![CDATA[spamassassin]]></category>

		<guid isPermaLink="false">http://www.tournament.org.il/run-new/?p=143</guid>
		<description><![CDATA[As an administrator, I am responsible for many setups and configurations, sometimes hand tailored to supply an answer to a set of given demands.
As a human, I err, and the common method of verifying that you have avoided error is by answering this simple rule: &#8220;Does it work after these changes?&#8221;
In the world of computers [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>As an administrator, I am responsible for many setups and configurations, sometimes hand tailored to supply an answer to a set of given demands.</p>
<p>As a human, I err, and the common method of verifying that you have avoided error is by answering this simple rule: &#8220;Does it work after these changes?&#8221;</p>
<p>In the world of computers there is hardly ever simple true or false. We would have expected it to be boolean world &#8211; either it works or it doesn&#8217;t, but we are not there. The world of computers is filled with &#8220;works better&#8221; and &#8220;works worse&#8221;, and sometimes we forget that.</p>
<p>This long prologue was meant to bring up the subject of monitoring and evaluating your actions. While the simplest method of evaluation remains &#8220;Does it work?&#8221;, there are some additional, more subtle methods of verifying that things work according to your specifications.</p>
<p>One of the tools which helps me see, in the mirror of time, the effect of changes I have done is a graphical tool called <a href="http://www.cacti.net/" target="_blank">Cacti</a>. This tool graphs a set of predefined parameters which were chosen by me. It has no special AI, it cannot guess anything, and I am quite happy with it, as I can understand for myself the course of events better.</p>
<p>This post is about a mis configured Amavisd daemon. Amavis is a wrapper which scans using both Spamassassin and a selected Antivirus (ClamAV, in my case, as it has proven itself to me as a good AV) mail supplied by the local MTA.</p>
<p>I had a directive looking like this in it:</p>
<blockquote><p>['ClamAV-clamscan', 'clamscan',<br />
"--stdout --disable-summary -r --tempdir=$TEMPBASE {}", [0], [1],<br />
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],</p></blockquote>
<p>It worked, however, this server, as it appears, was heavily loaded for a while now. Since it&#8217;s a rather strong server, it was not really visible unless you take a look at the server&#8217;s Cacti. On about 80%+ of the time the CPUs were on 100% with the process &#8216;<em>clamscan</em>&#8216;. I have decided yesterday to solve the heavy load, and for that modified the file &#8216;<em>/etc/amavisd.conf</em>&#8216; to include the primary ClamAV section as follows:</p>
<blockquote><p>['ClamAV-clamd',<br />
\&amp;ask_daemon, ["CONTSCAN {}\n", "/tmp/clamd"],<br />
qr/\bOK$/, qr/\bFOUND$/,<br />
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],</p></blockquote>
<p>This uses clamd instead of clamscan. The results were a drastic decrease on the CPU consumption and system average load, as can be seen in the Cacti graph (around 4 AM):</p>
<div class="serendipity_imageComment_center" style="width: 640px">
<div class="serendipity_imageComment_img"><!-- s9ymdb:93 --><img src="/files/Pictures/clamd-load.jpg" alt="" width="640" height="535" /></div>
<div class="serendipity_imageComment_txt">Cacti load average graph</div>
</div>
<p>The point is that while both configuration worked, I had the tools to understand that the earlier configuration was not good enough. Through tracking parameters on the system for a while, I could monitor my configuration modifications using a wider perspective, and reach better conclusions.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://run.tournament.org.il/misconfigured-amavisd-and-its-impact/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
