2 Replies Latest reply on Sep 23, 2011 3:38 AM by arkhalil

    Monitoring JBoss AS6 - Email Alerts

    arkhalil

      Hi, How can I enable email alerts from JBoss AS 6 to be sent to my email account for monitoring purposes? Thanks

        • 1. Re: Monitoring JBoss AS6 - Email Alerts
          tagnegilles

          Hi Abdur,

           

          you have to make changes in files monitoring-service.xml and mail-service.xml of your JBoss AS 6 configuration (for example default). Have a look to these links:

           

          http://community.jboss.org/wiki/JavaMail

          http://community.jboss.org/wiki/JBossMonitoring

          1 of 1 people found this helpful
          • 2. Re: Monitoring JBoss AS6 - Email Alerts
            arkhalil

            Thank you for assisting me. I have edited the mail-service.xml and monitoring-service.xml files (contents shown bellow). I receive messages on the terminal but not at my email address. Any idea?

             

            mail-service.xml:

             

            <?xml version="1.0" encoding="UTF-8"?>

            <!-- $Id: mail-service.xml 62350 2007-04-15 16:50:12Z dimitris@jboss.org $ -->

            <server>

             

              <!-- ==================================================================== -->

              <!-- Mail Connection Factory                                              -->

              <!-- ==================================================================== -->

             

              <mbean code="org.jboss.mail.MailService"

                     name="jboss:service=Mail">

                <attribute name="JNDIName">java:/Mail</attribute>

                <attribute name="User">arahman@jabssolutions.com</attribute>

                <attribute name="Password">mypassword</attribute>

                <attribute name="Configuration">

                  <!-- A test configuration -->

                  <configuration>

            <property name="mail.smtp.auth" value="true"/>

                    <!-- Change to your mail server prototocol -->

                    <property name="mail.store.protocol" value="pop3"/>

                    <property name="mail.transport.protocol" value="smtp"/>

             

                    <!-- Change to the user who will receive mail  -->

                    <property name="mail.user" value="arahman@jabssolutions.com"/>

             

                    <!-- Change to the mail server  -->

                    <property name="mail.pop3.host" value="mail.jabssolutions.com"/>

             

                    <!-- Change to the SMTP gateway server -->

                    <property name="mail.smtp.host" value="mail.jabssolutions.com"/>

                   

                    <!-- The mail server port -->

                    <property name="mail.smtp.port" value="25"/>

                   

                    <!-- Change to the address mail will be from  -->

                    <property name="mail.from" value="arahman@jabssolutions.com"/>

             

                    <!-- Enable debugging output from the javamail classes -->

                    <property name="mail.debug" value="false"/>

                  </configuration>

                </attribute>

                <depends>jboss:service=Naming</depends>

              </mbean>

             

            </server>

             

             

            monitoring-service.xml:


            <?xml version="1.0" encoding="UTF-8"?>

             

            <!-- $Id: monitoring-service.xml 46248 2006-07-13 15:03:17Z dimitris $ -->

             

            <!-- ===================================================================== -->

            <!--                                                                       -->

            <!--  User Service Configuration                                           -->

            <!--                                                                       -->

            <!-- ===================================================================== -->

             

            <server>

             

              <mbean code="org.jboss.monitor.alerts.ConsoleAlertListener"

                     name="jboss.alerts:service=ConsoleAlertListener">

                <attribute name="MessageTemplate"><![CDATA[%(MONITOR_NAME) was triggered for attribute %(ATTRIBUTE).]]></attribute>

                <attribute name="AlertName">Console Alert</attribute>

              </mbean>

             

            <!-- Enable after filling in correct to, from, and reply to -->

             

              <mbean code="org.jboss.monitor.alerts.EmailAlertListener"

                     name="jboss.alerts:service=EmailAlertListener">

                <depends>jboss:service=Mail</depends>

                <attribute name="MessageTemplate"><![CDATA[%(MONITOR_NAME) was triggered for attribute %(ATTRIBUTE).]]></attribute>

                <attribute name="AlertName">Email Alert</attribute>

                <attribute name="To">arahman@jabssolutions.com</attribute>

                <attribute name="From">arahman@jabssolutions.com</attribute>

                <attribute name="ReplyTo">arahman@jabssolutions.com</attribute>

                <attribute name="SubjectTemplate"><![CDATA[[jboss-alert] %(MONITOR_NAME)]]></attribute>

              </mbean>

             

            <!--

              Example of listening for notifications from JBoss monitors.

             

              The SubscriptionList attribute provides the specification to which

              MBeans to subscribe for notifications and for what notification types.

             

              The DynamicSubscriptions attribute is used to indicate whether to monitor

              the MBeanServer for new MBeans and subscribe to them if the subscription

              specification matches.

             

              The NotificationListener attribute can be set to indicate an external

              MBean as the receiver of the Notifications.

             

              The LogLevel attribute can be set to indicate the level to use for

              logging the received notification, e.g. "WARN", "INFO", "DEBUG", etc.

            -->

            <!---->

              <mbean code="org.jboss.monitor.services.NotificationListener"

                     name="jboss.jmx:service=NotificationListener">

               

                <attribute name="DynamicSubscriptions">true</attribute>

                <attribute name="NotificationListener"></attribute>

                <attribute name="SubscriptionList">

                  <subscription-list>

                    <mbean name="jboss.monitor:*">

                      <notification type="JBOSS_MONITOR_NOTIFICATION"/>

                    </mbean>

                  </subscription-list>

                </attribute>

               

              </mbean>

             

             

            <!--

              MemoryMonitor monitors the free JVM memory and emits JMX Notifications

              (org.jboss.monitor.alarm.AlarmNotification) when certain thresholds

              are crossed.

             

              The following attributes may be set:

             

              FreeMemoryWarningThreshold

                - e.g. 1048576, or 1000K, or 1M

              FreeMemoryCriticalThreshold

                - like above, must be lower

              SamplingPeriod

                - e.g. 5000, or 5sec.

              TriggeringWarningMeasurements

                - number of measurements in the warning area to trigger a notification

             

              AlarmNotification carries alarmState and alarmSeverity.

              alarmSeverity takes the values NORMAL, WARNING, CRITICAL for this monitor.

              See org.jboss.monitor.alarm.Alarm

            -->

            <!--

              <mbean code="org.jboss.monitor.services.MemoryMonitor"

                     name="jboss.monitor:service=MemoryMonitor">

                    

                <attribute name="FreeMemoryWarningThreshold">95M</attribute>

                <attribute name="FreeMemoryCriticalThreshold">80M</attribute>   

              </mbean>

            -->

             

            <!--

              Example of using the TimerService wrapper to configure a

              javax.management.timer.Timer mbean, to produce heartbeat

              notifications.

             

              Attributes to configure:

             

              NotificationType

                - The type of the produced javax.management.timer.TimerNotification

              Notification Message

                - The string message to carry in the produced notification

              Timer Period

                - Every how often to emit notifications, e.g. 500msec, 10sec, 5min, 1h;

                - a zero value will produce just one notification

              Repeatitions

                - How many timer notifications to emit when the period is not zero;

                - a zero value produces infinite notifications

              FixedRate

                - Whether the periodic notification should be produced at

                - FixedRate (true) or FixedDelay (false, default)

              TimerMBean

                - The ObjectName of the JMX Timer to configure, combined with a dependency

               

              If you want to see/log the emitted notifications, you can configure

              a NotificationListener as follows:

              -->

              <mbean code="org.jboss.monitor.services.NotificationListener"

                     name="jboss.monitor:service=NotificationListener">

                <attribute name="SubscriptionList">

                  <subscription-list>

                    <mbean name="jboss.monitor:name=Heartbeat,type=Timer"/>

                  </subscription-list>

                </attribute>

              </mbean>

             

            <!---->

              <mbean code="org.jboss.monitor.services.TimerService"

                     name="jboss.monitor:name=Heartbeat,type=TimerService">

                <attribute name="NotificationType">jboss.monitor.heartbeat</attribute>

                <attribute name="NotificationMessage">JBoss is alive!</attribute>

                <attribute name="TimerPeriod">20sec</attribute>

                <depends optional-attribute-name="TimerMBean">

                  <mbean code="javax.management.timer.Timer"

                         name="jboss.monitor:name=Heartbeat,type=Timer"/>

                </depends>

              </mbean>

             

             

            </server>