Java:操作员通知
我们需要监控应用程序的稳定性。该流程的一部分是通知操作员(通过 xmpp、电子邮件等)业务流程中的潜在问题。
We need to monitor application stability. On of the part of this process is notifying operators (via xmpp, email, ...) about the potential issues in the business process.
That tools is more preferable for this kind of activity? Is it a good idea to use monitoring solutions like nagios or zabbix, or maybe some advanced java libraries exist for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于程序可以自行发现问题,因此您可以使用现代日志记录框架提供的功能。您可以针对 slf4j API 进行编码,并使用配置为处理特殊错误消息等的日志记录后端。
然后,您只需在代码中包含这样的代码片段:
这种编译时的通用方法可以在运行时执行以下一项或多项操作:
,或者您可以编写自己的代码来执行您需要执行的操作。
As the program can discover issues itself, you could use the facilites available with a modern logging framework. You code against the slf4j API and use a logging backend configured to handle e.g. error messages special.
You then just have to have such a snippet in your code:
This generic approach at compile time can then do one or more of the following at runtime:
or you can write your own code doing what you need to have done.
您可以使用 log4j SMTPAppender 发送向操作员发送电子邮件以获取选定的错误级别日志 - 需要分析问题的条目。
对于基于日志的监控,您可能需要检查 Chainsaw
You could use log4j SMTPAppender to send eMails to operators for selected error-level log - entries that require analization of an issue.
For log based monitoring you might want to check Chainsaw
Log4J 对于监视事件很有用(例如:某些东西崩溃了,需要很长时间才能完成等)
如果您需要实时监视,您应该使用 JMX beans。
该技术旨在监控应用程序的活动。
使用这项技术,您可以在违反某个阈值时发出通知。 (队列已满 75%)
有多种工具可以连接到支持 JMX 的系统并对其进行监控。
Log4J is useful for monitoring events (Ex: something has crashed, takes too long to complete, etc)
If you need realtime monitoring you should use JMX beans.
This technology is designed for monitoring the activity of the applications.
With this technology you could notify when some threshold is breached. (queue is filled by 75%)
There are several tools to connect to JMX enabled systems and to monitor them.