简体   繁体   中英

How to write monitoring software using java

I would like to write a library to monitor java cron jobs running on widnows server/linux servers.

Not sure how we can track a java cron job wheter

  1. It has run
  2. If so, is it successful
  3. iF NOT, WHEN IT FALIED
  4. When is the last time it's successful
  5. Also, maintain historical data of above info

We have infrastructure set up in our company to monitor servers, disk usage, memory etc.... but we don't have any tracking on the cron jobs we setup in our department.

I'm planning to use java for this one but not sure how this can be done. Also, i'm planning to use a DB to collect the status and store so that we can view the historical data and not just current status.

Please let me know how this can be done .... basically design a dashborad kind of thing which depicts the status of all my jobs at one shot.

Thanks for any help in this regard.

We have created something used in-house which we eventually made into a SaaS webapp. It's called PushMon, and it pretty much does what you've listed above. It's not a library, but I can quickly describe how we did it.

It has run. Your cron job "pings" the monitoring system to tell it it ran. It simply calls a URL.

It's successful. You only "ping" if you are successful.

When it failed. If the job knows when it fails, it can do a special failed "ping". If the job does not know it failed, like it never ran at all, the monitoring system will notice the missing ping and send an alert.

When is the last time it's successful. The monitoring system keeps tracks of these "pings".

Maintain historical data. The monitoring system stores all information in the database and provides some tables and charts.

This is a web application written in Spring MVC running on Tomcat. The dashboard/UI is jQuery UI, but would use Bootstrap if given the chance to do it all over again. The charts are using Google Charts.

Thanks for the response.

The way it's handled is good. May be , we also may think of that option. Is it opensource? Is the URL we need to call is PushMon specific (meaning the job status will be stored in your DB? We need to store everything within our company insfrastrucure)

We are working on few options.

  1. Use log4j and JMSappender and Apache ActiveMQ as JMS server

Using the above, we log status to JMS and a lsitener will read and insert into DB so that we can store historical data. Provide a web interface on top of this DB to read status and provide graphical view.

However, we are foreseeing one issue here. Is JMS sends the log entries in order and listner receive them in order or not. Haven't explored on that yet.

Initially we thought of using JDBCAppender to log the entries directly to DB. However, few reviews say that it's bit slow as our apps and DB are distributed there may be a network overhead and hit the performance of the app.

  1. Exploring some open source monitoring softwares which can fulfill our requirements so that we need only invest time in setting up the monitoring software and we are good ..... no need to really get into testing/maintaining self developed monitoring softwares.

If you know of any better ways, please let us know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM