Home JBoss Server JBoss Alarm configuration
12 | 03 | 2010
JBoss 5 AS Book
"JBoss AS 5 development" reviews
Please share your feedback/review with other readers!
Banner
Dashboard
Advertise with Us
Banner
RSS Feed
Login
Sign here for the NewsLetter.



Poll
What book could be in your wish list next XMas ?
 
JBoss admin resources
Banner
JBoss howto

How can you solve deployment errors caused by large war/jar/ear files ?

jboss recipe of the day ...
Read More

How do you configure your .war to be deployed after your EJB ?

jboss recipe of the day ...
Read More

How do I configure a Queue/Topic to work in a cluster?

JBoss recipe of the day ...
Read More
JBoss Alarm configuration PDF Print E-mail
Written by Mark S.   
Wednesday, 10 June 2009 14:25

An Alarm indicates that an event (generally an error) has happened in the system. In this article we're going to show how you can activate alarms to keep track of these error conditions.

Looking for error in the console log is usually cumbersome because the log contains quite a lot of information. You might be interested to isolate only a few conditions like a Memory Threshold or a Deployment error.

JBoss keeps track of Alarm in a Table called the Active Alarmtable. By default this table is disable, you have to activate it through the conf/jboss-service.xml file. Enable the following MBean (about at line 121)

   <mbean code="org.jboss.monitor.services.ActiveAlarmTable" 
          name="jboss.monitor:service=ActiveAlarmTable">
      <attribute name="SubscriptionList">
         <subscription-list>
            <mbean name="jboss.monitor:*">
               <notification type="jboss.alarm"></notification>
               <notification type="JBOSS_MONITOR_NOTIFICATION"></notification>               
            </mbean>
            <mbean name="jboss.system:service=Logging,type=JMXNotificationAppender"></mbean>
         </subscription-list>
      </attribute>
   </mbean>

Now restart jBoss and verify from the Web Console that the Alarm Table appears in the options (In the Monitoring Menu) :


 

Adding a Memory monitor

One useful alarm notification could be a Memory monitor. If you want to send an alarm when certain memory thresholds are crossed, then uncomment the following MBean in deploy/monitoring-service.xml

  <mbean code="org.jboss.monitor.services.MemoryMonitor"
         name="jboss.monitor:service=MemoryMonitor">
         
    <attribute name="FreeMemoryWarningThreshold">95M</attribute>
    <attribute name="FreeMemoryCriticalThreshold">80M</attribute>    
  </mbean>

Set up a threshold near to your Server free memory and verify from the Web Console that the alarm has been emitted: 

jboss alert
 

Capturing Logging events as alarms

You can as well have your Log4j emit logs as JMX events. This can be achieved by uncommenting the JMX appender (in conf/jboss-log4j.xml):

   <appender name="JMX" class="org.jboss.monitor.services.JMXNotificationAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      
      <param name="Threshold" value="WARN"/>
      <param name="ObjectName" value="jboss.system:service=Logging,type=JMXNotificationAppender"/>
      
      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d %-5p [%c] %m"/>
      </layout>
   </appender>

And remeber to add the appender-ref to the Root appender (at the bottom of log4j file)

   <root>
      <appender-ref ref="CONSOLE"/>
      <appender-ref ref="FILE"/>
      <appender-ref ref="JMX"/>
   </root>

JBoss.org Search
Custom Search
Comments
Search
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Wednesday, 10 June 2009 14:44 )