Can we use JMX for Alerts/Notification
Asked Answered
E

6

7

Here are the specs that I'm trying to implement in a nutshell:

1) Some Alerts have to be sent on certain events in the application.

2) These Alerts have Users subscribe to them.

3) And the Users have set their own Notification preferences (e.g. Email and/or SMS).

I have not been able to find an open source solution in Java so far.

Is JMX Notifications an option? The more I read about JMX, the more I feel that it is trying to achieve something different that my problem.

Any help would be useful.

Elide answered 19/11, 2008 at 22:25 Comment(1)
JMX does not guarantee the delivery of notifications.Frow
L
12

JMX can be a mechanism to solve this problem, but it's not the complete solution.

JMX provides facilities and services to your programs to allow clients to access monitoring data as well as allowing clients to make control calls to the application.

As you mentioned, one aspect of JMX is the notification system. What this system provides is infrastructure to make it easy for your program to make alerts and notifications available to clients, and modern JVMs also provide a free JMX server to allow client to connect to your application remotely and subscribe to those events.

But its one thing to make a JMX alert, and it's another thing completely to act on it.

What you would need to do is have some JMX client, somewhere, "subscribe" to the JMX notifications of your programs, and then THAT client can act upon those notification by sending emails, or whatever.

The JMX client can be a remote client talking to your application via TCP, or it can be an internal JMX client within the program, running in a thread, say, and it can act on the notifications.

So, basically, JMX provides the plumbing and infrastructure for what you want to do, but doesn't take it "the last mile" to converting alerts in to emails.

As @fawce mentioned, there are some "generic" JMX clients of various sophistication that can act upon JMX data and may do what you want (I'm not familiar with them, so I can not say first hand), or you can code your own system to monitor the JMX data.

Levileviable answered 19/11, 2008 at 23:32 Comment(2)
Nagios is a generic monitoring application that is open source. It has "probes" that live on monitored systems, and it has a dispatcher to convert probe data to alerts (email, sms, IM, etc). It also logs all the alerts. Monju is a generic JMX-Probe for Nagios.Tacet
You said "modern JVMs also provide a free JMX server to allow client to connect to your application remotely and subscribe to those events". Any reference to what is that component?Matelote
U
1

There is an article with sample code for using JMX in your app to raise alerts: Delivering notification with JMX.

Once you have that working with local monitoring, you need to set these properties when executing your program:

-Dcom.sun.management.jmxremote.port=9999 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false

.. so that you can connect from a remote machine using jconsole or other tool with JMX capabilities.

JManage is one of many programs to monitor JMX-enabled Java processes capable of:

  • plotting webpages of moving graphs
  • emitting e-mails when thresholds change
  • remote control

You can easily upgrade to something more complex, such as Nagios or another commercial tool. Those tools have workflows, roles and other features suitable for big teams - which might be a distraction if you just starting out with getting the Java side of JMX working.

Uraeus answered 10/9, 2010 at 6:41 Comment(0)
T
0

If you mean JMX, there is a JBoss/Nagios bridge called monju that has a generlized JMX hook.

Tacet answered 19/11, 2008 at 23:8 Comment(0)
N
0

I would suggest using JMX notifications and SNMP which should support your scenario, 2) and 3) being covered by the SNMP software.

You could also code it in Java yourself as long as you have access to a SMS gateway with some API. Using javax.mail is straightforward as long as you have access to a SMTP host allowing anonymous access. A flexible publish-subscribe mechanism for 2) can be used to connect 1) and 3).

Neolith answered 7/1, 2009 at 21:53 Comment(0)
Z
0

Solarwinds is a commercial enterprise monitoring tool that has the ability to hook into JMX for monitoring. It has the ability to generate SMS and Email alerts.

Zloty answered 22/4, 2019 at 13:15 Comment(1)
The specific component in SolarWinds to do that is called the "JMX Bridge". Monitors in SolarWinds can be configured for any attribute value exposed by JMX in a running Java application. These values can then be displayed in web browser accessible dashboards provided by SolarWinds to allow support staff to remotely monitor application status, etc.Sentimental
F
-1

Do you mean JMS (instead of JMX)? JMS is an messaging API while JMX is a monitoring/administration API. Using JMS as the back end is a good way to implement the back-end messages, it will take care of decoupaging, load balancing, and persistency. But you still have to have a component that receives the messages and send them on to the user.

Frequentative answered 19/11, 2008 at 22:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.