Manage running Java apps remotely

Viewed 82

We have several Java standalone applications (in form of Jar files) running on multiple servers. These applications mainly read and stream data between systems. We are using Java 8 mainly in our development. I was put in charge recently. My main function is to manage and maintain these apps.

Currently, I check these apps manually by accessing these servers, check if the app is running, and sometimes run some database queries to see if the app started pulling data. My problem is that in many cases, some of these apps fail and shutdown due to data issue or edge cases without anyone noticing. We need some monitoring and application recovery in place.

We don't have docker infrastructure in place. We plan to implement docker in the future, but for now this is not an option.

After research, the following are options I thought of or solutions I tried:

  1. Have the apps create a socket client which sends a heartbeat to a monitoring app (which needs to be developed). I am keeping this as my last option.
  2. I tried to use Eclipse Vertx to wrap the apps into Verticles. Then create a web view that can show me status and other info. After several tries, the apps fail to parse the data correctly (might be due to my lack of understanding to Vertx library).
  3. Have a third party solution that does this, but I have no idea what solutions are out there. I am open for suggestions.

My requirements are:

  1. Proper monitoring of the apps running and their status.
  2. In case of failure, the app should start again while notifying the admin/developer.

I am willing to develop a solution or implement a third party one. I need you guidance on this.

Thank you.

2 Answers

Have you heard of Java Service Wrappers? Not a full management functionality, however it would monitor for JVM crashes and out of memory conditions and restart your application for sure. Alerting should also be possible.

There is a small comparison table here: https://yajsw.sourceforge.io/#mozTocId284533

So some basic monitoring and management is included already. If you need more, I suggest using JMX (https://www.oracle.com/java/technologies/javase/javamanagement.html) or Prometheus (https://prometheus.io/ and https://github.com/prometheus/client_java)

You could use spring-boot-actuator (see health). It comes with a built-in endpoint that has some health checks(depending on your spring-boot project), but you can create your own as well.

Then, doing a http request to http://{host}:{port}/{context}/actuator/health (replace with yours), you could see those health checks status and also use the response status code to monitor your application.

Related