Over a million developers have joined DZone.
Platinum Partner

Trap your Alerts: An SNMP How-to using Java and Mule Enterprise Console

The Integration Zone is brought to you in partnership with Red Hat. Download the IDC Report: The Business Value of Red Hat Integration Products to learn more about Red hat Integration.

Customer stories series: alerts



We are evaluating using Nagios or a similar Big Brother Enterprise solution for displaying information about our many Enterprise Mule instances, applications and the status of our production and staging environments. The only sure thing is that we presented a budget for buying a couple of 55” monitors and were approved. Pure awesomeness!

First solution: Do it yourself

This is complicated. We would have to hire a Java programmer to develop an agent to gather statistics from servers distributed in different geographical zones. Pretty heavy stuff. The project would take a while to complete. And once that is done, we would have to start worrying about upgrades, deployment of the agent, and paperwork. We are using a waterfall cycle. You know the pain.

Second [selected] solution: Take advantage of native Mule component

We have expertise on our own infrastructure. We know how to handle Big Brother issues/configuration/maintenance. So what does the Mule team have to offer for gathering statistics about distributed Servers, apps and their corresponding status (among other things)?


We took a look at two possible approaches:

After comparing capabilities of both systems, we decided to go for the alerts. They are a better match for our needs: Notifications in almost real time for environment changes. For example:

  • Memory usage, server up, server down, etc
  • Log entries about specific Exceptions and/or information (by using regular expressions)
  • JMX stuff
  • Etc, etc.
MMC SNMP Alert Definition screenshot Ah! How do we process the info? At first we thought about email alerts, but then we realized that trapping SNMP messages with our existing infrastructure was the way to go with Big Brother (in particular with ).

If you want to implement your own SNMP server or you want to set up a suite of integration tests, here is a basic implementation that allows you to trap MMC alerts.

Basic SNMP server implementation to trap MMC alerts

Here you can find a Java barebones implementation of an SNMP server optimized for MMC. A listener calls a method when a message arrives. There are two flavors of SNMP listeners: Version 1/2c (without authentication) and version 3 (with authentication).

Once you instantiate the class by using one of the static methods (if you use the secure version, user, pass and passphrase will be requested), a listener will be binded on localhost to a port of your choice. After that, each time an alert is trapped, processPdu(…) will add the alert to an internal list for asynchronous retrieval (when getPduListAndClear() is called).

The SNMP framework used is SNMP4J, which is also an open source project.

The Integration Zone is brought to you in partnership with Red Hat. Download the IDC Report: The Business Value of Red Hat Integration Products to learn more about Red hat Integration.


Published at DZone with permission of Nahuel Dalla Vecchia , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}