<?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>Fri, 27 Aug 2010 08:54:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to monitor your Java application</title>
		<link>http://www.logikdev.com/2009/12/17/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;">
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;">
&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>
