<?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>LogikDevelopment &#187; Monitoring</title>
	<atom:link href="http://www.logikdev.com/tag/monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logikdev.com</link>
	<description>&#34;Il n&#039;y a pas de problème, il n&#039;y a que des solutions. L&#039;esprit de l&#039;homme invente ensuite le problème.&#34; André Gide</description>
	<lastBuildDate>Tue, 20 Dec 2011 12:25:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Monitor s3sync with Zabbix</title>
		<link>http://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=monitor-s3sync-with-zabbix</link>
		<comments>http://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 22:28:53 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[s3sync]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[synchronisation]]></category>
		<category><![CDATA[Zabbix]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=1566</guid>
		<description><![CDATA[s3sync is a ruby program that easily transfers directories between a local directory and an S3 bucket:prefix. It behaves somewhat, but not precisely, like the rsync program. I am using this tool to automatically backup the important data from Debian servers to Amazon S3. I am not going to explain here how to install s3sync [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://forums.aws.amazon.com/thread.jspa?threadID=11975&#038;start=0&#038;tstart=0" target="_blank"><strong>s3sync</strong></a> is a ruby program that easily transfers directories between a local directory and an S3 bucket:prefix. It behaves somewhat, but not precisely, like the <strong>rsync</strong> program.</p>
<p>I am using this tool to automatically backup the important data from Debian servers to Amazon S3. I am not going to explain here how to install s3sync as it is not the purpose of this article. However, you can read this very useful article from John Eberly&#8217;s blog: <a href="http://blog.eberly.org/2006/10/09/how-automate-your-backup-to-amazon-s3-using-s3sync/" target="_blank">How I automated my backups to Amazon S3 using s3sync</a>.</p>
<p>If you followed the steps from John Eberly&#8217;s post, you should have an <code>upload.sh</code> script and a crontab job which executes this script periodically.</p>
<p>From this point, here is what you need to do to monitor the success of the synchronisation with <a href="http://www.zabbix.com/" target="_blank"><strong>Zabbix</strong></a>:</p>
<ol>
<li>Add the following code at the end of your <code>upload.sh</code> script:
<pre class="brush: bash; title: ; notranslate">
# print the exit code
RETVAL=$?
[ $RETVAL -eq 0 ] &amp;&amp; echo &quot;Synchronization succeed&quot;
[ $RETVAL -ne 0 ] &amp;&amp; echo &quot;Synchronization failed&quot;
</pre>
</li>
<li>Log the output of the cron script as follow:
<pre class="brush: bash; light: true; title: ; notranslate">
30 2 * * sun /path/to/upload.sh &gt; /var/log/s3sync.log 2&gt;&amp;1
</pre>
</li>
<li>On Zabbix, create a new item which will check the existence of the sentence &#8220;Synchronization failed&#8221; in the file <code>/var/log/s3sync.log</code>:<br />
<a href="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item.png" rel="lightbox[1566]"><img src="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_item-297x300.png" alt="" title="Create a new item on Zabbix to monitor s3sync" width="297" height="300" class="aligncenter size-medium wp-image-1569" /></a><br />
Item key: <code>vfs.file.regmatch[/var/log/s3sync.log,Synchronization failed]</code><br />
<br/>
</li>
<li>Still on Zabbix, define a new trigger for the previously created item:<br />
<a href="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger.png" rel="lightbox[1566]"><img src="http://www.logikdev.com/wp-content/uploads/2011/11/zabbix_s3sync_trigger-300x160.png" alt="" title="Define a new trigger on Zabbix to monitor s3sync" width="300" height="160" class="aligncenter size-medium wp-image-1570" /></a><br />
Trigger expression: <code>{Template_AmazonCloud_Debian:vfs.file.regmatch[/var/log/s3sync.log,Synchronization failed].last(0)}=1</code>
</li>
</ol>
<p>With these few steps, you should now receive Zabbix alerts when a backup on S3 fails. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2011/11/24/monitor-s3sync-with-zabbix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to monitor your Java application</title>
		<link>http://www.logikdev.com/2009/12/17/how-to-monitor-your-java-application/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-monitor-your-java-application</link>
		<comments>http://www.logikdev.com/2009/12/17/how-to-monitor-your-java-application/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 22:04:35 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Hibernate MBean]]></category>
		<category><![CDATA[JMX Remote]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Zabbix]]></category>
		<category><![CDATA[Zapcat]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=207</guid>
		<description><![CDATA[It is very good to have your application and your database running on a Linux or Windows server, but who will tell you if your website is down? Who said &#8220;the users&#8221;? No, you won&#8217;t look very professional if you wait for a user complaint. What you need to do is to monitor your server. [...]]]></description>
			<content:encoded><![CDATA[<p>It is very good to have your application and your database running on a Linux or Windows server, but who will tell you if your website is down? Who said &#8220;the users&#8221;? <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_eek.gif' alt='8-O' class='wp-smiley' />  No, you won&#8217;t look very professional if you wait for a user complaint.</p>
<p>What you need to do is to monitor your server. But which tools to use? There are so many on the market&#8230; <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I tested a few of them (Hyperic, Nagios, Zenoss, Cacti, Monitis) but the one I choose is <a href="http://www.zabbix.com/" target="_blank"><strong>Zabbix</strong></a>. What I like with Zabbix is its price (free  <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> ) and the fact that it is easy to configure and very flexible. Indeed, you can monitor anything you want on the machine (CPU, network, disk space, services, etc)! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>However, if you also want to monitor your Tomcat application server or even Hibernate Java library, you need some more work.</p>
<p><br/>To monitor Tomcat, you first need to enable <strong>JMX Remote</strong>. To do so, you can have a look at the <a href="http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html" target="_blank">official documentation</a> or simply add the following parameters to your Tomcat startup script:</p>
<pre class="brush: bash; light: true; title: ; notranslate">
export CATALINA_OPTS='-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false'
</pre>
<p><br/>Then, I will recommend you to deploy <a href="http://www.kjkoster.org/zapcat/Zapcat_JMX_Zabbix_Bridge.html" target="_blank"><strong>Zapcat JMX Zabbix Bridge</strong></a> in your Tomcat web server. This tool has been developed to simplify the communication between the JMX management API inside Java applications and the Zabbix monitoring tool.</p>
<p>To read the installation instructions for Tomcat, please click on the following link:<br />
<a href="http://www.kjkoster.org/zapcat/Tomcat_How_To.html" target="_blank">http://www.kjkoster.org/zapcat/Tomcat_How_To.html</a></p>
<p><br/>Finally, if you are using Hibernate in your Java application and would like to monitor it, you have to instantiate and configure a Hibernate MBean (<code>org.jboss.hibernate.jmx.Hibernate</code>) that will be responsible for constructing a Hibernate <code>SessionFactory</code> and exposing it to your application through JNDI.</p>
<p>Here are the lines you need to add to your context XML file:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;bean id=&quot;mbeanExporter&quot; class=&quot;org.springframework.jmx.export.MBeanExporter&quot; lazy-init=&quot;false&quot;&gt;
    &lt;property name=&quot;server&quot; ref=&quot;mbeanServerFactory&quot;/&gt;
    &lt;property name=&quot;beans&quot;&gt;
        &lt;map&gt;
            &lt;entry key=&quot;org.hibernate:type=statistics&quot;  value-ref=&quot;hibernateMBean&quot;/&gt;
        &lt;/map&gt;
    &lt;/property&gt;
&lt;/bean&gt;

&lt;bean id=&quot;mbeanServerFactory&quot; class=&quot;org.springframework.jmx.support.MBeanServerFactoryBean&quot;&gt;
    &lt;property name=&quot;locateExistingServerIfPossible&quot; value=&quot;true&quot;/&gt;
&lt;/bean&gt;

&lt;bean id=&quot;hibernateMBean&quot; class=&quot;org.hibernate.jmx.StatisticsService&quot;&gt;
    &lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot;/&gt;
    &lt;property name=&quot;statisticsEnabled&quot; value=&quot;true&quot;/&gt;
&lt;/bean&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2009/12/17/how-to-monitor-your-java-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

