MMC Customer stories series: SNMP alerts
MotivationWe 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:
- Polling information using MMC REST API
- Using MMC’s Alerts system
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.
Ah! How do we process the alert 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 Nagios). |
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 alertsHere 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. |