在 Tomcat 中监控 webapp -(不是 tomcat 监控)

发布于 2024-10-09 18:35:57 字数 345 浏览 0 评论 0原文

我正在寻找有关如何最好地监视 Tomcat 中运行的应用程序的想法。我不是指 Tomcat 监控,而是检查“Web 应用程序”是否处于活动/活动状态。

我知道有几种用于监视 Tomcat 的工具(lamdbaprobe、Nagios 等),但我想监视 Tomcat 中运行的实际应用程序。原因是,在多种情况下,Tomcat 可以运行,但应用程序无法使用

。我正在考虑的一个解决方案是编写一个尝试访问应用程序的工具。例如编写一个java工具来发送HTTP请求并监视响应。

对此最好的方法是什么?我听说过很多人提到JMX,但我对它了解不多。可以用来做上面的事情吗?您是否知道任何其他现有工具可以做到这一点,或者您是否知道更好的方法?

Im looking for ideas on how to best monitor an application running in Tomcat. I am not refering to Tomcat Monitoring but rather checking that the "web application" is active/live.

I know that there are several tools for monitoring Tomcat (lamdbaprobe, Nagios etc) but i want to monitor the actual application that is running within Tomcat. The reason for this is that there are several situations where Tomcat could be running but the application could not be available

One solution that i am thinking about is writing a tool that would try and access the application. For example write a java tool to send and HTTP request and monitor the response.

What is the best approach for this? I have heard of JMX mentioned a lot but i dont know much about it. Can it be used to do the above? Do you know of any other existing tool that would do this or do you know of a better approach ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

樱娆 2024-10-16 18:35:57

JMX 是你应该选择的。

最简单的形式只不过是编写一个接口、用于访问信息的相应类,然后在 MBeanServer 中部署该实例。这是一件轻而易举的事——只要稍微谷歌一下,你就应该在一小时内找到一个解决方案。

使用这种方法,您可以与 Tomcat 本身等无缝集成。 Tomcat 还使用 JMX 发布其信息。

通信基于标准,有很多工具都支持“JMX over RMI”,例如 jconsole 或 jvisualVM。大多数监控软件都有 JMX 插件(Nagios 和其他 - 我们使用 Hyperic)。

编辑

好吧,让我们反过来看一下。编写一个类来收集您要发布的信息。确保信息必须在某处公开...

class MyInfo {
  public int getCurrentValue() {
    // lookup this value wherever yoy want
    return 42;
  }
}

编写一个接口

interface MyInfoMBean {
  public int getCurrentValue();
}

编写一个在 Web 应用程序启动时注册此 MBEan 的 ContextListener。

因此,您是否需要以任何方式更改您的应用程序取决于您想要发布的信息是否容易获得。

JMX is what you should choose.

In its simplest form it is not more than writing an interface, the respective class for accessing the information, and then deploy this instance in the MBeanServer. It's a breeze - with a little google you should come up with a solution in an hour.

Using this appraoch you have seamless integration with for example Tomcat itself. Tomcat also publishes its information using JMX.

Communication is based on a standard, there are lot of tools around that speak "JMX over RMI", for example the jconsole or jvisualVM. Most monitoring software have JMX plugins (Nagios and others - we use Hyperic).

EDIT

Well, lets look at it the other way round. Write a class that gathers the information you want to publish. For sure the information mut be public somewhere...

class MyInfo {
  public int getCurrentValue() {
    // lookup this value wherever yoy want
    return 42;
  }
}

Write an interface

interface MyInfoMBean {
  public int getCurrentValue();
}

Write a ContextListener that registers this MBEan at web app start.

So, if you need to change your application in any way depends if the information you want to publish is easily available.

云雾 2024-10-16 18:35:57

您尝试过使用 JVisualVM 吗?它附带 Oracle SDK,可以满足您的需要。

Have you tried using JVisualVM? It comes with the Oracle SDK and may give you what you need.

墨落画卷 2024-10-16 18:35:57

我曾经使用过 AppDynamics Lite,它对于监控性能非常有帮助部署在 Tomcat 上的应用程序。有一个高级版本,但我认为它不是免费的。精简版可以免费使用。

I had once worked with AppDynamics Lite, and it was really helpful in monitoring performance of applications deployed on Tomcat. There's an advanced version, but i don't think it's for free. the lite version is free to use.

我很OK 2024-10-16 18:35:57

我刚刚打开了一个新的应用程序性能监控工具

https://github.com/scouter-project/scouter /

服务监控与 Tomcat 监控确实不同。
SCOUTER是一个Web应用程序服务监控工具。
您可以在响应散点图(XLOG 图表)上检查每个事务(服务请求)的性能(也包括 profole/sql)

I've just open a new application performace monitoring tool

https://github.com/scouter-project/scouter/

Service monitoring is really different then Tomcat monitoring.
SCOUTER is a web application service monitoring tool.
You can check the performance(also profole/sqls) of every single transaction(service request) on the response scatter chart(XLOG chart)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文