How to send Alert Mails with GlassFish v2ur2

I’d like to demonstrate GlassFish configuration settings that will cause GlassFish v2ur2 (aka SJAS 9.1_02) to to send alert emails on logging errors or warnings.

A trivial task for an application server that implements a plethora of standards and offers such a slick user interface, I thought.

But I was very much mistaken. Even after having struggled for more than a day, I was unable to identify self management configuration settings that would produce alert mails on any severe or warning entry being logged.

Eventually I succeeded by adopting back level configuration settings from SJAS 8.1 (see Managing and Monitoring Sun Java System Application Server 8.1 – Declarative Alerts at the very bottom). Syntax errors and a package name had to be fixed to get <alert-service> going. What works for me within my domain.xml looks similar to:

      <thread-pools>
        <thread-pool .../>
      </thread-pools>
      <alert-service>
        <alert-subscription name="AlertSubscription1">
          <listener-config listener-class-name="com.sun.appserv.management.alert.MailAlert"
                           subscribe-listener-with="LogMBean, ServerStatusMonitor, HeapSizeMonitor">
            <property name="recipients" value="joe@company.com, jim@service.net"/>
            <property name="fromAddress" value="glassfish@company.com"/>
            <property name="subject" value="Alert From GlassFish Application Server"/>
            <property name="includeDiagnostics" value="true"/>
            <property name="mailSMTPHost" value="my.smarthost.company.com"/>
          </listener-config>
          <filter-config filter-class-name="com.sun.appserv.management.alert.MailFilter">
            <property name="filterWarningMessages" value="false"/>
          </filter-config>
        </alert-subscription>
      </alert-service>
      <management-rules ...>
      </management-rules>
    </config>
    <!-- config model with name "server-config" ends -->
  </configs>

I still would like to know, how to set up mail alerts using self administration settings (e.g. What is the object name to listen for? How to properly install the “default” Custom MBeans with GlassFish PE)?

About Reiner

Born 1954 in Ratisbon (Bavaria, Germany), in 1976 punched cards at Berlin Technical University, caught hacking one of its mainframes by Horst Zuse (son of Konrad Zuse), started studying computer science and soon was offered a job whithin their computer department doing systems programming for IBM VM/370. While studying, jobbed around Germany at various places doing all sorts of things, then returned to Berlin to work at SRZ (computer aided typesetting). Never finished my master degree, but chose to take up self-employed work (which didn't turn me rich nor famous). Now working for a mid-sized software company within a very promising department as head of server software development.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s