简体   繁体   English

如何监视Java控制台应用程序?

[英]How to monitor a java console application?

I want to ensure that a java console application is running fine 24/7. 我想确保Java控制台应用程序可以24/7正常运行。 It is just a plain jar, no application server involved. 它只是一个普通的jar,不涉及应用程序服务器。

The things I want to monitor externally should be: 我要在外部监视的内容应该是:

  • the console app is actually running 控制台应用程序实际上正在运行
  • the database connection is alive 数据库连接处于活动状态
  • any webservice connections are alive (the app is mainly a soap client) 任何Web服务连接均处于活动状态(该应用程序主要是Soap客户端)
  • some statistics on eg CPU 一些统计信息,例如CPU
  • cron jobs are running cron作业正在运行

There are several servlet applications that provide those metrics when running on an application server. 当在应用程序服务器上运行时,有几个servlet应用程序提供这些指标。 But what about my case where it's just a cmd application? 但是,如果我只是一个cmd应用程序,该怎么办? How could I expose those tasks to external tools? 我如何将那些任务暴露给外部工具?

Why not just use Jetty to allow your app to serve up a status page on demand? 为什么不只使用Jetty来让您的应用程序按需提供状态页? Or some JSON if you want it parseable by some other service? 还是一些JSON(如果您希望它可被其他服务解析)?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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